Avatar of stev75
stev75
 asked on

loading an ActiveX without registering

I like to use an already accepted solution by jkr. This describes how to load ActiveX without registering.

(Related Solution:
Loading ActiveX without registry)

Normally, when using COM, you would declare an interface in idl and let the compiler create the REFIID to the interface pointer.

Now things look different at my configuration:

I have a project, which I want to modify, to use ActiveX without registering. This project (mfc) has activeX controls as dialog controls in the resources.
The dialog resource is viewable in visualstudio, when you register the control by regsvr32. Otherwise not.
So I removed the ocx dialog controls. Now want to put them in again at runtime. I don't know how to find out the necessary RIID

So in the solution mentioned, I need to find out what to pass for these parameters:  

  REFIID riid,         //Reference to the identifier of the interface ? I have no COM interface, but a header file

  LPVOID * ppv         //that should be a ptrptr to my dialog (OCX) control (?)

Thanks jkr, and all other experts, for some more info on this topic!!
C++

Avatar of undefined
Last Comment
stev75

8/22/2022 - Mon
jkr

So, you basically want to access the resource in the DLL and no COM object? In that case, 'LoadLibrary()'/'LoadResource()' should work...
stev75

ASKER
ah, i guess i have to call LoadLibrary("my.ocx") and then Create the control using CWnd::CreateControl() ?
btw, does CWnd::CreateControl() have an influence on Wind OS users rights ? The point of it all is, that every user, also non-administrators, should use the software that uses the activeX functions.
 
 
jkr

Err, 'CreateControl()' requires a registered object, so that is not the way to go. But, what about temporarily registering your module? See e.g. http://support.microsoft.com/kb/207132 ("INFO: How Regsvr32.exe Registers and Unregisters COM DLLs")
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
stev75

ASKER
ok, if there's no other way, i need to do it. But I'm still looking for a workaround for regsvr32 or DllRegisterServer().
CreateControl() function may be needed for OCX controls, but what about using createwindow() and "connect" to the library handle ?
The error that CreateControl returns is 126 ERROR_MOD_NOT_FOUND. On the other hand i have a library handle returned by loadlibrary("my.ocx").
Is it worth trying to set it as the "missing module" from CreateControl ? What do you think ?
jkr

An ActiveX control requires a complex framework to communicate with the app that hosts it, so I think that you would be better off going the route to register it. A library handle is something completely different, it basically represents the base load address of that DLL in your process' memory - nothing else.
stev75

ASKER
ah, OK! Then can you leave a comment on this solution>
 Loading ActiveX without registry
http://www.experts-exchange.com/Programming/Languages/CPP/Q_22671452.html
 Now it sounds to me that it isn't working either. How does your previous comment  go along with the posted solution ?
Sorry that i don't see the difference. Can you explain ?
 Thanks!
 
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
stev75

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.