// ------------------------------------------------------------------------------------------ // WinMain // ------------------------------------------------------------------------------------------ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { MSG msg; if(!InitApp(hInst, nCmdShow)) CDXError( NULL , "could not initialize CDX application" ); while(1) { if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if(!GetMessage(&msg, NULL, 0, 0 )) return msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); } else if(bActive) { // clear screen Screen->GetBack()->Fill(0); // draw menu CurrentMenu->Draw(300, 150); // display back buffer Screen->Flip(); } else WaitMessage(); } }
void ServiceMessageLoop() { Message msg; int result; printf("[Speaker]Service started.\n"); for( ;; ){ //Remember to reset msg every time. memset( &msg, 0, sizeof(msg) ); result = WaitMessage( &msg ); if( result < 0 ){ printf("[Speaker] Failed in WaitMessage: result = %d\n", result ); continue; } msg.Code = 0; //set it to success switch( msg.Command ){ case 1: test(); break; case 2: play( msg.Arguments[0], msg.Arguments[1] ); break; case 3: beep(); break; default: printf("[Speaker]Unknown command: %x\n", msg.Command ); } ReplyMessage( &msg ); } }
void CDirector::Loop() { // TODO: 여기에 코드를 입력합니다. MSG msg; // 기본 메시지 루프입니다. while (1) { if(PeekMessage(&msg,0,0,0,PM_NOREMOVE)) { if(!GetMessage(&msg,0,0,0)) { break; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else if(m_isActive) { Update(); Render(); } else { WaitMessage(); } } }
void App::WaitForWork() { DWORD result; result = MsgWaitForMultipleObjectsEx(0, NULL, INFINITE, QS_ALLINPUT, MWMO_INPUTAVAILABLE); if (WAIT_OBJECT_0 == result) { // A WM_* message is available. // If a parent child relationship exists between windows across threads // then their thread inputs are implicitly attached. // This causes the MsgWaitForMultipleObjectsEx API to return indicating // that messages are ready for processing (Specifically, mouse messages // intended for the child window may appear if the child window has // capture). // The subsequent PeekMessages call may fail to return any messages thus // causing us to enter a tight loop at times. // The WaitMessage call below is a workaround to give the child window // some time to process its input messages. MSG msg = { 0 }; DWORD queue_status = GetQueueStatus(QS_MOUSE); if (HIWORD(queue_status) & QS_MOUSE && !PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE)) { WaitMessage(); } return; } }
static void fb_dowindow(TAPTR task) { struct TExecBase *TExecBase = TGetExecBase(task); WINWINDOW *win = TGetTaskData(task); WINDISPLAY *mod = win->fbv_Display; MSG msg; TUINT sig; TDBPRINTF(TDB_INFO,("DoWindow...\n")); do { WaitMessage(); while (PeekMessage(&msg, win->fbv_HWnd, 0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } // PostMessage(win->fbv_HWnd, WM_USER, 0, 0); sig = TSetSignal(0, TTASK_SIG_ABORT); } while (!(sig & TTASK_SIG_ABORT)); TDBPRINTF(TDB_INFO,("Window Done\n")); TLock(mod->fbd_Lock); TRemove(&win->fbv_Node); TUnlock(mod->fbd_Lock); fb_closeall(mod, win, TTRUE); }
int DoModal(HWND hwnd) { DIALOGSTATE ds = { 0 }; HWND hdlg = CreateDialogParam(g_hinst, MAKEINTRESOURCE(1), hwnd, DlgProc, reinterpret_cast<LPARAM>(&ds)); if (!hdlg) { return -1; } EnableWindow(hwnd, FALSE); MSG msg; msg.message = WM_NULL; // anything that isn't WM_QUIT while (!ds.fEnded) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { break; } else if (!IsDialogMessage(hdlg, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } else if (!ds.fEnded) { WaitMessage(); } } if (msg.message == WM_QUIT) { PostQuitMessage((int)msg.wParam); } EnableWindow(hwnd, TRUE); DestroyWindow(hdlg); return ds.iResult; }
void CXTPShortcutBarPopup::PumpMessage() { CWinThread* pThread = XTPGetThread(); while (IsTrackingMode()) { MSG msg; if (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!::GetMessage(&msg, NULL, 0, 0)) break; if (msg.message != WM_KICKIDLE && !pThread->PreTranslateMessage(&msg)) { // process this message ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } else { WaitMessage(); } } }
// thread handler for the main message thread DWORD unix_process(DWORD lparam) { MSG msg; HANDLE Window_created = (HANDLE)lparam; if ( !unix_create_window() ) return 0; // Let the app continue once the window is created SetEvent(Window_created); while (1) { if (WaitMessage() == TRUE) { EnterCriticalSection(&Os_lock); while(PeekMessage(&msg,0,0,0,PM_REMOVE)) { if ( msg.message == WM_DESTROY ) { LeaveCriticalSection(&Os_lock); // cleanup and exit this thread!! DeleteCriticalSection(&Os_lock); return 0; } TranslateMessage(&msg); DispatchMessage(&msg); } LeaveCriticalSection(&Os_lock); } } return 0; }
int WINAPI WinMain(HINSTANCE hCurInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { SetTimer(NULL, 0, strtoul(lpCmdLine, NULL, 0) * 1000, NULL); WaitMessage(); return 0; }
static int ThreadedReadConsole(const char *prompt, char *buf, int len, int addtohistory) { sighandler_t oldint,oldbreak; /* * SIGINT/SIGBREAK when ESS is waiting for output are a real pain: * they get processed after user hit <return>. * The '^C\n' in raw Rterm is nice. But, do we really need it ? */ oldint = signal(SIGINT, SIG_IGN); oldbreak = signal(SIGBREAK, SIG_IGN); mainThreadId = GetCurrentThreadId(); lineavailable = 0; tprompt = prompt; tbuf = buf; tlen = len; thist = addtohistory; SetEvent(EhiWakeUp); while (1) { if (!peekevent()) WaitMessage(); if (lineavailable) break; doevent(); if(R_Tcl_do) R_Tcl_do(); } lineavailable = 0; /* restore handler */ signal(SIGINT, oldint); signal(SIGBREAK, oldbreak); return tlen; }
// documented in common/SoGuiCommon.cpp.in void SoWin::mainLoop(void) { MSG msg; while (TRUE) { // FIXME: shouldn't this be a while loop, i.e. process all // messages, before doing the idle tasks? 20040721 mortene. if (GetQueueStatus(QS_ALLINPUT) != 0) { // if messagequeue != empty BOOL bRet; if ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0){ // if msg != WM_QUIT if (bRet == -1){ // FIXME: handle the error and possibly exit break; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else break; // msg == WM_QUIT } else if (SoWinP::idleSensorId != 0) { doIdleTasks(); } else { WaitMessage(); } } // Disabled invocation of SoWin::done(), since this calls SoDB::finish(), // which means we would run into issues doing the usual... // SoWin::mainLoop(); // root->unref(); }
void* TcpServer::MethodForThread(void* arg) { arg = arg; while (1) { WaitMessage(1000); } return NULL; }
int CMenuListBox::ChooseValue() { nTracking=1; // do popup menu message loop CWnd *pPrev=SetFocus(); SetCapture(); while( nTracking>0 ) { WaitMessage(); MSG msg; while( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { if(msg.message==WM_KEYDOWN&&msg.wParam==VK_ESCAPE) { nTracking=-1; } if( ! ::GetMessage( &msg, NULL, 0, 0 ) ) break; ::DispatchMessage( &msg ); } } ReleaseCapture(); if(pPrev) pPrev->SetFocus(); if(nTracking<0) return -1; else return GetCurSel(); }
// Windows Entry Point int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int iShow) { MSG iMsg; // Register the Class if not the first instance if (!hPrevInstance && !WinInit(hInstance,iShow)) return FALSE; // Set the Instance pWindow->SetInstance(hInstance); // Poll for Messages for(;;) { if(PeekMessage(&iMsg,NULL,0,0,PM_NOREMOVE)) { if(!GetMessage(&iMsg,NULL,0,0)) return iMsg.wParam; TranslateMessage(&iMsg); DispatchMessage(&iMsg); } else WaitMessage(); } }
UINT WINAPI SRQRevCallbackThread(LPVOID lpPara) { MSG msg; unsigned char RevBuf[MA_DATA_LEN]; UINT DataLen=0; CDeviceOp *pDOP=(CDeviceOp *)lpPara; while (1) { if (!WaitMessage()) { return 1; } memset(RevBuf,0,sizeof(RevBuf)); while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (WM_QUIT==msg.message) { goto Exit; } memcpy_s(RevBuf, sizeof(RevBuf),(unsigned char *)msg.wParam,msg.lParam); pDOP->DevSRQOnRev(RevBuf,msg.lParam); if ((unsigned char *)msg.wParam) { free((unsigned char *)msg.wParam); } } } Exit: return 1; }
int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd ) { wchar_t appName[] = _T( "Capture your window!" ); capInstance = hInstance; width = GetSystemMetrics( SM_CXVIRTUALSCREEN ); height = GetSystemMetrics( SM_CYVIRTUALSCREEN ); WNDCLASSEX wncx; ZeroMemory( &wncx, sizeof( wncx ) ); wncx.cbSize = sizeof( WNDCLASSEX ); wncx.cbClsExtra = 0; wncx.cbWndExtra = 0; wncx.hbrBackground = (HBRUSH) GetStockObject( TRANSPARENT ); wncx.hCursor = LoadCursor( NULL, IDC_ARROW ); wncx.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wncx.hIconSm = NULL; wncx.hInstance = hInstance; wncx.style = CS_VREDRAW | CS_HREDRAW; wncx.lpszClassName = appName; wncx.lpszMenuName = _T( "Menu" ); wncx.lpfnWndProc = (WNDPROC) WndProc; if( !RegisterClassEx( &wncx ) ) { MessageBox( NULL, _T( "Register window class failed!" ), _T( "Failed" ), MB_OK ); return -1; } hwnd = CreateWindow( appName, _T( "Capture your window" ), WS_POPUP | WS_SYSMENU | WS_SIZEBOX, 0, 0, width, height, NULL, NULL, hInstance, NULL ); if( NULL == hwnd ) { MessageBox( NULL, _T( "Create window failed!" ), _T( "Failed" ), MB_OK ); return -1; } ShowWindow( hwnd, nShowCmd ); UpdateWindow( hwnd ); MSG msg; ZeroMemory( &msg, sizeof( msg ) ); while( WM_QUIT != msg.message ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { WaitMessage(); } } return (int) msg.wParam; }
int startService() { //接收消息 Message msg; int id; //初始化驱动程序 if( InitializeBiosTime() < 0 ) SysExitSpace((uint)-1); //注册线程名称,其它程序便可以向此服务线程发送消息 id = SmNotifyService( 0, 0, "Time" ); if( id < 0 ){ printf("[time]add service failed.\n"); SysExitSpace((uint)-1); } printf("[Time]Starting Time service ...\n"); for(;;){ //Pending for messages int result = WaitMessage(&msg); if( result < 0 ){ printf("[Time]Failed to receive message: result = %d\n", result ); continue; } msg.Code = 0; parse( msg ); } SmRemoveService( id ); return 0; }
static LCUI_BOOL WIN_WaitEvent( void ) { MSG msg; if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { return TRUE; } return WaitMessage(); }
/* * @implemented */ BOOL WINAPI DragDetect( HWND hWnd, POINT pt) { return NtUserDragDetect(hWnd, pt); #if 0 MSG msg; RECT rect; POINT tmp; ULONG dx = GetSystemMetrics(SM_CXDRAG); ULONG dy = GetSystemMetrics(SM_CYDRAG); rect.left = pt.x - dx; rect.right = pt.x + dx; rect.top = pt.y - dy; rect.bottom = pt.y + dy; SetCapture(hWnd); for (;;) { while ( PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || PeekMessageW(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) ) { if (msg.message == WM_LBUTTONUP) { ReleaseCapture(); return FALSE; } if (msg.message == WM_MOUSEMOVE) { tmp.x = LOWORD(msg.lParam); tmp.y = HIWORD(msg.lParam); if (!PtInRect(&rect, tmp)) { ReleaseCapture(); return TRUE; } } if (msg.message == WM_KEYDOWN) { if (msg.wParam == VK_ESCAPE) { ReleaseCapture(); return TRUE; } } } WaitMessage(); } return 0; #endif }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { #if defined _DEBUG _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); #endif MSG msg = {0}; WNDCLASSEX wcl = {0}; wcl.cbSize = sizeof(wcl); wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wcl.lpfnWndProc = WindowProc; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = g_hInstance = hInstance; wcl.hIcon = LoadIcon(0, IDI_APPLICATION); wcl.hCursor = LoadCursor(0, IDC_ARROW); wcl.hbrBackground = 0; wcl.lpszMenuName = 0; wcl.lpszClassName = "GL3WindowClass"; wcl.hIconSm = 0; if (!RegisterClassEx(&wcl)) return 0; g_hWnd = CreateAppWindow(wcl, "CastleLib Test App"); if (g_hWnd==NULL) return 0; if (!Init()) // Init OpenGL context and our library return 0; ShowWindow(g_hWnd, nShowCmd); UpdateWindow(g_hWnd); while (true) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } if (msg.message == WM_QUIT) break; if (g_hasFocus) OnIdle(); else WaitMessage(); } return msg.wParam; }
UINT WINAPI EQUIPTask(LPVOID lpPara) { //CTesterDlg *pTester=(CTesterDlg *)lpPara; MSG msg; int i=0; size_t ConvertedChars=0; char TempBuf[1024]=""; wchar_t RevBuf[1024]= _T(""); UINT FixNum=0; int bufL=0; while(TRUE) { if (!WaitMessage()) { continue; } while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { switch (msg.message) { case WM_UPDATE_INFO_EQUIP: FixNum=(UINT)msg.lParam-UI_SERVER_PORT_START+1; if ((char *)msg.wParam) // clear the bufferWM_EQUIPMENT_OPEN { free((char *)msg.wParam); } //remove start by Talen 2011/07/21 //////// if(gStationInfo.EquipInfo.EqipXmlFlag) //////// { //////// gEQIP.CountNumXml(FixNum); //////// } //////// else //////// { //////// gEQIP.CountNum(FixNum); //////// } //////// break; ////////case WM_EQUIPMENT_OPEN: //////// if(!gStationInfo.EquipInfo.EqipXmlFlag) //////// { //////// gEQIP.InitialEQUIP(); //////// } //remove end by Talen 2011/07/21 gEQIP.CountNum(FixNum); break; case WM_EXIT: goto ExitLabel; break; default: ; } } } ExitLabel: return 0; }
EXPORT void CALL AiUpdate (BOOL Wait){ if (gUcode == UNDEFINED_UCODE) return; // UpdateFifoFlag(); if (Wait) WaitMessage (); }
///////////////////////////////////////////////////////////////////////// //For total management all UI information and control logic //It distribute UI control message for all sub dialog. UINT WINAPI MainViewTask(LPVOID lpPara) { CAmbitProTView *pMView=(CAmbitProTView *)lpPara; MSG msg; int i=0; while(TRUE) { if (!WaitMessage()) { continue; } while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { switch (msg.message) { case WM_SWTO_TESTER_DLG: pMView->ShowTesterDlg(); break; case WM_SWTO_MAIN_TEST_PANEL: pMView->ShowMTestDlg(); break; case WM_SWTO_SFIS_DLG: pMView->ShowSfisDlg(); break; case WM_SWTO_MYDAS_DLG: pMView->ShowMydasDlg(); break; case WM_VIRTUAL_SMO: pCVirtualSmoDlg->ShowWindow(SW_SHOW); break; case WM_EXIT: goto ExitLabel; break; case WM_SWTO_CONF_DLG://haibin.li 2011/11/07 pMView->ShowConfDlg(); break; case WM_SWTO_DETAIL_DLG://haibin.li 2011/11/07 pMView->ShowDetailDlg(); break; case WM_SWTO_RTM_DLG://haibin.li 2011/11/11 pMView->ShowRtmDlg(); break; default: ; } } } ExitLabel: return 0; }
static int GetMessageQuickly (BOOL gIdleTimerOn, int gSleeptime, MSG * pmsg) { if (gSleeptime==0 && !PeekMessage (pmsg, NULL, 0, 0, PM_NOREMOVE)) { POINT p; GetCursorPos (&p); pmsg->hwnd = ghMainWindow; pmsg->message = WM_ENTERIDLE; pmsg->wParam = MSGF_USER; pmsg->lParam = (LPARAM) ghMainWindow; pmsg->time = GetTickCount (); pmsg->pt = p; return TRUE; } if (!gIdleTimerOn) { return GetMessage (pmsg, NULL, 0, 0); } else { if (PeekMessage (pmsg, NULL, 0, 0, PM_REMOVE)) return (pmsg->message != WM_QUIT); else { POINT p; /* The following code has been inserted to reduce the crosscall traffic. A timer is set to suspend this thread until atleast the timer interval has elapsed. */ if (SetTimer (ghMainWindow, (UINT) -2, (UINT)gSleeptime, &EndSuspendTimerProc)) { WaitMessage (); } else { rMessageBox (NULL,MB_APPLMODAL,"GetMessageQuickly","SetTimer failed to create timer"); } /* End of insertion. */ GetCursorPos (&p); pmsg->hwnd = ghMainWindow; pmsg->message = WM_ENTERIDLE; pmsg->wParam = MSGF_USER; pmsg->lParam = (LPARAM) ghMainWindow; pmsg->time = GetTickCount (); pmsg->pt = p; return TRUE; } } } /* GetMessageQuickly */
LOCAL void ListBox_DoSpecialSelect(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { // get the listbox data pointer LPLISTBOXDATA lpData = ListBox_GetData(hWindow); if (!lpData) { FORWARD_WM_LBUTTONDOWN(hWindow, fDoubleClick, x, y, keyFlags, ListBox_CallWindowProc); return; } // give us focus on a mouse down SetFocus(hWindow); // initialize the dragging SelectBegin(hWindow, x, y); // start as if we had a mouse move Select_OnMouseMove(hWindow, x, y, keyFlags); // dragging loop while (lpData->fCapture) { MSG msg; // Look for mouse, keyboard, and timer messages. // keystroke messages are retrieved to avoid the message // queue from getting full while ( !PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) && !PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) && !PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE)) WaitMessage(); switch(msg.message) { case WM_MOUSEMOVE: HANDLE_WM_MOUSEMOVE(msg.hwnd, msg.wParam, msg.lParam, Select_OnMouseMove); break; case WM_TIMER: HANDLE_WM_TIMER(msg.hwnd, msg.wParam, msg.lParam, Select_OnTimer); break; case WM_LBUTTONUP: HANDLE_WM_LBUTTONUP(msg.hwnd, msg.wParam, msg.lParam, Select_OnLButtonUp); break; default: // Process messages we don't handle TranslateMessage(&msg); DispatchMessage(&msg); break; } } // process the drag and cleanup SelectEnd(hWindow); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); MSG msg; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_CCHELPER, szWindowClass, MAX_LOADSTRING); HANDLE hMutex; hMutex = CreateMutex(NULL, TRUE, szWindowClass); if(GetLastError() == ERROR_ALREADY_EXISTS){ AlreadyRun(); return 0; } OleInitialize(NULL); if( !doInit(hInstance, nCmdShow) ) return -1; for (;;) { if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) { if(!GetMessage(&msg,NULL,0,0)) { return msg.wParam; } TranslateMessage(&msg); DispatchMessage(&msg); }else { //if( !AppLoop() ) // DestroyWindow(g_hWndMain); //else WaitMessage(); } } OleUninitialize(); return (int) msg.wParam; }
int VDUIBaseWindowW32::DoModal() { if (VDINLINEASSERTFALSE(mpModal)) return -1; ModalData data; mpModal = &data; HWND hwndParent = GetParentW32(); // Cannot use GetParent() as it isn't correct until after messages have been dispatched and the window hops to its real parent. data.mbOwnerWasEnabled = false; data.mhwndOwner = hwndParent; if (data.mhwndOwner) { data.mbOwnerWasEnabled = !(GetWindowLong(data.mhwndOwner, GWL_STYLE) & WS_DISABLED); if (data.mbOwnerWasEnabled) EnableWindow(data.mhwndOwner, FALSE); } MSG msg; while(mpModal) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { PostQuitMessage(msg.wParam); break; } if (IsDialogMessage(mhwnd, &msg)) continue; TranslateMessage(&msg); DispatchMessage(&msg); continue; } if (!mpModal) break; if (mbTick) { if (mpCB && mpCB->HandleUIEvent(this, NULL, 0, IVDUICallback::kEventTick, 0)) continue; } WaitMessage(); } mpModal = NULL; Shutdown(); return data.mReturnValue; }
void EventLoop() { register MSG msg; while( 1 ) { if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { if( !GetMessage( &msg, NULL, 0, 0 ) ) return;// msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); } else if (G_pGame->m_bIsProgramActive) G_pGame->UpdateScreen(); else if (G_pGame->m_cGameMode == GAMEMODE_ONLOADING) G_pGame->UpdateScreen_OnLoading( FALSE ); else WaitMessage(); } }
LOCAL void ListBox_DoDrag(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { // Let the listbox control handle the mouse down so a selection can happen FORWARD_WM_LBUTTONDOWN(hWindow, fDoubleClick, x, y, keyFlags, ListBox_CallWindowProc); // see if it's cool for us to try to drag LPLISTBOXDATA lpData = DragOK(hWindow); if (!lpData) return; // make the listbox think it got a mouse up so we can take over FORWARD_WM_LBUTTONUP(hWindow, x, y, keyFlags, ListBox_CallWindowProc); // initialize the dragging DragBegin(hWindow, x, y); // dragging loop while (lpData->fCapture) { MSG msg; // Look for mouse, keyboard, and timer messages. // keystroke messages are retrieved to avoid the message // queue from getting full while ( !PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) && !PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) && !PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE)) WaitMessage(); switch(msg.message) { case WM_MOUSEMOVE: HANDLE_WM_MOUSEMOVE(msg.hwnd, msg.wParam, msg.lParam, Drag_OnMouseMove); break; case WM_TIMER: HANDLE_WM_TIMER(msg.hwnd, msg.wParam, msg.lParam, Drag_OnTimer); break; case WM_LBUTTONUP: HANDLE_WM_LBUTTONUP(msg.hwnd, msg.wParam, msg.lParam, Drag_OnLButtonUp); break; default: // Process messages we don't handle TranslateMessage(&msg); DispatchMessage(&msg); break; } } // process the drag and cleanup DragEnd(hWindow); }
int m1::game_platform::run() { m1::signal<void()>::connection const exit_connection = event_destroy.connect([&] { exit(0); }); ShowWindow(m_ImplPtr->window_handle, SW_SHOW); while(do_events()) { on_idle(); WaitMessage(); } return m_ImplPtr->exit_code; }