about uscontact

ShellExecuteEx 함수 종료시점 잡기

Category:
Author: zemna
Date: April 17, 2021
Share this:

ShellExecuteEx 함수를 사용할 때, 프로그램 실행이 종료 될때 까지 대기해야 할 경우 사용하면 된다. GetExitCodeProcess() 함수의 2번째 인자로 사용되는 ExitCode 변수의 값이 STILL_ACTIVE가 아니라면 종료 되었다는 의미이므로 그 시점을 while 구분을 이용해서 잡는 것이다.. ^^

[code lang="cpp"] SHELLEXECUTEINFO shExIf;

DWORD dwExitCode;

CString FileName = "jpk.exe";

shExIf.lpDirectory = "C:my_folder"; shExIf.lpParameters = ""; shExIf.cbSize = sizeof( SHELLEXECUTEINFO ); shExIf.lpVerb = "open"; shExIf.lpFile = FileName; shExIf.nShow = SW_HIDE; shExIf.fMask = SEE_MASK_NOCLOSEPROCESS;

ShellExecuteEx( &shExIf );

dwExitCode = 0;

while(1) { ::GetExitCodeProcess( shExIf.hProcess, &dwExitCode );

if( dwExitCode != STILL_ACTIVE ) { MessageBox(" jpk.exe 종료"); break; } } [/code]

Share this:

Leave a Reply

Your email address will not be published.

ZEMNA.NET

Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
magnifiercrossmenu