• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PeekMessageW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PeekMessageW函数的典型用法代码示例。如果您正苦于以下问题:C++ PeekMessageW函数的具体用法?C++ PeekMessageW怎么用?C++ PeekMessageW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PeekMessageW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DragDetect

/*
 * @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
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:60,代码来源:input.c


示例2: waitonbutton

static void waitonbutton()
{
	int key = GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON;
	if (GetAsyncKeyState(key) & 0x8000)
	{ // double clicked
		MSG msg;
		while (GetAsyncKeyState(key) & 0x8000)
			PeekMessageW(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
		// pull extra mouseUp out of queue
		while (PeekMessageW(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
			;
	}
	// SMR 1880 clear shift/control state
	MCmodifierstate = MCscreen->querymods();
}
开发者ID:alilloyd,项目名称:livecode,代码行数:15,代码来源:w32ans.cpp


示例3: AppMain

void AppMain()
{
    AppInit(1280, 720, "silver-winner");

    for (;;)
    {
        MSG msg;
        while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }

        if (g_App.bShouldClose)
        {
            break;
        }

        ImGui_ImplDX11_NewFrame();

        RendererPaint();
    }

    AppExit();
}
开发者ID:nlguillemot,项目名称:silver-winner,代码行数:25,代码来源:app.cpp


示例4: vo_w32_check_events

/**
 * \brief Dispatch incoming window events and handle them.
 *
 * This function should be placed inside libvo's function "check_events".
 *
 * \return int with these flags possibly set, take care to handle in the right order
 *         if it matters in your driver:
 *
 * VO_EVENT_RESIZE = The window was resized. If necessary reinit your
 *                   driver render context accordingly.
 * VO_EVENT_EXPOSE = The window was exposed. Call e.g. flip_frame() to redraw
 *                   the window if the movie is paused.
 */
int vo_w32_check_events(struct vo *vo)
{
    struct vo_w32_state *w32 = vo->w32;
    MSG msg;
    w32->event_flags = 0;
    while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) {
        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }
    if (vo->opts->WinID >= 0) {
        BOOL res;
        RECT r;
        POINT p;
        res = GetClientRect(w32->window, &r);
        if (res && (r.right != vo->dwidth || r.bottom != vo->dheight)) {
            vo->dwidth = r.right; vo->dheight = r.bottom;
            w32->event_flags |= VO_EVENT_RESIZE;
        }
        p.x = 0; p.y = 0;
        ClientToScreen(w32->window, &p);
        if (p.x != w32->window_x || p.y != w32->window_y) {
            w32->window_x = p.x; w32->window_y = p.y;
        }
        res = GetClientRect(WIN_ID_TO_HWND(vo->opts->WinID), &r);
        if (res && (r.right != vo->dwidth || r.bottom != vo->dheight))
            MoveWindow(w32->window, 0, 0, r.right, r.bottom, FALSE);
        if (!IsWindow(WIN_ID_TO_HWND(vo->opts->WinID)))
            // Window has probably been closed, e.g. due to program crash
            mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN);
    }

    return w32->event_flags;
}
开发者ID:maletor,项目名称:mpv,代码行数:46,代码来源:w32_common.c


示例5: check_msg_pending

static gboolean
check_msg_pending ()
{
  MSG msg;

  return PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE;
}
开发者ID:archlinuxarm-n900,项目名称:clutter08,代码行数:7,代码来源:clutter-event-win32.c


示例6: MZ_Launch

static void MZ_Launch( LPCSTR cmdtail, int length )
{
  TDB *pTask = GlobalLock16( GetCurrentTask() );
  BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
  DWORD rv;
  SYSLEVEL *lock;
  MSG msg;

  MZ_FillPSP(psp_start, cmdtail, length);
  pTask->flags |= TDBF_WINOLDAP;

  /* DTA is set to PSP:0080h when a program is started. */
  pTask->dta = MAKESEGPTR( DOSVM_psp, 0x80 );

  GetpWin16Lock( &lock );
  _LeaveSysLevel( lock );

  /* force the message queue to be created */
  PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);

  ResumeThread(dosvm_thread);
  rv = DOSVM_Loop(dosvm_thread);

  CloseHandle(dosvm_thread);
  dosvm_thread = 0; dosvm_tid = 0;
  CloseHandle(loop_thread);
  loop_thread = 0; loop_tid = 0;

  VGA_Clean();
  ExitProcess(rv);
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:31,代码来源:module.c


