当前位置: 首页>>代码示例>>C++>>正文


C++ GetMessageW函数代码示例

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


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

示例1: wWinMain

int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
    MSG msg;

    /* Other instances of app running? */
    if (!hPrevInstance)
    {
      /* stuff to be done once */
      if (!InitApplication(hInstance))
      {
        return FALSE;      /* exit */
      }
    }

    /* stuff to be done every time */
    if (!InitInstance(hInstance, nCmdShow))
    {
      return FALSE;
    }

    HandleCommandLine(lpCmdLine);

    /* Main loop */
    /* Acquire and dispatch messages until a WM_QUIT message is received */
    while (GetMessageW(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }

    return msg.wParam;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:32,代码来源:view.c

示例2: MessageLoop

static DWORD WINAPI MessageLoop(LPVOID lpParameter)
{
    VideoRendererImpl* This = lpParameter;
    MSG msg; 
    BOOL fGotMessage;

    TRACE("Starting message loop\n");

    if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseControlWindow.baseWindow)))
    {
        This->ThreadResult = FALSE;
        SetEvent(This->hEvent);
        return 0;
    }

    This->ThreadResult = TRUE;
    SetEvent(This->hEvent);

    while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
    {
        TranslateMessage(&msg); 
        DispatchMessageW(&msg);
    }

    TRACE("End of message loop\n");

    return msg.wParam;
}
开发者ID:lucianolorenti,项目名称:wine,代码行数:28,代码来源:videorenderer.c

示例3: threadRenderLoop

int Engine_Win::run()
{
    m_bRunning = true;
    std::thread threadRenderLoop( &Engine_Win::renderLoop, this );
    std::thread threadLogicLoop( &Engine_Win::logicLoop, this );

    // message loop
    BOOL bRet;
    MSG msg;
    while ( ( bRet = GetMessageW( &msg, nullptr, 0, 0 ) ) != 0 )
    {
        if ( bRet == -1 )
        {
            //Dafuq? I quit!
            quit();
        }
        else
        {
            TranslateMessage( &msg );
            DispatchMessageW( &msg );
        }
        std::this_thread::sleep_for( std::chrono::milliseconds( 4 ) );
    }

    m_bRunning = false;
    threadRenderLoop.join();
    threadLogicLoop.join();

    return 0;
}
开发者ID:Svensational,项目名称:mIon,代码行数:30,代码来源:Engine_Win.cpp

示例4: SCROLL_TrackScrollBar

static void 
SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
{
    MSG msg;

    ScreenToWindow(hwnd, &pt);

    SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );

    do
    {
        if (!GetMessageW( &msg, 0, 0, 0 )) break;
        if (CallMsgFilterW( &msg, MSGF_SCROLLBAR )) continue;
        if (msg.message == WM_LBUTTONUP ||
            msg.message == WM_MOUSEMOVE ||
            (msg.message == WM_SYSTIMER && msg.wParam == SCROLL_TIMER))
        {
            pt.x = GET_X_LPARAM(msg.lParam);
            pt.y = GET_Y_LPARAM(msg.lParam);
            ClientToScreen(hwnd, &pt);
            ScreenToWindow(hwnd, &pt);
            SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt );
        }
        else
        {
            TranslateMessage( &msg );
            DispatchMessageW( &msg );
        }
        if (!IsWindow( hwnd ))
        {
            ReleaseCapture();
            break;
        }
    } while (msg.message != WM_LBUTTONUP && GetCapture() == hwnd);
}
开发者ID:darkvaderXD2014,项目名称:reactos,代码行数:35,代码来源:ncscrollbar.c

示例5: PostMessageW

