35static char className[] =
"G4Win32";
37G4Win32* G4Win32::instance = NULL;
39static G4bool Win32Inited =
false;
40static HWND topWindow = NULL;
46 if (instance == NULL) {
56 if (Win32Inited ==
false) {
59 wc.style = CS_HREDRAW | CS_VREDRAW;
60 wc.lpfnWndProc = (WNDPROC)DefWindowProc;
63 wc.hInstance = ::GetModuleHandle(NULL);
64 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
65 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
66 wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
67 wc.lpszMenuName = (PTSTR)className;
68 wc.lpszClassName = (PTSTR)className;
71 char winName[] =
"Test";
73 ::CreateWindowEx(WS_EX_CLIENTEDGE, (PTSTR)className, (PTSTR)winName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
74 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, ::GetModuleHandle(NULL), NULL);
76 if (topWindow == NULL) {
77 G4cout <<
"G4Win32: Unable to create Win32 window." <<
G4endl;
91 if (
this == instance) {
108 BOOL status = ::GetMessage(&event, NULL, 0, 0);
109 if (status ==
FALSE)
return NULL;
118 while (::PeekMessage(&event, NULL, 0, 0, PM_REMOVE)) {
119 ::TranslateMessage(&event);
120 ::DispatchMessage(&event);
128 ::TranslateMessage((MSG*)a_event);
129 ::DispatchMessage((MSG*)a_event);
G4bool(*)(void *) G4DispatchFunction
G4GLOB_DLL std::ostream G4cout
void AddDispatcher(G4DispatchFunction)
void SetMainInteractor(G4Interactor)
static G4bool DispatchWin32Event(void *)
static G4Win32 * getInstance()
void FlushAndWaitExecution()