bool Make CString strConnectionString eventHandle CreateEvent HANDLE e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
bool Make(CString strConnectionString)
{
//eventHandle = CreateEvent(
HANDLE eventHandle = ::CreateEvent(NULL, TRUE, FALSE, NULL);
ResetEvent(eventHandle);
HANDLE threadHandle;
DWORD threadID;
//threadHandle = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE) &ThreadProcShowDlg,this,CREATE_SUSPENDED,&threadID);
threadHandle = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE) &ThreadProcShowDlg,&eventHandle,CREATE_SUSPENDED,&threadID);
ResumeThread(threadHandle);
CConfigManager *cfgMngr;
cfgMngr = new CConfigManager(strConnectionString);
cfgMngr->InitConfigs();
cfgMngr->CheckConfigs();
//cfgMngr->CheckConfigs();
SetEvent(eventHandle);
WaitForSingleObject(threadHandle,INFINITE);
delete cfgMngr;
// wndWait->DestroyWindow();
// delete wndWait;
return true;
}
DWORD WINAPI ThreadProcShowDlg(PVOID pParam)
{
DWORD dwResult = 0;
HANDLE *eventH;
eventH = static_cast<HANDLE *>(pParam);
CWaitDlg *wndWait = new CWaitDlg();
wndWait->Create(NULL);
wndWait->ShowWindow(SW_SHOW);
WaitForSingleObject(*eventH,INFINITE);
return dwResult;
}