GetCodeForDllRegisterServer

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

Gets the appropriate code for registering a server.

  
      function GetCodeForDllRegisterServer(   
   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.

A string containing the code for registering the server

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

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

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

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

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

Show: