Content Manager OnDemand invocation and DDEML initialization

Content Manager OnDemand must be an active Windows application before a DDE conversation between it and a client application can be established.

The client application typically invokes Content Manager OnDemand, specifying (at a minimum) the Enable DDE Interface parameter. This parameter causes Content Manager OnDemand to enable its DDE interface; if it is not specified, Content Manager OnDemand ignores all DDE communication.

Other parameters can be used to position the window, provide a custom title, logon a user, open a folder, and so on. Many of these actions can also be performed by DDE functions. The command line parameters should be used to establish the initial appearance of the Content Manager OnDemand window.

After Content Manager OnDemand has been made active, the client application must identify itself to the DDEML. This is done with the DdeInitialize DDEML function.

Finally, the client application must establish a DDE conversation with Content Manager OnDemand. This is done with the DdeConnect DDEML function. The service name of the Content Manager OnDemand server application is ARS. The topic name for the conversation is also ARS.

The following is a typical example for establishing a DDE conversation with Content Manager OnDemand for Windows.
 /* Global Variables */
 DWORD DdeInstance;
 HCONV hDdeConv;
     .
     .
     .
 /* Local Variables */
 FARPROC pfnDdeCallBack;
 HSZ hDdeString1, hDdeString2;
 UINT rc;
 char cmdline[500], buffer[500];
     .
     .
     .
 /* Invoke Content Manager OnDemand */
PROCESS_INFORMATION pi;
STARTUPINFO sui;

memset( &sui, 0, sizeof(STARTUPINFO) );
sui.cb = sizeof(STARTUPINFO);

rc = CreateProcess( NULL,
                    cmdline,
                    NULL,
                    NULL,
                    FALSE,
                    CREATE_NEW_CONSOLE,
                    NULL,
                    NULL,
                    &sui,
                    &pi );

if ( !rc )
{
  sprintf( buffer,
           "CreateProcess of '%s' failed with error %ld",
           cmdline,
           (long)GetLastError( ) );
  MESSAGE( buffer );
  return;
}
 /* Initialize DDEML */
 pfnDdeCallBack = MakeProcInstance( (FARPROC)DdeCallBack, hInst );
 DdeInstance = 0;
 DdeInitialize( DdeInstance,
                (PFNCALLBACK)pfnDdeCallBack,
                APPCLASS_STANDARD | APPCMD_CLIENTONLY,
                0L );
 if ( DdeInstance == 0 )
 {
   MESSAGE( "DdeInitialize failed" );
   return;
 }
 /* Connect to Content Manager OnDemand DDE Interface */
 hDdeString1 = DdeCreateStringHandle( DdeInstance, "ARS", 0 );
 hDdeString2 = DdeCreateStringHandle( DdeInstance, "ARS", 0 );
 for ( j = 0; j < 100; j++ )
 {
   hDdeConv = DdeConnect( DdeInstance, hDdeString1, hDdeString2, NULL );
   if ( hDdeConv != NULL )
     break;
 }
 DdeFreeStringHandle( DdeInstance, hDdeString1 );
 DdeFreeStringHandle( DdeInstance, hDdeString2 );
 if ( hDdeConv == NULL )
 {
   MESSAGE( "Unable to connect to Content Manager OnDemand" );
   return;
 }
     .
     .
     .