PRB: ATL Servers Do Not Unregister Their Type LibraryLast reviewed: February 5, 1998Article ID: Q179688 |
The information in this article applies to:
SYMPTOMSATL servers do not remove type library registry entries when unregistered.
CAUSEThere is no code to remove type library registry entries.
RESOLUTIONAdd the code below to each type of ATL server to make sure registry entries are removed.
In-Process ServersFor an In-Process server, add the call UnRegisterTypeLib() to DllUnregisterServer():
STDAPI DllUnregisterServer(void) { HRESULT hr = _Module.UnregisterServer(); if (FAILED(hr)) return hr; #if _WIN32_WINNT >= 0x0400 hr = UnRegisterTypeLib(LIBID_<ProjName>Lib, 1, 0, LOCALE_NEUTRAL, SYS_WIN32); #endif return hr; } Local ServerFor a local server, add the call to UnRegisterTypeLib() to WinMain():
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/) { ... ... while (lpszToken != NULL) { if (lstrcmpi(lpszToken, _T("UnregServer"))==0) { bRun = FALSE; _Module.UpdateRegistryFromResource(IDR_<ProjName>, FALSE); nRet = _Module.UnregisterServer(); if (FAILED(nRet)) break; #if _WIN32_WINNT >= 0x0400 nRet = UnRegisterTypeLib(LIBID_<ProjName>Lib, 1, 0, LOCALE_NEUTRAL,SYS_WIN32); #endif break; } ... ... } ... ... } ServiceFor a service, add the call to UnRegisterTypeLib() to WinMain():
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/) { ... while (lpszToken != NULL) { if (lstrcmpi(lpszToken, _T("UnregServer"))==0) { int nRet = _Module.UnregisterServer(); if (FAILED(nRet)) return nRet; #if _WIN32_WINNT >= 0x0400 return UnRegisterTypeLib(LIBID_<ProjName>Lib, 1, 0, LOCALE_NEUTRAL, SYS_WIN32); #endif } ... ... } ... ... }NOTE: UnRegisterTypeLib() is exported only by the newer version of Oleaut32.dll shipped with Windows NT 4.0, Windows 95 with DCOM, and Internet Explorer 3.x. NOTE: Make sure the LCID and major and minor version numbers passed as parameters to UnRegisterTypeLib() are the same as that specified in the project .idl file. No lcid attribute in the .idl file implies LOCALE_NEUTRAL.
STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. (c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Jaganathan Thangavelu, Microsoft Corporation Keywords : AtlReg AtlServer kbcode Technology : atl Version : WINDOWS:2.0,2.1 Platform : WINDOWS Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |