Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What happens when I load my dll this way… ?

Status
Not open for further replies.

d00ape

Programmer
Apr 2, 2003
171
SE
What does my code do?

#import "MyDll.dll"
….
CoInitialize(NULL);

if(SUCCEEDED(m_IPtr.CreateInstance("MyDll.Stuff")) ) // Create intstance to component?
{
//is ok
}
else
{
//is not ok
}
 
no problems if your dll is an ActiveX dll and is registered. This is a standard way for working with COM objects.

Ion Filipski
1c.bmp
 
Thanks, good to hear.

Whats the difference between CreateInstance(...) and LoadLibrary(...) ?
 
CreateInstance may result in a load of some .exe or some .dll. It deppends on type of COM object, local or inproc. After that it query the interface IClassFactory, call CreateInstance of it and return to you usually a pointer to IDispatch or to IUnknown. You can not call directly functions from dll loaded with CreateInstance. You may only invoke methods through COM calls. However I think COM dll could expose functions in the same way as a regular dll but there is no reason to do it.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top