示例7: clutter_event_dispatch

static gboolean
clutter_event_dispatch (GSource     *source,
                        GSourceFunc  callback,
                        gpointer     user_data)
{
  ClutterEvent *event;
  MSG msg;

  clutter_threads_enter ();

  /* Process Windows messages until we've got one that translates into
     the clutter event queue */
  while (!clutter_events_pending () && PeekMessageW (&msg, NULL,
						     0, 0, PM_REMOVE))
      DispatchMessageW (&msg);

  /* Pop an event off the queue if any */
  if ((event = clutter_event_get ()))
    {
      /* forward the event into clutter for emission etc. */
      clutter_do_event (event);
      clutter_event_free (event);
    }

  clutter_threads_leave ();

  return TRUE;
}
开发者ID:archlinuxarm-n900,项目名称:clutter08,代码行数:28,代码来源:clutter-event-win32.c


示例8: pump_message_loop

static void pump_message_loop(void)
{
    // We have a hidden window on this thread (for the OpenGL context,) so pump
    // its message loop at regular intervals to be safe
    MSG message;
    while (PeekMessageW(&message, NULL, 0, 0, PM_REMOVE))
        DispatchMessageW(&message);
}
开发者ID:Archer-sys,项目名称:mpv,代码行数:8,代码来源:context_dxinterop.c


示例9: while

//Handle all messages in the queue
VOID WindowMessageDispatcher12::RunMessagePump() {
	MSG Message;

	while (PeekMessageW(&Message, m_Handle, 0, 0, PM_REMOVE) > 0) {
		TranslateMessage(&Message);
		DispatchMessageW(&Message);
	}
}
开发者ID:AustinBorger,项目名称:DXWindow,代码行数:9,代码来源:WindowMessageDispatcher12.cpp


示例10: _glfwPlatformPollEvents

void _glfwPlatformPollEvents(void)
{
    MSG msg;
    _GLFWwindow* window;

    while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
    {
        if (msg.message == WM_QUIT)
        {
            // Treat WM_QUIT as a close on all windows
            // While GLFW does not itself post WM_QUIT, other processes may post
            // it to this one, for example Task Manager

            window = _glfw.windowListHead;
            while (window)
            {
                _glfwInputWindowCloseRequest(window);
                window = window->next;
            }
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }

    window = _glfw.focusedWindow;
    if (window)
    {
        // LSHIFT/RSHIFT fixup (keys tend to "stick" without this fix)
        // This is the only async event handling in GLFW, but it solves some
        // nasty problems
        {
            const int mods = getAsyncKeyMods();

            // Get current state of left and right shift keys
            const int lshiftDown = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
            const int rshiftDown = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;

            // See if this differs from our belief of what has happened
            // (we only have to check for lost key up events)
            if (!lshiftDown && window->keys[GLFW_KEY_LEFT_SHIFT] == 1)
                _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, 0, GLFW_RELEASE, mods);

            if (!rshiftDown && window->keys[GLFW_KEY_RIGHT_SHIFT] == 1)
                _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods);
        }

        // Did the cursor move in an focused window that has disabled the cursor
        if (window->cursorMode == GLFW_CURSOR_DISABLED)
        {
            int width, height;
            _glfwPlatformGetWindowSize(window, &width, &height);
            _glfwPlatformSetCursorPos(window, width / 2, height / 2);
        }
    }
}
开发者ID:RubenMagallanes,项目名称:comp308sheepSim,代码行数:58,代码来源:win32_window.c


示例11: while

	void OpenGLWindow::Impl::processEvents()
	{
		MSG message;

		while (PeekMessageW(&message, nullptr, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&message);
			DispatchMessageW(&message);
		}
	}
开发者ID:JordiSubirana,项目名称:ATEMA,代码行数:10,代码来源:WindowImplWin32.cpp


示例12: while

// Static
void SystemGUI::processEvents()
{
    MSG message;
    // hwnd=NULL means all windows in the current thread
    while (PeekMessageW(&message, NULL, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&message);
        DispatchMessageW(&message);
    }
}
开发者ID:Zylann,项目名称:SnowfeetEngine,代码行数:11,代码来源:SystemGUI_win32.cpp


