进程内注册控件

HRESULT DllUnregisterServer(LPCTSTR lpszDLLPath)
{
HINSTANCE hDLL = LoadLibrary(lpszDLLPath) ;
if (hDLL)
{
   typedef HRESULT (__stdcall *PFN_DllUnregisterServer)(void) ;
   HRESULT hr ;
   PFN_DllUnregisterServer pfn_DllUnregisterServer = (PFN_DllUnregisterServer) GetProcAddress(

hDLL, "DllUnregisterServer" ) ;
   if (pfn_DllUnregisterServer)
   {
    hr = pfn_DllUnregisterServer() ;
   }
   FreeLibrary(hDLL) ;
   return hr ;
}
return E_FAIL ;
}


HRESULT DllRegisterServer(LPCTSTR lpszDLLPath)
{
HINSTANCE hDLL = LoadLibrary(lpszDLLPath) ;
if (hDLL)
{
   typedef HRESULT (__stdcall *PFN_DllRegisterServer)(void) ;
   HRESULT hr ;
   PFN_DllRegisterServer pfn_DllRegisterServer = (PFN_DllRegisterServer) GetProcAddress( hDLL,

"DllRegisterServer" ) ;
   if (pfn_DllRegisterServer)
   {
    hr = pfn_DllRegisterServer() ;
   }
   FreeLibrary(hDLL) ;
   return hr ;
}
return E_FAIL ;
}

 

    hr=DllRegisterServer(str);
    if(SUCCEEDED(hr))
    {
     TRACE("RUN/n");
    }else
    {
     TRACE("FALSE %s/n", str);
    }

你可能感兴趣的:(进程内注册控件)