H
hellrazor
Hi there,
First of all, I'm very much a C++ amateur (i.e., a newb). I'm having to
program a win32 system service for my employer, and I'm almost done with
the task, but I need help with something that appears to be very basic.
I have a function within the cpp file called StopService:
void StopService()
{
SendMessage(hWnd,WM_QUIT,0,0);
runningService = FALSE;
//set the event that is holding ServiceMain
SetEvent(terminateEvent);
}
Within the above function, I send a "WM_QUIT" message to another
application. I would like to monitor when this application has been
terminated. What would be the best way to do this? I was thinking of
trying to call another win-api function on the window and inspecting the
result. Here's where my knowledge of the language fails me.
I had the following code just to test:
void StopService()
{
int retValue;
char strRetValue[100];
SendMessage(hWnd,WM_QUIT,0,0);
retValue = GetWindowLong(hWnd, GWL_ID);
sprintf(strRetValue,"%d",retValue);
MessageBox( NULL, strRetValue, "title", MB_OK );
runningService = FALSE;
//set the event that is holding ServiceMain
SetEvent(terminateEvent);
}
So I'm trying to display the results of the win-api function within the
message box, but I don't think it's working. Everytime the message box is
executed, the messagebox just displays the number zero, "0" (no quotes).
No matter if the hWnd of the window exists or not.
Any pointers?
Thanks,
Jorge
First of all, I'm very much a C++ amateur (i.e., a newb). I'm having to
program a win32 system service for my employer, and I'm almost done with
the task, but I need help with something that appears to be very basic.
I have a function within the cpp file called StopService:
void StopService()
{
SendMessage(hWnd,WM_QUIT,0,0);
runningService = FALSE;
//set the event that is holding ServiceMain
SetEvent(terminateEvent);
}
Within the above function, I send a "WM_QUIT" message to another
application. I would like to monitor when this application has been
terminated. What would be the best way to do this? I was thinking of
trying to call another win-api function on the window and inspecting the
result. Here's where my knowledge of the language fails me.
I had the following code just to test:
void StopService()
{
int retValue;
char strRetValue[100];
SendMessage(hWnd,WM_QUIT,0,0);
retValue = GetWindowLong(hWnd, GWL_ID);
sprintf(strRetValue,"%d",retValue);
MessageBox( NULL, strRetValue, "title", MB_OK );
runningService = FALSE;
//set the event that is holding ServiceMain
SetEvent(terminateEvent);
}
So I'm trying to display the results of the win-api function within the
message box, but I don't think it's working. Everytime the message box is
executed, the messagebox just displays the number zero, "0" (no quotes).
No matter if the hWnd of the window exists or not.
Any pointers?
Thanks,
Jorge