Setting and Getting Information for Remote Applications
Applications that can be launched remotely can be entered into the registry in any manner. However, the best and most convenient way to register an application is with the INmSysInfo::SetNmApp method. SetNmApp takes four parameters, which are used to register the application with the system. Its complementary function, INmSysInfo::GetNmApp, passes the first parameter as an "in" parameter, and the last three as "out" parameters to be filled in by the INmSysInfo interface. Using SetNmApp is preferable to modifying the registry directly because it will continue to work even if the registry keys are moved in a future release of NetMeeting.
The following table describes the parameters you need to provide.
Parameter | Usage/Meaning | Registry key |
---|---|---|
REFGUID rguid | The GUID in the registry associated with the application being launched. This GUID identifies the application and is needed when calling LaunchRemote. Each application to be launched remotely should have one GUID that can be used to register with any computer. For more information about creating and using GUIDs, see Inside OLE, referenced in Further Reading. | In the registry, the value of rguid is the folder name of the entry for this application. |
BSTR bstrApplication | The full path and file name of the module that will be started when there is an incoming request to launch the application associated with the rguid parameter. If the bstrApplication parameter is NULL, the module name must be the first white-space-delimited token in the bstrCommandLine string. | This parameter is reflected in the registry as the Path registry key under the rguid folder. |
BSTR bstrCommandLine | Specifies the command line to execute. If this parameter is NULL, the function uses the string pointed to by bstrApplication as the command line. | This parameter is reflected in the registry as the CmdLine registry key under the rguid folder. |
BSTR bstrDirectory | Specifies the current drive and directory for the child process. The string must be a full path and file name that includes a drive letter. If this parameter is NULL, the new process is created with the same current drive and directory as the calling process. | This parameter is reflected in the registry as the Directory registry key under the rguid folder. |
Code Example
The following code example demonstrates how to use the SetNmApp method to add your application's keys to the registry. It also demonstrates the use of the GetNmApp method to read these values.
HRESULT hr; INmManager *pManager; INmSysInfo *pSysInfo; // Add code to retrieve and initialize pManager // and pSysInfo BSTR bstrApp, bstrCom, bstrDir; LPTSTR_to_BSTR( &bstrApp, "C:\RemoteDemo\Demo.exe" ); LPTSTR_to_BSTR( &bstrCom, "C:\RemoteDemo\Demo Arg1 Arg2" ); LPTSTR_to_BSTR( &bstrDir, "C:\RemoteDemo" ); hr = pSysInfo->SetNmApp( IID_APPGUID, // a predefined GUID for this App bstrApp, // Full path and file name bstrCom, // Path and file with command-line args bstrDir ); // The working directory to useif( SUCCEEDED( hr ) ) { MessageBox( NULL, "We set this app as remote launchable", NULL, MB_OK ); } else { MessageBox( NULL, "We did not set this app as launchable", NULL, MB_OK ); }SysFreeString( bstrApp ); SysFreeString( bstrCom ); SysFreeString( bstrDir );hr = pSysInfo->GetNmApp( IID_APPGUID, // GUID for the app we want to know about &bstrApp, // the three BSTR parameters will // be filled with info &bstrCom, // retrieved from the registry &bstrDir );if( SUCCEEDED( hr ) ) { // do something with the BSTR parameters that have been filled }