Register dll com component
-
I wnat to know how to register a dll com component in C# using windows APi not a shell command. Please I need it urgently.
1. Load the dll with ::LoadLibrary() 2. Get the address of the library's exported function DllRegisterServer with ::GetProcAddress() 3. Call the library's DllRegisterServer() 4. Unload the library with ::FreeLibrary() Like this, pasted from MSDN:
typedef HRESULT (STDAPICALLTYPE *CTLREGPROC)() ; // Requires stdole.h
HMODULE hModule = ::LoadLibrary(m_strPathName) ;
CTLREGPROC DLLRegisterServer =
(CTLREGPROC)::GetProcAddress(hModule,"DllRegisterServer" ) ;
DLLRegisterServer() ;
::FreeLibrary(hModule) ;Hope this helps -- Roger
_It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"_
-
1. Load the dll with ::LoadLibrary() 2. Get the address of the library's exported function DllRegisterServer with ::GetProcAddress() 3. Call the library's DllRegisterServer() 4. Unload the library with ::FreeLibrary() Like this, pasted from MSDN:
typedef HRESULT (STDAPICALLTYPE *CTLREGPROC)() ; // Requires stdole.h
HMODULE hModule = ::LoadLibrary(m_strPathName) ;
CTLREGPROC DLLRegisterServer =
(CTLREGPROC)::GetProcAddress(hModule,"DllRegisterServer" ) ;
DLLRegisterServer() ;
::FreeLibrary(hModule) ;Hope this helps -- Roger
_It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"_
-
Thank you for your help. But please could you give me the C# code becuase I am not good in C++.
ass3aad wrote:
But please could you give me the C# code becuase I am not good in C++.
Sorry, I don't do C#, but you should be able to figure it out. I don't think the two languages should differ that much. The flow is the same as in any language and the API calls made are the same. -- Roger
_It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"_
-
I wnat to know how to register a dll com component in C# using windows APi not a shell command. Please I need it urgently.