本文整理汇总了C++中GetMessageW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMessageW函数的具体用法?C++ GetMessageW怎么用?C++ GetMessageW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMessageW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: wWinMain
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccel;
UNREFERENCED_PARAMETER(hPrevInstance);
if (ProcessCmdLine(lpCmdLine))
{
return 0;
}
/* Initialize global strings */
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING);
switch (GetUserDefaultUILanguage())
{
case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
SetProcessDefaultLayout(LAYOUT_RTL);
break;
default:
break;
}
/* Store instance handle in our global variable */
hInst = hInstance;
/* Perform application initialization */
if (!InitInstance(hInstance, nCmdShow))
{
return 0;
}
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL));
/* Main message loop */
while (GetMessageW(&msg, NULL, 0, 0))
{
if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg) &&
!TranslateChildTabMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
ExitInstance(hInstance);
return (int)msg.wParam;
}
开发者ID:RareHare,项目名称:reactos,代码行数:54,代码来源:main.c
示例17: 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
示例18: while
// Main application message loop
WPARAM CApplication::MessageLoop(void)
{
while (GetMessageW(&msg, NULL, 0, 0))
{
if (!TranslateAcceleratorW(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:13,代码来源:Application.cpp
示例19: _power_notification_thread
static void _power_notification_thread() {
// This uses a thread with its own window message pump to get power
// notifications. If adb runs from a non-interactive service account, this
// might not work (not sure). If that happens to not work, we could use
// heavyweight WMI APIs to get power notifications. But for the common case
// of a developer's interactive session, a window message pump is more
// appropriate.
D("Created power notification thread");
adb_thread_setname("Power Notifier");
// Window class names are process specific.
static const WCHAR kPowerNotificationWindowClassName[] = L"PowerNotificationWindow";
// Get the HINSTANCE corresponding to the module that _power_window_proc
// is in (the main module).
const HINSTANCE instance = GetModuleHandleW(nullptr);
if (!instance) {
// This is such a common API call that this should never fail.
LOG(FATAL) << "GetModuleHandleW failed: "
<< android::base::SystemErrorCodeToString(GetLastError());
}
WNDCLASSEXW wndclass;
memset(&wndclass, 0, sizeof(wndclass));
wndclass.cbSize = sizeof(wndclass);
wndclass.lpfnWndProc = _power_window_proc;
wndclass.hInstance = instance;
wndclass.lpszClassName = kPowerNotificationWindowClassName;
if (!RegisterClassExW(&wndclass)) {
LOG(FATAL) << "RegisterClassExW failed: "
<< android::base::SystemErrorCodeToString(GetLastError());
}
if (!CreateWindowExW(WS_EX_NOACTIVATE, kPowerNotificationWindowClassName,
L"ADB Power Notification Window", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr,
instance, nullptr)) {
LOG(FATAL) << "CreateWindowExW failed: "
<< android::base::SystemErrorCodeToString(GetLastError());
}
MSG msg;
while (GetMessageW(&msg, nullptr, 0, 0)) {
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
// GetMessageW() will return false if a quit message is posted. We don't
// do that, but it might be possible for that to occur when logging off or
// shutting down. Not a big deal since the whole process will be going away
// soon anyway.
D("Power notification thread exiting");
}
开发者ID:android,项目名称:platform_system_core,代码行数:52,代码来源:usb_windows.cpp
示例20: SystemActivityNotifications_runMessageLoop
unsigned WINAPI
SystemActivityNotifications_runMessageLoop(LPVOID pv)
{
MSG msg;
HWND hWnd = (HWND) pv;
while (GetMessageW(&msg, hWnd, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
return msg.wParam;
}
开发者ID:LMVUH,项目名称:jitsi-110915,代码行数:13,代码来源:net_java_sip_communicator_impl_sysactivity_SystemActivityNotifications.cpp
注:本文中的GetMessageW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论