如何能够通过对话框的命令按钮开启一个进程(命令行程序),同时对话框上的另一个按钮可以终止该进程。如果进程运行直至结束,对话框可以及时知道。
使用WaitForSingleObject好像无法实现,开启了进程以后无法返回,即无法使对话框及其上的按钮有效。
使用WaitForSingleObject好像无法实现,开启了进程以后无法返回,即无法使对话框及其上的按钮有效。
解决方案 »
- 创建无模式的CDHtmlDialog对话框,在销毁时不能释放内存,跪求高手的帮助
- 请问一个TextOut问题和PostMessage问题
- 怎样指定listctrl中某一个item为选中状态
- 98/2000winsock限制程序区别,什么头文件或动态链接?
- [100分] 实用问题---怎么绘制自己的图形对象?能说一下步骤吗?(derived from CWnd)[100分]
- GetFieldValue(参1,参2)中,参1应该写什么
- 怎么才能在一个程序中执行另一个.exe文件??
- 哪位能赶快告诉我:if语句里的return(0)是什么意思呢?我突然忘了。
- 有有兴趣一起写可靠UDP的不?
- vs2013编译项目时发生error C2373: “vsscanf” 重定义;不同的类型修饰符
- 关于memcpy问题
- 如何读取出后缀名为.exe的可执行文件中的数据
int MessageLoop (
HANDLE* lphObjects, // handles that need to be waited on
int cObjects // number of handles to wait on
)
{
// The message loop lasts until we get a WM_QUIT message,
// upon which we shall return from the function.
while (TRUE)
{
// block-local variable
DWORD result ;
MSG msg ; // Read all of the messages in this next loop,
// removing each message as we read it.
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// If it is a quit message, exit.
if (msg.message == WM_QUIT)
return 1;
// Otherwise, dispatch the message.
DispatchMessage(&msg);
} // End of PeekMessage while loop. // Wait for any message sent or posted to this queue
// or for one of the passed handles be set to signaled.
result = MsgWaitForMultipleObjects(cObjects, lphObjects,
FALSE, INFINITE, QS_ALLINPUT); // The result tells us the type of event we have.
if (result == (WAIT_OBJECT_0 + cObjects))
{
// New messages have arrived.
// Continue to the top of the always while loop to
// dispatch them and resume waiting.
continue;
}
else
{
// One of the handles became signaled.
DoStuff (result - WAIT_OBJECT_0) ;
} // End of else clause.
} // End of the always while loop.
} // End of function.