When I try to recompile an OCX while in VB6 (run in Admin mode), I get "Permission Denied". I'm running Windows 7, 64 bit. I've already tried to set VB6.EXE to run in compatibility mode for XP SP3.

I'm trying to create a new version of the OCX. I set "Binary Compatibility" on the "Component" tab for the project properties for this OCX.

Any ideas???

Dani AI

Generated

Likely causes and quick summary: common reasons for a VB6 “Permission Denied” when recompiling an OCX on Windows 7 x64 are (a) the OCX is loaded by a running process (shell extension, service, another app or even another VB6 instance), (b) the OCX lives in a protected system folder and is locked by Windows/AV, or (c) the wrong registration tool/bitness was used when registering/unregistering. ’s suggestion that the control is already running is the top suspect; more detailed diagnostics help pinpoint which case applies. (learn.microsoft.com)

How to find what’s holding the file: close all VB6 IDE instances and any apps that might host the control, then use Sysinternals Process Explorer (Find -> Handle or DLL) or the Handle command-line tool to search for the OCX name. If a process shows the OCX loaded, either stop that process/service or carefully close the handle from Process Explorer (only when safe). These tools make it easy to see which process is locking the file. (learn.microsoft.com)

Unregister/register the control correctly (run an elevated command prompt): on 64-bit Windows a 32-bit OCX must be un/registered with the 32-bit regsvr32 in SysWOW64; 64-bit OCX use the System32 regsvr32. Example commands:

:: unregister 32-bit OCX on x64
C:\Windows\SysWOW64\regsvr32 /u "C:\Path\MyControl.ocx"

:: unregister 64-bit OCX
C:\Windows\System32\regsvr32 /u "C:\Path\MyControl.ocx"

After unregistering and stopping the host process, rebuild and then re-register. (learn.microsoft.com)

Binary-compatibility workflow: do not point the project’s Binary Compatibility location at the same file path the project is compiling to. Keep a stable “compatibility copy” in a writable dev folder (or temporarily set No Compatibility to build, then revert). Pointing Binary Compatibility at the build output commonly causes locks/confusion; keeping a separate copy prevents that. (stackoverflow.com)

If Permission Denied still happens, capture the build attempt with Process Monitor (filter on the OCX filename and watch for ACCESS_DENIED results) to see which process and which security token is failing, check file ACLs/attributes, and try a temporary AV exclusion while replacing the file. Procmon will show the exact failure and make the next step obvious. (learn.microsoft.com)

Recommended Answers

All 2 Replies

More information than a simple "Permission Denied" would be helpful. I don't know if this will help...

Unfortunately, I don't know much about this (OLE Controls) as I try to keep as far from MS application development as possible these days - it just irritates the heck out of me!

i think that peice of software is already running, so press Ctrl+Alt+delet and stop that process. now try to do it again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.