30 #if defined(G4INTY_BUILD_WIN32) || defined(G4INTY_USE_WIN32)
37 static char className[] =
"G4Win32";
42 static HWND topWindow = NULL;
44 G4Win32* G4Win32::getInstance (
60 if(Win32Inited==
FALSE) {
63 wc.style = CS_HREDRAW | CS_VREDRAW;
64 wc.lpfnWndProc = (WNDPROC)DefWindowProc;
67 wc.hInstance = ::GetModuleHandle(NULL);
68 wc.hIcon = LoadIcon (NULL,IDI_APPLICATION);
69 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
70 wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
71 wc.lpszMenuName = className;
72 wc.lpszClassName = className;
73 ::RegisterClass (&wc);
75 topWindow = ::CreateWindow(className,className,
77 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
79 ::GetModuleHandle(NULL),
83 G4cout <<
"G4Win32 : Unable to create Win32 window." <<
G4endl;
90 SetMainInteractor(topWindow);
111 void* G4Win32::GetEvent (
117 BOOL status = ::GetMessage(&event, NULL, 0, 0);
118 if(status==
FALSE)
return NULL;
122 void G4Win32::FlushAndWaitExecution (
128 while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
129 ::TranslateMessage(&event);
130 ::DispatchMessage (&event);
134 G4bool G4Win32::DispatchWin32Event (
140 ::TranslateMessage((MSG*)a_event);
141 ::DispatchMessage ((MSG*)a_event);