Click here to Skip to main content
15,917,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncan anybody tell me how to capture the enter key event from the keyboard Pin
philiptabraham30-Oct-07 21:29
philiptabraham30-Oct-07 21:29 
AnswerRe: can anybody tell me how to capture the enter key event from the keyboard Pin
Hamid_RT30-Oct-07 21:39
Hamid_RT30-Oct-07 21:39 
AnswerRe: can anybody tell me how to capture the enter key event from the keyboard Pin
Rajesh R Subramanian30-Oct-07 22:04
professionalRajesh R Subramanian30-Oct-07 22:04 
AnswerRe: can anybody tell me how to capture the enter key event from the keyboard Pin
Nelek30-Oct-07 22:29
protectorNelek30-Oct-07 22:29 
GeneralRe: can anybody tell me how to capture the enter key event from the keyboard Pin
Hamid_RT30-Oct-07 22:51
Hamid_RT30-Oct-07 22:51 
GeneralRe: can anybody tell me how to capture the enter key event from the keyboard Pin
philiptabraham30-Oct-07 23:19
philiptabraham30-Oct-07 23:19 
GeneralRe: can anybody tell me how to capture the enter key event from the keyboard Pin
Nelek7-Nov-07 3:32
protectorNelek7-Nov-07 3:32 
QuestionHow to close the Opened process. Pin
GauranG Shah30-Oct-07 21:12
GauranG Shah30-Oct-07 21:12 
I am using following code to create the new process. Now I want to Close the process that I have created. I am using CloseHandle() to close the Process with process handle as argument. But its not working.

The following code Opens the MSPAINT success fully when I press the 'c' But it doesn't get closed when I press the 't'.
PROCESS_INFORMATION OpenProc( TCHAR *CmdLine)
{
	TCHAR str[100]	={};
	_tcscpy_s( str, 100, CmdLine );

	STARTUPINFO si;
	PROCESS_INFORMATION pi;

	BOOL ProcCreated;
	ZeroMemory(&si,sizeof(si));
	si.cb			= sizeof(si);
	si.dwFlags		= STARTF_USESHOWWINDOW;
	si.wShowWindow	= SW_SHOWMAXIMIZED;
	ZeroMemory(&pi,sizeof(pi));

	//si.lpDesktop	= _T("NewDesktop");
	si.lpDesktop	=	NULL;
	ProcCreated =CreateProcess( NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi );          

	return pi;

}

int _tmain(int argc, _TCHAR* argv[])
{	
	char ch;
        PROCESS_INFORMATION pi;
	DWORD dError;.
      do 
	{	
		scanf("%c",&ch);
		if(ch == 'c')
			pi=OpenProc(L"MSPAINT");
		if(ch == 't')
		{
		CloseHandle(pi.hProcess);
                dError = GetLastError();   //Error = 0
		CloseHandle(pi.hThread);
		dError = GetLastError();  //dError =0
		}

	} while(ch != 'E');
 }





QuestionRe: How to close the Opened process. Pin
Hamid_RT30-Oct-07 22:08
Hamid_RT30-Oct-07 22:08 
AnswerRe: How to close the Opened process. Pin
GauranG Shah30-Oct-07 23:05
GauranG Shah30-Oct-07 23:05 
QuestionRe: How to close the Opened process. Pin
Hamid_RT31-Oct-07 4:32
Hamid_RT31-Oct-07 4:32 
AnswerRe: How to close the Opened process. Pin
Nishad S30-Oct-07 22:53
Nishad S30-Oct-07 22:53 
AnswerRe: How to close the Opened process. Pin
David Crow31-Oct-07 3:14
David Crow31-Oct-07 3:14 
AnswerRe: How to close the Opened process. Pin
JudyL_MD31-Oct-07 3:52
JudyL_MD31-Oct-07 3:52 
QuestionProblem in CRecordSet Pin
M_Menon30-Oct-07 21:08
M_Menon30-Oct-07 21:08 
AnswerRe: Problem in CRecordSet Pin
panthal30-Oct-07 21:30
panthal30-Oct-07 21:30 
GeneralRe: Problem in CRecordSet Pin
M_Menon30-Oct-07 22:57
M_Menon30-Oct-07 22:57 
GeneralRe: Problem in CRecordSet Pin
David Crow31-Oct-07 3:40
David Crow31-Oct-07 3:40 
GeneralRe: Problem in CRecordSet Pin
M_Menon31-Oct-07 5:45
M_Menon31-Oct-07 5:45 
QuestionRe: Problem in CRecordSet Pin
David Crow31-Oct-07 5:52
David Crow31-Oct-07 5:52 
AnswerRe: Problem in CRecordSet Pin
M_Menon31-Oct-07 7:09
M_Menon31-Oct-07 7:09 
QuestionRe: Problem in CRecordSet Pin
David Crow31-Oct-07 7:23
David Crow31-Oct-07 7:23 
AnswerRe: Problem in CRecordSet Pin
M_Menon31-Oct-07 7:28
M_Menon31-Oct-07 7:28 
Questionmessage box Pin
KASR130-Oct-07 21:01
KASR130-Oct-07 21:01 
AnswerRe: message box Pin
Hamid_RT30-Oct-07 21:11
Hamid_RT30-Oct-07 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.