evanscolin
10-06-2009, 06:00 AM
Hi
Just wondered if anyone could assist me with the following, I need to check if a program is running and if so stop it and launch another, alternatively just launch the application
The code I have been given is in C++ but I only use VB6 so wondered if it was possible to convert it to run in my application
The C++ code is
//Initialise a VISIONLOGINCOMLib::IVisionLoginPtr COM object called ivl
//Initialise a VISIONLOGINCOMLib::IVisionAppPtr COM object iva
//login using the ivl object;
ivl->login();
// consultation ID
long consultationID = 0;
//message for current consultation
long msgID=0;
//NOTE THE STRING IN THE METHOD. COPY AND USE THE EXACT SAME STRING
msgID = iva->RegisterWindowMessage("INPS_E9F03C60B2FD11d388B400C04F19B17_17");
//consultationID will be greater than zero If there is a currently open consultation
iva->SendMessageToApp(ConsMgrID, msgID, 0, 0, &consultationID,VISIONLOGINCOMLib::VISION_APP_ORDER_LAST);
if (consultationID>0) // It means there is a consultation open
{
// taskkill is windows shell command to kill a process
Call command taskkill /IM ConMgr.exe
//run cons mgr command with a given patient ID
Call command O:\Program\conmgr.EXE -SelPat patient_id;
}
else
{
Call command O:\Program\conmgr.EXE -SelPat patient_id;
}
Just wondered if anyone could assist me with the following, I need to check if a program is running and if so stop it and launch another, alternatively just launch the application
The code I have been given is in C++ but I only use VB6 so wondered if it was possible to convert it to run in my application
The C++ code is
//Initialise a VISIONLOGINCOMLib::IVisionLoginPtr COM object called ivl
//Initialise a VISIONLOGINCOMLib::IVisionAppPtr COM object iva
//login using the ivl object;
ivl->login();
// consultation ID
long consultationID = 0;
//message for current consultation
long msgID=0;
//NOTE THE STRING IN THE METHOD. COPY AND USE THE EXACT SAME STRING
msgID = iva->RegisterWindowMessage("INPS_E9F03C60B2FD11d388B400C04F19B17_17");
//consultationID will be greater than zero If there is a currently open consultation
iva->SendMessageToApp(ConsMgrID, msgID, 0, 0, &consultationID,VISIONLOGINCOMLib::VISION_APP_ORDER_LAST);
if (consultationID>0) // It means there is a consultation open
{
// taskkill is windows shell command to kill a process
Call command taskkill /IM ConMgr.exe
//run cons mgr command with a given patient ID
Call command O:\Program\conmgr.EXE -SelPat patient_id;
}
else
{
Call command O:\Program\conmgr.EXE -SelPat patient_id;
}