Hi,

I am trying to write a C code on windows to send cntrol C signal to a running, so that the running application closes gracefully.

Here is the code I have tried to write:
Code:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include <windows.h>

void main()
{
 int i=0;
 HWND h = NULL;
 h = FindWindow(NULL,"RUNNING EXE");
 printf("[%d]\n",h);
 i = SendMessage(h,WM_CHAR,0x03,0);
 printf("[%d]\n",i);
}
But the running application is not closing gracefully, it is simply receiving ^C. This is not solving my purpose.

Waiting for a quick response.

Regards.

Last edited by shabbir; 7Jan2009 at 12:08.. Reason: Code block