VC 创建公共事件通知

进程间进行事件通知:

程序1:

HANDLE hEvent = NULL;

hEvent = CreateEvent(NULL, TRUE, FALSE, _T("Share_Event"));

while(1){

WaitForSingleObject(hEvent, INFINITE);
ResetEvent(hEvent);

  //执行逻辑

}

程序2:

hEvent = OpenEvent(EVENT_ALL_ACCESS,FALSE,_T("Share_Event"));

SetEvent(hEvent);//触发事件

posted @ 2012-03-31 14:27  elvis.wang  阅读(288)  评论(0编辑  收藏  举报