PDA

Click to See Complete Forum and Search --> : ActiveX OCX placing DLL in Windows\system32


Deeto
Dec 20th, 2010, 09:27 AM
I know this has been discussed but can't seem to find a resolution to my issue. I appreciate any advice!

I have an ActiveX OCX that uses picformat32.dll for some image handling operations. I've packaged up my OCX and referenced components into a CAB for deployment via IE using the VB Package and Deployment Wizard. The browser picks up the OCX and attempts to execute, but fails because the ocx's API call expects picformat32.dll to be in the Windows\system32 folder, and it's not getting placed there.

I've downloaded the Win SDK and handbuilt my INF and used cabarc to try and solve the problem, but nothing seems to work.

How to I get the picformat32.dll file - which is included in the CAB - to get copied to the client's Windows\system32 directory?

I don't want to have the users run a setup.exe program to install it, I was hoping that the browser could do it automatically.

Sorry for the newbish question. :) Happy Holidays!

LaVolpe
Dec 20th, 2010, 09:31 AM
Welcome to the forums.

1) A setup is the right way to go. It should require elevated privileges which would allow the dll to be installed/placed into the system folder.

2) Otherwise, place the dll in the same folder as your exe. By default, that's the first path searched for DLLs (as general rule of thumb)

You don't have issues registering the ocx? That may require elevated privileges also.

Deeto
Dec 20th, 2010, 09:37 AM
my OCX registers fine, and the browser executes it correctly. The problem is, the part of my code that references picformat fails because that dll isn't in the client's Windows\system32 folder.

Is there any way to have the browser automatically place the dll in the system32 folder? There are what appear to be lots of controls for this in the CAB INF, from registering DLL's to defining locations where they should be placed.

PS - this is running in a LAN environment and the IIS server hosting the webpage is Trusted.

LaVolpe
Dec 21st, 2010, 09:23 AM
Here's another suggestion. Probably not ideal unless you reset the path.
1) Have your ocx start with Sub Main()
2) In sub main, make a call to SetDLLDirectory (http://msdn.microsoft.com/en-us/library/ms686203%28v=VS.85%29.aspx) to append a path where the DLL can be found.