3 /////////////////////////////////////////////////////////////////////////////
5 // Copyright (c) 2002 Iain Murray
7 /////////////////////////////////////////////////////////////////////////////
11 // Visual leak detector
13 // #include "vld/vld.h"
16 #include "Common/WinHelper.h"
17 #include "DasherWindow.h"
21 using namespace Dasher
;
24 // Windows Event handler
25 VOID CALLBACK
WEProc(HWINEVENTHOOK hWinEventHook
, DWORD event
, HWND hwnd
, LONG idObject
, LONG idChild
, DWORD dwEventThread
, DWORD dwmsEventTime
);
29 Entry point to program on Windows systems
31 An interface to the Dasher library is created.
32 A GUI and settings manager are created and given to the Dasher interface.
33 Control is passed to the main GUI loop, and only returns when the main window closes.
35 static CDasherWindow
*g_pDasherWindow
= NULL
;
38 int APIENTRY
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
) {
40 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPWSTR lpCmdLine
, int nCmdShow
) {
47 WinHelper::hInstApp
= hInstance
;
49 //SHInitExtraControls();
51 // We don't want to starve other interactive applications
52 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL
);
57 hHook
= SetWinEventHook(EVENT_OBJECT_FOCUS
, EVENT_OBJECT_FOCUS
, NULL
, WEProc
,
58 0, 0, WINEVENT_OUTOFCONTEXT
| WINEVENT_SKIPOWNPROCESS
);
63 g_pDasherWindow
= new CDasherWindow
;
65 g_pDasherWindow
->Create();
66 g_pDasherWindow
->Show(nCmdShow
);
67 g_pDasherWindow
->UpdateWindow();
69 iRet
= g_pDasherWindow
->MessageLoop();
71 delete g_pDasherWindow
;
72 g_pDasherWindow
= NULL
;
76 UnhookWinEvent(hHook
);
80 // Close the COM library on the current thread
88 VOID CALLBACK
WEProc(HWINEVENTHOOK hWinEventHook
, DWORD event
, HWND hwnd
, LONG idObject
, LONG idChild
, DWORD dwEventThread
, DWORD dwmsEventTime
) {
90 g_pDasherWindow
->HandleWinEvent(hWinEventHook
, event
, hwnd
, idObject
, idChild
, dwEventThread
, dwmsEventTime
);