void RInput::deinitialise(){
	if(false == RInput::_initialised){
		return;
	}
	
	RInput::_initialised = false;

	if(0 == PostMessageW(RInput::_hwnd_message, WM_DESTROY, 0, 0)){
		std::cerr << "RInput::deinitialise(): 0 == PostMessageW(RInput::_hwnd_message, WM_DESTROY, 0, 0), GetLastError():" << std::dec << GetLastError() << std::endl;
	}

    MSG msg;
	while(GetMessageW(&msg, RInput::_hwnd_message, 0, 0)){
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
	}

	if(0 == DestroyWindow(RInput::_hwnd_message)){
		std::cerr << "RInput::deinitialise(): 0 == DestroyWindow(RInput::_hwnd_message), GetLastError(): " << std::dec << GetLastError() << std::endl;
		return;
	}

	RInput::_rinput_instance = std::shared_ptr<RInput>(nullptr);
	RInput::_initialised = false;
	RInput::_hwnd_message = 0;
}
开发者ID:4D4B,项目名称:RInput,代码行数:26,代码来源:rinput.cpp

示例6: main

int main(int argc, char *argv[])
{
	WNDCLASSW wc;
	MSG msg;

	ZeroMemory(&wc, sizeof (WNDCLASSW));
	wc.lpszClassName = L"mainwin";
	wc.lpfnWndProc = wndProc;
	wc.hInstance = GetModuleHandle(NULL);
	wc.hIcon = LoadIconW(NULL, IDI_APPLICATION);
	wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
	RegisterClassW(&wc);

	mainwin = CreateWindowExW(0,
		L"mainwin", L"mainwin",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT,
		400, 400,
		NULL, NULL, GetModuleHandle(NULL), NULL);

	if (argc > 1)
		dialog = CreateWindowExW(WS_EX_CONTROLPARENT,
			WC_DIALOG, L"",
			WS_CHILD | WS_VISIBLE,
			100, 100, 200, 200,
			mainwin, NULL, GetModuleHandle(NULL), NULL);
	else {
		const BYTE dlgtemplate[] = {
			0x01, 0x00,				// version
			0xFF, 0xFF,				// signature
			0x00, 0x00, 0x00, 0x00,		// help
			0x00, 0x00, 0x01, 0x00,		// WS_EX_CONTROLPARENT
			0x00, 0x00, 0x00, 0x50,		// WS_CHILD | WS_VISIBLE
			0x00, 0x00,				// no controls
			100, 0,					// X/Y/Width/Height
			100, 0,
			100, 0,
			100, 0,
			0x00, 0x00,				// menu
			0x00, 0x00,				// class
			0x00, 0x00,				// title
			0x00, 0x00, 0x00, 0x00,		// some padding
			0x00, 0x00, 0x00, 0x00,		// more padding
			0x00, 0x00, 0x00, 0x00,		// just to be safe
		};

		dialog = CreateDialogIndirectW(GetModuleHandle(NULL), (LPCDLGTEMPLATEW) dlgtemplate, mainwin, dlgproc);
	}
	printf("%I32X\n", EnableThemeDialogTexture(dialog, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB));

	ShowWindow(mainwin, SW_SHOWDEFAULT);
	UpdateWindow(mainwin);

	while (GetMessageW(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return 0;
}
开发者ID:andlabs,项目名称:misctestprogs,代码行数:60,代码来源:winetdttest.c

示例7: CreateWndThreadW

/**
 * \brief Thread that create window and that monitor event related to it.
 * \param pThreadParam thread parameter
 * \return 0
 */
static unsigned WINAPI CreateWndThreadW(LPVOID pThreadParam)
{
  HINSTANCE hInstance = GetModuleHandle(NULL);
  keyboard_hook* keyboard = (keyboard_hook*)pThreadParam;

  RegisterWindowClassW(hInstance);

  HWND hWnd = CreateWindowW(WINDOW_SHORTCUT_NAME, NULL, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
      NULL, NULL, hInstance, NULL);
  keyboard->hook = SetWindowsHookEx(WH_KEYBOARD_LL, keyHandler, NULL, 0);

  if(hWnd == NULL)
  {
    fprintf(stderr, "Failed to create window: %d\n", GetLastError());
    fflush(stderr);
    return 0;
  }
  else
  {
    MSG msg;

    keyboard->hwnd = hWnd;
    PostMessage(keyboard->hwnd, WM_HOTKEY, 0, 0);

    while(GetMessageW(&msg, hWnd, 0, 0))
    {
      TranslateMessage(&msg);
      DispatchMessageW(&msg);
    }
    return msg.wParam;
  }
}
开发者ID:Darkeye9,项目名称:jitsi,代码行数:38,代码来源:net_java_sip_communicator_impl_globalshortcut_NativeKeyboardHook.cpp

示例8: CreateView

/// <summary>
/// Creates the main window and begins processing
/// </summary>
int CMainWindow::Run()
{
    // Create main application window
    CreateView();

    // Show the main window
    ShowView();

    // Show the kinect windows
    ShowAllKinectWindows();

    // Main message loop
    MSG msg = {0};

    while (WM_QUIT != msg.message)
    {
        if (GetMessageW(&msg, nullptr, 0, 0))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return static_cast<int>(msg.wParam);
}
开发者ID:dcastro9,项目名称:emory_kinect_project,代码行数:28,代码来源:MainWindow.cpp

示例9: WinMain

int APIENTRY WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR     lpCmdLine,
	int       nCmdShow)
{
	// TODO: Place code here.
	MSG msg;

	//CoInitialize(0); // for Shell Icons

	// Initialize global strings
	htmlayout::window::register_class(hInstance);

	// Perform application initialization:
	if (!InitInstance(hInstance, nCmdShow))
	{
		return FALSE;
	}


	// Main message loop:
	while (GetMessageW(&msg, NULL, 0, 0))
	{
		// execute asynchronous tasks in GUI thread.
		htmlayout::queue::execute();

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

	return msg.wParam;
}
开发者ID:XiaoFan1519,项目名称:ColorHelper,代码行数:32,代码来源:ColorHelper.cpp

示例10: CreateEventW

/// <summary>
/// Window message loop
/// </summary>
/// <returns>wParam of last received message</returns>
WPARAM KinectWindow::MessageLoop()
{
    m_hStopStreamEventThread = CreateEventW(nullptr, TRUE, FALSE, nullptr);

    HANDLE hEventThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)StreamEventThread, this, 0, nullptr);

    MSG  msg = {0};
    BOOL ret;
    while (0 != (ret = GetMessageW(&msg, nullptr, 0, 0)))
    {
        if (-1 == ret)
        {
            break;
        }

        if (IsDialogMessageW(m_hWnd, &msg))
        {
            continue;
        }

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

    WaitForSingleObject(hEventThread, INFINITE);
    CloseHandle(hEventThread);

    return msg.wParam;
}
开发者ID:rikvdbrule,项目名称:KinectRecording,代码行数:33,代码来源:KinectWindow.cpp

示例11: WinMain

int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg;
    HANDLE hAccelTable;
   
    if(!hPrevInst)
    {
        if(!InitApplication(hInst))
            return FALSE;
    }

    if(!InitInstance(hInst, nCmdShow))
        return FALSE;

    hAccelTable = LoadAcceleratorsW(hInst, MAKEINTRESOURCEW(IDA_OLEVIEW));

    while(GetMessageW(&msg, NULL, 0, 0))
    {
        if(TranslateAcceleratorW(globals.hMainWnd, hAccelTable, &msg)) continue;

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

    return msg.wParam;
}
开发者ID:Sunmonds,项目名称:wine,代码行数:26,代码来源:oleview.c

示例12: CreateWndThreadW

unsigned WINAPI 
CreateWndThreadW(
	LPVOID pThreadParam) 
{
	HWND hWnd = CreateWindowW( L"Azureus Window Hook", NULL, WS_OVERLAPPEDWINDOW,
									CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
									NULL, NULL, hInstance, NULL);
	if( hWnd == NULL){

		printf( "Failed to create window\n" );

		return( 0 );

	}else{

		MSG Msg;

		while(GetMessageW(&Msg, hWnd, 0, 0)) {

			TranslateMessage(&Msg);

			DispatchMessageW(&Msg);
		}

		return Msg.wParam;
	}
} 
开发者ID:cnh,项目名称:BitMate,代码行数:27,代码来源:aereg.cpp

示例13: TuiConsoleThread

static DWORD WINAPI
TuiConsoleThread(PVOID Data)
{
    PTUI_CONSOLE_DATA TuiData = (PTUI_CONSOLE_DATA)Data;
    PCONSOLE Console = TuiData->Console;
    HWND NewWindow;
    MSG msg;

    NewWindow = CreateWindowW(TUI_CONSOLE_WINDOW_CLASS,
                              Console->Title.Buffer,
                              0,
                              -32000, -32000, 0, 0,
                              NULL, NULL,
                              ConSrvDllInstance,
                              (PVOID)Console);
    if (NULL == NewWindow)
    {
        DPRINT1("CONSRV: Unable to create console window\n");
        return 1;
    }
    TuiData->hWindow = NewWindow;

    SetForegroundWindow(TuiData->hWindow);
    NtUserConsoleControl(ConsoleAcquireDisplayOwnership, NULL, 0);

    while (GetMessageW(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }

    return 0;
}
开发者ID:CSRedRat,项目名称:reactos-playground,代码行数:33,代码来源:tuiterm.c

示例14: main

int main(void)
{
	HWND mainwin;
	MSG msg;
	INITCOMMONCONTROLSEX icc;

	ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
	icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
	icc.dwICC = ICC_LISTVIEW_CLASSES;
	if (InitCommonControlsEx(&icc) == 0)
		abort();
	makeTableWindowClass();
	mainwin = CreateWindowExW(0,
		tableWindowClass, L"Main Window",
		WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
		CW_USEDEFAULT, CW_USEDEFAULT,
		400, 400,
		NULL, NULL, GetModuleHandle(NULL), NULL);
	if (mainwin == NULL)
		abort();
	SendMessageW(mainwin, tableAddColumn, tableColumnText, (LPARAM) L"Column");
	SendMessageW(mainwin, tableAddColumn, tableColumnImage, (LPARAM) L"Column 2");
	SendMessageW(mainwin, tableAddColumn, tableColumnCheckbox, (LPARAM) L"Column 3");
	ShowWindow(mainwin, SW_SHOWDEFAULT);
	if (UpdateWindow(mainwin) == 0)
		abort();
	while (GetMessageW(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessageW(&msg);
	}
	return 0;
}
开发者ID:yhcflyy,项目名称:ui,代码行数:32,代码来源:main.c

示例15: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
  //
  // FIXME: Resource loader owner must be Application class
  // or something like this. Instanize resourse loader here
  // is not good way.
  //

  ResourceLoader resourceLoader(hInstance);
  VncViewerConfig config;

	// The state of the application as a whole is contained in the one app object
	#ifdef _WIN32_WCE
		VNCviewerApp app(hInstance, szCmdLine);
	#else
		VNCviewerApp32 app(hInstance, szCmdLine);
	#endif

	// Start a new connection if specified on command line, 
	// or if not in listening mode
	
	if (app.m_options.m_connectionSpecified) {
		app.NewConnection(app.m_options.m_host, app.m_options.m_port);
	} else if (!app.m_options.m_listening) {
		// This one will also read from config file if specified
		app.NewConnection();
	}

	MSG msg;
	std::list<HWND>::iterator iter;

	try {
		while (GetMessageW(&msg, NULL, 0, 0)) {
			if ( !hotkeys.TranslateAccel(&msg) &&
				 !help.TranslateMsg(&msg) &&
				 !app.ProcessDialogMessage(&msg) ) {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	} catch (WarningException &e) {
		e.Report();
	} catch (QuietException &e) {
		e.Report();
	}
	
	// Clean up winsock
	WSACleanup();

    Log::warning(_T("Exiting\n"));

	return msg.wParam;
}
开发者ID:kaseya,项目名称:tightvnc2,代码行数:54,代码来源:vncviewer.cpp


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