示例13: while

void	CEditToolApp::OnSysMsg(void)
{
	MSG msg;

	while( PeekMessageW( &msg, NULL, 0, 0, PM_NOREMOVE ) )
	{
		if( !GetMessageW( &msg, NULL, 0, 0 ) )
			GenErr( "GetMessage shouldn't return 0." );
		TranslateMessage( &msg );
		DispatchMessageW( &msg );
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:12,代码来源:CEditToolApp.cpp


示例14: WinMain

int32_t WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int32_t nCmdShow)
{
   Timer globalTimer;

   auto& window = Win_Window::GetInstance();
   window.Createwindow();
   window.SetUpOpenGL();

   auto& game = Game::GetInstance();
   game.Init("../Assets/GameInit.txt");

   auto oldTime = globalTimer.GetGlobalTime();

   MSG msg;
   int32_t frames = 0;
   float frameTimer = 0.0f;
   int32_t framesLastSecond = 0;

   while (window.IsRunning())
   {
      if (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
      {
         TranslateMessage(&msg);
         DispatchMessageW(&msg);
      }
      globalTimer.ToggleTimer();
      auto timeStamp = globalTimer.GetGlobalTime();

      if ((timeStamp - oldTime) > TARGET_TIME)
      {
         float dt = (timeStamp - oldTime) * Timer::AreTimersRunning();
         game.ProcessInput(dt);

         oldTime = timeStamp;
         game.Render();
         if (frameTimer > 1.0f)
         {
            framesLastSecond = frames;
            frameTimer = 0.0f;
            frames = 0;
         }
         game.RenderText(std::to_string(framesLastSecond) + " FPS", glm::vec2(-WIDTH / 2.0f, -HEIGHT / 2.0f), 0.4f,
                         glm::vec3(1.0f, 0.0f, 1.0f));

         window.Swapwindow();
         ++frames;
      }
      frameTimer += globalTimer.GetDeltaTime();
   }

   return EXIT_SUCCESS;
}
开发者ID:JacobDomagala,项目名称:DGame,代码行数:53,代码来源:Main.cpp


示例15: runMessagePump

static void runMessagePump(DWORD timeoutMilliseconds)
{
    DWORD startTickCount = GetTickCount();
    MSG msg;
    BOOL result;
    while ((result = PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) && GetTickCount() - startTickCount <= timeoutMilliseconds) {
        if (result == -1)
            break;
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:12,代码来源:WebViewDestruction.cpp


示例16: GlProcessEvent

bool GlProcessEvent(bool *quit)
{
	MSG msg;
	if(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
		if(msg.message == WM_QUIT && quit)
			*quit = true;
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
		return true;
	}
	return false;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:12,代码来源:Win.cpp


示例17: start_binding

static HRESULT start_binding(IMoniker *mon, Binding *binding_ctx, IUri *uri, IBindCtx *pbc,
                             BOOL to_obj, REFIID riid, Binding **ret)
{
    Binding *binding = NULL;
    HRESULT hres;
    MSG msg;

    hres = Binding_Create(mon, binding_ctx, uri, pbc, to_obj, riid, &binding);
    if(FAILED(hres))
        return hres;

    hres = IBindStatusCallback_OnStartBinding(binding->callback, 0, &binding->IBinding_iface);
    if(FAILED(hres)) {
        WARN("OnStartBinding failed: %08x\n", hres);
        stop_binding(binding, INET_E_DOWNLOAD_FAILURE, NULL);
        IBinding_Release(&binding->IBinding_iface);
        return hres;
    }

    if(binding_ctx) {
        set_binding_sink(binding->protocol, &binding->IInternetProtocolSink_iface,
                &binding->IInternetBindInfo_iface);
        if(binding_ctx->redirect_url)
            IBindStatusCallback_OnProgress(binding->callback, 0, 0, BINDSTATUS_REDIRECTING, binding_ctx->redirect_url);
        report_data(binding, BSCF_FIRSTDATANOTIFICATION | (binding_ctx->download_state == END_DOWNLOAD ? BSCF_LASTDATANOTIFICATION : 0),
                0, 0);
    }else {
        hres = IInternetProtocolEx_StartEx(&binding->protocol->IInternetProtocolEx_iface, uri,
                &binding->IInternetProtocolSink_iface, &binding->IInternetBindInfo_iface,
                PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0);

        TRACE("start ret %08x\n", hres);

        if(FAILED(hres) && hres != E_PENDING) {
            stop_binding(binding, hres, NULL);
            IBinding_Release(&binding->IBinding_iface);

            return hres;
        }
    }

    while(!(binding->bindf & BINDF_ASYNCHRONOUS) &&
          !(binding->state & BINDING_STOPPED)) {
        MsgWaitForMultipleObjects(0, NULL, FALSE, 5000, QS_POSTMESSAGE);
        while (PeekMessageW(&msg, binding->notif_hwnd, WM_USER, WM_USER+117, PM_REMOVE|PM_NOYIELD)) {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }

    *ret = binding;
    return S_OK;
}
开发者ID:dvdhoo,项目名称:wine,代码行数:53,代码来源:binding.c


示例18: ZeroMemory

/// <summary>
/// Creates the main window and begins processing
/// </summary>
/// <param name="hInstance">handle to the application instance</param>
/// <param name="nCmdShow">whether to display minimized, maximized, or normally</param>
int CFaceBasics::Run(HINSTANCE hInstance, int nCmdShow)
{
    MSG       msg = {0};
    WNDCLASS  wc;

    // Dialog custom window class
    ZeroMemory(&wc, sizeof(wc));
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.cbWndExtra    = DLGWINDOWEXTRA;
    wc.hCursor       = LoadCursorW(NULL, IDC_ARROW);
    wc.hIcon         = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_APP));
	wc.lpszMenuName =  MAKEINTRESOURCE(IDR_MENU1);
    wc.lpfnWndProc   = DefDlgProcW;
    wc.lpszClassName = L"Face-And-HDFace-Basics-D2DAppDlgWndClass";

    if (!RegisterClassW(&wc))
    {
        return 0;
    }

	//hMenu = LoadMenuW(hInstance, MAKEINTRESOURCE(IDR_MENU1));
	
    // Create main application window
    HWND hWndApp = CreateDialogParamW(        NULL,         MAKEINTRESOURCE(IDD_APP),         NULL,        (DLGPROC)CFaceBasics::MessageRouter,         reinterpret_cast<LPARAM>(this));

	//HWND hWndApp = CreateDialogParamW(        NULL,         MAKEINTRESOURCE(IDD_APP),         NULL,        (DLGPROC)CFaceBasics::MessageRouter,  WS_CAPTION);


    // Show window
    ShowWindow(hWndApp, nCmdShow);
	//ShowWindow(hWndApp, 3);

    // Main message loop
    while (WM_QUIT != msg.message)
    {
        Update();

        while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
        {
            // If a dialog message will be taken care of by the dialog proc
            if (hWndApp && IsDialogMessageW(hWndApp, &msg))
            {
                continue;
            }

            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }

    return static_cast<int>(msg.wParam);
}
开发者ID:dngoins,项目名称:KinectFaceStudio,代码行数:57,代码来源:FaceBasics.cpp


示例19: submitEvents

/*------------------------------------------------------------------*\
							submitEvents()
\*------------------------------------------------------------------*/
void CWinEventEmitter::submitEvents(CEventServer & server, bool allWindows)
{
	MSG	msg;
	while ( PeekMessageW(&msg,allWindows?NULL:_HWnd,0,0,PM_REMOVE) )
	{
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
	}

	// Dispatch sent messages
	_InternalServer.setServer (&server);
	_InternalServer.pump (allWindows);
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:16,代码来源:win_event_emitter.cpp


示例20: while

bool Engine::UpdateSystemMessage()
{
    MSG msg;

	while (PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE))
	{
		if (GetMessageW(&msg, NULL, 0, 0) == 0)
			return false;
     	TranslateMessage( &msg );
     	DispatchMessageW( &msg );
	}
    return true;
}
开发者ID:leandronunescorreia,项目名称:prelight,代码行数:13,代码来源:engine.cpp



注:本文中的PeekMessageW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PeiServicesInstallPpi函数代码示例发布时间:2022-05-30
下一篇:
C++ PeekMessage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap