How to start Gen 8.6 Client Manager (CM) process IEFCMN.EXE minimized or hidden in full background mode.
The objective is to hide the CM process to stop the user inadvertently closing it after it has been started.
To start the CM completely hidden i.e. in full background requires starting it programmatically from another process.
These examples created by Gen Support after researching the web have been found to be successful.
NOTE: No official support is implied and these examples are used at own risk.
Dim CMShell
Set CMShell = CreateObject("WScript.Shell")
CMShell.Run "C:\PROGRA~2\CA\Gen86\Gen\IEFCMN.EXE iefcm startup /initfile=iefcmn.ini", 0
Set CMShell = Nothing
#include <windows.h>
#include <stdio.h>
int main()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
// Start the child process.
if( !CreateProcess(NULL, // No module name (use command line)
"C:\\Program Files (x86)\\CA\\Gen86\\Gen\\IEFCMN.EXE iefcm startup /initfile=iefcmn.ini", // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}
}
**********
Microsoft Learn > Create processes
Microsoft Learn > Setting Window Properties Using STARTUPINFO
Stack OverFlow > CreateProcess calling cmd.exe incl. arguments with no showing (flashing) window?
Set correct Visual Studio environment using command-line command: "%Gen86%\Gen\genenv.bat" 32 [vsver] (see doc for Testing and Running Applications for Windows IT > GENENV.BAT)
Compile and link run_cm.c with cl.exe i.e. run command "cl run_cm.c" to create run_cm.exe which can then be run from Windows Explorer or command line.
Potentially similar code can be used within a Gen GUI client application External Action Block or Inline Code if it is required to automatically start the CM from within the code when the application starts.
NOTE: It is not possible to run the CM as a Windows service.
The option to run the CM as a service is not provided out of the box. Even if a CM service is implemented using some custom third party mechanism, although the CM will start successfully, when an application tries to use it problems will occur due to failures to access shared memory because it is being run as a service i.e. these messages will appear in the IEFCMN.LOG file:
**********02/08 14:53:24:686 TID:12156 OpenFileMapping( :SHAREMEM:IEFCOM:CLIENT/PID1108.MEM ) failed: 2
02/08 14:53:24:686 TID:12156 OpenEvent(:SEM:IEFCOM:CLIENT/PID1108.SEM) error 2 (0x2)
02/08 14:53:24:967 TID:12156 OpenFileMapping( :SHAREMEM:IEFCOM:CLIENT/PID7472.MEM ) failed: 2
02/08 14:53:24:967 TID:12156 OpenEvent(:SEM:IEFCOM:CLIENT/PID7472.SEM) error 2 (0x2)
**********