|
Hi everyone
I have three questions
1.why do I need to use of TEXT macro in my codes and if I remove it compiler shows error
2.why CreateProcess cant open test.txt while second parameter is command line and I have to write full path ("c:\\notepad.exe c:\\1.txt")
3.Do I need to use of WaitForSingleObject
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof (STARTUPINFO);
GetStartupInfo (&si);
si.dwFlags = STARTF_USESHOWWINDOW |STARTF_TITLEISAPPID ;
si.wShowWindow = SW_SHOWMAXIMIZED;
si.lpTitle=TEXT("Test");
if(CreateProcess(TEXT("c:\\notepad.exe"),TEXT("c:\\test.txt"),NULL,
NULL,FALSE,NULL,NULL,NULL,&si,&pi))
{
//WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
Thanks
|
|
|
|
|
messages wrote: 1.why do I need to use of TEXT macro in my codes and if I remove it compiler shows error See here.
messages wrote: 2.why CreateProcess cant open test.txt while second parameter is command line and I have to write full path ("c:\\notepad.exe c:\\1.txt") Do you understand the difference between absolute vs. relative paths?
messages wrote: 3.Do I need to use of WaitForSingleObject Only if you need to wait.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Do you know your answers are great?
Thanks
|
|
|
|