这篇教程C++ GetMessage函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMessage函数的具体用法?C++ GetMessage怎么用?C++ GetMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetMessage函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: main// для GCC - другаяint main()#endif{ w = ImageWidth, h = ImageHeight; encode_start(); //memset(&CamImg, 0, sizeof(CamImg)); MSG msg; WNDCLASSA wcl; // 0. Регистрируем оконный класс wcl.hInstance = NULL; wcl.lpszClassName = szWinName; wcl.lpfnWndProc = MyFunc; wcl.style = 0; wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION); wcl.hCursor = LoadCursor(NULL, IDC_ARROW); wcl.lpszMenuName = NULL; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); if(!RegisterClassA(&wcl)) return 0; // 1. Создаём окно hWnd = CreateWindowA(szWinName, "Video", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 700, HWND_DESKTOP, NULL, NULL, NULL); HWND hStartRecord = CreateWindowA( "BUTTON", // Window class "Start", // Title WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 650, 200, 100, 50, hWnd, (HMENU)ID_START_BUTTON, // для WM_COMMAND NULL /*hThisInst*/, NULL ); HWND hStopRecord = CreateWindowA( "BUTTON", // Window class "Stop", // Title WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 650, 100, 100, 50, hWnd, (HMENU)ID_STOP_BUTTON, // для WM_COMMAND NULL /*hThisInst*/, NULL ); // 2. Отображаем окно на экран ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); // 3. Запускаем таймер (20 мсек, 50 кадров в секунду) SetTimer(hWnd, 1, 20, NULL); // 4. стартуем получение кадров с камеры InitVideo(); // 5. Стандартный цикл обработки событий while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam;}
开发者ID:suratovvlad,项目名称:videostream,代码行数:82,
示例2: Notepad_WinMain//.........这里部分代码省略......... char *st = strstr( lpCmdLine, "|" ) ; if( st!=NULL ) { SavFile=(char*)malloc(strlen(st)+1); strcpy( SavFile, st+1 ) ; st[0]='/0'; IniFile=(char*)malloc(strlen(lpCmdLine)+1); strcpy( IniFile, lpCmdLine ) ; } } } TestIfParentIsKiTTY() ;#endif notepad_hinst = hinstance; HANDLE hAccel = LoadAccelerators (notepad_hinst, MAKEINTRESOURCE(NOTEPAD_IDR_ACCEL)) ; wc.style = 0; wc.lpfnWndProc = Notepad_WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = NULL; //wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIcon = LoadIcon(notepad_hinst, MAKEINTRESOURCE(NOTEPAD_IDI_MAINICON)); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); wc.lpszMenuName = NULL; wc.lpszClassName = Notepad_szprogname ; if(!RegisterClass(&wc)) return FALSE; //menu et sous menu hSMApropos = CreateMenu(); AppendMenu(hSMApropos, MF_STRING, NOTEPAD_IDM_ABOUT, Notepad_LoadString(NOTEPAD_STR_ABOUT)); hSMEdition = CreateMenu(); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_CUT, Notepad_LoadString(NOTEPAD_STR_CUT)); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_COPY, Notepad_LoadString(NOTEPAD_STR_COPY)); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_PASTE, Notepad_LoadString(NOTEPAD_STR_PASTE)); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SELECTALL, Notepad_LoadString(NOTEPAD_STR_SELECTALL)); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_UNDO, Notepad_LoadString(NOTEPAD_STR_UNDO)); AppendMenu(hSMEdition, MF_SEPARATOR, 0, NULL ); AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SETFONT, Notepad_LoadString(NOTEPAD_STR_SETFONT)); hSMFichier = CreateMenu(); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW)); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN)); AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE)); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS));#ifdef NOMAIN AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file")); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file")); if( ParentWindow!=NULL ) { AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize")); }#endif AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_QUIT, Notepad_LoadString(NOTEPAD_STR_QUIT)); hMenu = CreateMenu(); AppendMenu(hMenu,MF_POPUP,(UINT)hSMFichier,Notepad_LoadString(NOTEPAD_STR_FILE)); AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT));#ifdef NOMAIN HMENU hSMDelim = CreateMenu() ; AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_CRLF, Notepad_LoadString(NOTEPAD_STR_CRLF)); AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_SCOLON, Notepad_LoadString(NOTEPAD_STR_SCOLON)); AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_SLASH, Notepad_LoadString(NOTEPAD_STR_SLASH)); AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM)); AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND));#endif AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP)); //hwnd = CreateWindow(Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL); hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL); if (!hwnd) return FALSE; ShowWindow(hwnd, nCmdShow) ; UpdateWindow(hwnd) ;#ifdef NOMAIN InitKiTTYNotepad( hwnd ) ; if( strstr( lpCmdLine, "-ed " ) == lpCmdLine ) if( strlen(lpCmdLine)>4 ) SendMessage( hwnd, WM_COMMAND, NOTEPAD_IDM_LOAD, (LPARAM)(lpCmdLine+4) ) ;#else if( strlen(lpCmdLine)>0 ) SendMessage( hwnd, WM_COMMAND, NOTEPAD_IDM_LOAD, (LPARAM)lpCmdLine ) ;#endif while (GetMessage(&msg, NULL, 0, 0)) { if(!TranslateAccelerator(hwnd, hAccel, &msg)){ TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; }
开发者ID:pigfoot,项目名称:KiTTY,代码行数:101,
示例3: pvm_win_window_thread//int WINAPIvoid pvm_win_window_thread(){ MSG Message; if(pvm_win_setup_window()) { init_err = 1; printf("pvm_win_setup_window failed/n"); return; } // Allocate enough memory for the BITMAPINFOHEADER and 256 RGBQUAD palette entries LPBITMAPINFO lpbi; lpbi = (LPBITMAPINFO) malloc(sizeof(BITMAPINFOHEADER) + (256 * sizeof(RGBQUAD))); lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); lpbi->bmiHeader.biWidth = VSCREEN_WIDTH; lpbi->bmiHeader.biHeight = VSCREEN_HEIGHT; lpbi->bmiHeader.biPlanes = 1; lpbi->bmiHeader.biBitCount = 24; lpbi->bmiHeader.biCompression = BI_RGB; lpbi->bmiHeader.biSizeImage = 0; lpbi->bmiHeader.biXPelsPerMeter = 0; lpbi->bmiHeader.biYPelsPerMeter = 0; lpbi->bmiHeader.biClrUsed = 0; lpbi->bmiHeader.biClrImportant = 0; HDC hScreenDC = GetWindowDC(NULL); screenBitmap = CreateDIBSection( hScreenDC, lpbi, DIB_RGB_COLORS, (void*)&screen_image, 0, 0); // Assume hPaintDC is a variable of type HDC, and the dc we're rendering to //hBitmapDC = CreateCompatibleDC(hScreenDC); //HBITMAP hOldBitmap = (HBITMAP)SelectObject(hBitmapDC, screenBitmap); ReleaseDC(NULL,hScreenDC); free(lpbi); int i; for( i = 0; i < VSCREEN_WIDTH * VSCREEN_HEIGHT * 3; i++) { screen_image[i] = 34; } drv_video_win32.screen = screen_image; drv_video_win32.xsize = VSCREEN_WIDTH; drv_video_win32.ysize = VSCREEN_HEIGHT; drv_video_win32.update = &drv_win_screen_update;#if 1 drv_video_win32.bitblt = &vid_bitblt_forw; drv_video_win32.winblt = &vid_win_winblt; drv_video_win32.readblt = &vid_readblt_forw; drv_video_win32.bitblt_part = &vid_bitblt_part_forw;#else drv_video_win32.bitblt = &drv_video_bitblt_rev; drv_video_win32.winblt = &drv_video_win_winblt_rev; drv_video_win32.readblt = &drv_video_readblt_rev; drv_video_win32.bitblt_part = &drv_video_bitblt_part_rev;#endif drv_video_win32.mouse_redraw_cursor = &vid_mouse_draw_deflt; drv_video_win32.mouse_set_cursor = &vid_mouse_set_cursor_deflt; drv_video_win32.mouse_disable = &vid_mouse_off_deflt; drv_video_win32.mouse_enable = &vid_mouse_on_deflt; init_ok = 1;#if HOVER { eventTrack.cbSize = sizeof(eventTrack); eventTrack.dwFlags = TME_HOVER; eventTrack.hwndTrack = hWnd; eventTrack.dwHoverTime = 5; if(0 == TrackMouseEvent(&eventTrack)) printf("Track error/n"); }#endif while(GetMessage(&Message, hWnd, 0, 0)) { TranslateMessage(&Message); DispatchMessage(&Message); } //return Message.wParam; //printf("Message loop end/n");}
开发者ID:animotron,项目名称:animos,代码行数:91,
示例4: DX5_CheckInput/* This function checks the windows message queue and DirectInput and returns 1 if there was input, 0 if there was no input, or -1 if the application has posted a quit message.*/static int DX5_CheckInput(_THIS, int timeout, BOOL processInput){ MSG msg; int i; HRESULT result; DWORD event; /* Check the normal windows queue (highest preference) */ posted = 0; while ( ! posted && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { DispatchMessage(&msg); } else { return(-1); } } if ( posted ) { return(1); } /* Pump the DirectInput flow */ if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { for ( i=0; i<SDL_DIndev; ++i ) { result = IDirectInputDevice2_Poll(SDL_DIdev[i]); if ( (result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED) ) { if ( strcmp(inputs[i].name, "mouse") == 0 ) { mouse_lost = 1; } IDirectInputDevice2_Acquire(SDL_DIdev[i]); IDirectInputDevice2_Poll(SDL_DIdev[i]); } } } /* Wait for messages and input events */ event = MsgWaitForMultipleObjects(SDL_DIndev, SDL_DIevt, FALSE, timeout, QS_ALLEVENTS); if ((event >= WAIT_OBJECT_0) && (event < (WAIT_OBJECT_0+SDL_DIndev))) { DWORD numevents; DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; event -= WAIT_OBJECT_0; numevents = INPUT_QSIZE; result = IDirectInputDevice2_GetDeviceData( SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), evtbuf, &numevents, 0); if ( (result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED) ) { if ( strcmp(inputs[event].name, "mouse") == 0 ) { mouse_lost = 1; } IDirectInputDevice2_Acquire(SDL_DIdev[event]); result = IDirectInputDevice2_GetDeviceData( SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), evtbuf, &numevents, 0); } /* Handle the events */ if ( result == DI_OK && processInput ) { /* Note: This can post multiple events to event queue */ (*SDL_DIfun[event])((int)numevents, evtbuf); return(1); } } if ( event != WAIT_TIMEOUT ) { /* Maybe there was a windows message? */ if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { DispatchMessage(&msg); } else { return(-1); } return(1); } } return(0);}
开发者ID:Sgt-Nukem,项目名称:chocolate_duke3D,代码行数:83,
示例5: wWinMainint WINAPIwWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd){ WCHAR szWindowClass[] = L"ROSAPPMGR"; HANDLE hMutex = NULL; HACCEL KeyBrd; MSG Msg; InitializeAtlModule(hInstance, TRUE); switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } hInst = hInstance; hMutex = CreateMutexW(NULL, FALSE, szWindowClass); if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS)) { /* If already started, it is found its window */ HWND hWindow = FindWindowW(szWindowClass, NULL); /* Activate window */ ShowWindow(hWindow, SW_SHOWNORMAL); SetForegroundWindow(hWindow); return 1; } if (!LoadSettings()) { FillDefaultSettings(&SettingsInfo); } InitLogs(); InitCommonControls(); hMainWnd = CreateMainWindow(); if (!hMainWnd) goto Exit; /* Maximize it if we must */ ShowWindow(hMainWnd, (SettingsInfo.bSaveWndPos && SettingsInfo.Maximized ? SW_MAXIMIZE : nShowCmd)); UpdateWindow(hMainWnd); if (SettingsInfo.bUpdateAtStart) UpdateAppsDB(); /* Load the menu hotkeys */ KeyBrd = LoadAccelerators(NULL, MAKEINTRESOURCE(HOTKEYS)); /* Message Loop */ while (GetMessage(&Msg, NULL, 0, 0)) { if (!TranslateAccelerator(hMainWnd, KeyBrd, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } }Exit: if (hMutex) CloseHandle(hMutex); InitializeAtlModule(hInstance, FALSE); return 0;}
开发者ID:GYGit,项目名称:reactos,代码行数:74,
示例6: MainLoop//----------------------------------------------------------------------------------////----------------------------------------------------------------------------------void MainLoop(){ for(;;) { MSG msg; if (PeekMessage (&msg,NULL,0,0,PM_NOREMOVE)) { if( msg.message == WM_QUIT ) { return ; } GetMessage (&msg,NULL,0,0); TranslateMessage(&msg); DispatchMessage(&msg); } else { // フリップを行う g_manager->Flip(); // Updateと再生 C++ GetMessagePos函数代码示例 C++ GetMesh函数代码示例
|