GetCodeForDllUnregisterServer

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at GetCodeForDllUnregisterServer.

Gets the appropriate code for unregistering a server.

Syntax

  
      function GetCodeForDllUnregisterServer(   
   nLineStart,   
   nLineEnd    
);  

Parameters

nLineStart
The zero-based line number for the start of the function.

nLineEnd
The zero-based line number for the end of the function.

Return Value

A string containing the code for unregistering the server.

Remarks

Call this member function to retrieve the appropriate code for unregistering the server:

Line number Code
0 AFX_MANAGE_STATE(AfxGetStaticModuleState());
1 _AtlModule.UpdateRegistryAppId(FALSE);
2 HRESULT hRes = _AtlModule.UnregisterServer(TRUE);
3 if (hRes != S_OK)
4 \treturn hRes;
5 if (!COleObjectFactory::UpdateRegistryAll(FALSE))
6 \treturn ResultFromScode(SELFREG_E_CLASS);
7 return S_OK;

For each of the lines returned, GetCodeForDllUnregisterServer adds a leading tab (\t) and a trailing "CR-LF" (carriage return - linefeed) character pair (\r\n).

Example

// Get the lines numbered 2 and 3 above  
GetCodeForDllUnregisterServer
(2, 3)  
  
// returns the following string  
// "\tHRESULT hRes = _AtlModule.UnregisterServer(TRUE);\r\n\tif (hRes != S_OK)\r\n"  
  

See Also

Customizing C++ Wizards with Common JScript Functions
JScript Functions for C++ Wizards
Creating a Custom Wizard
Designing a Wizard
GetCodeForDllRegisterServer