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


C++ PostQuitMessage函数代码示例

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


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

示例1: switch

/*************************************************************************
    Win32 'Window Procedure' function
*************************************************************************/
LRESULT CALLBACK Win32AppHelper::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
    case WM_CHAR:
        s_samplesFramework->injectChar((CEGUI::utf32)wParam);
        break;

    case WM_MOUSELEAVE:
        mouseLeaves();
        break;

    case WM_NCMOUSEMOVE:
        mouseLeaves();
        break;

    case WM_MOUSEMOVE:
        mouseEnters();

        s_samplesFramework->injectMousePosition((float)(LOWORD(lParam)), (float)(HIWORD(lParam)));
        break;

    case WM_LBUTTONDOWN:
        s_samplesFramework->injectMouseButtonDown(CEGUI::LeftButton);
        break;

    case WM_LBUTTONUP:
        s_samplesFramework->injectMouseButtonUp(CEGUI::LeftButton);
        break;

    case WM_RBUTTONDOWN:
        s_samplesFramework->injectMouseButtonDown(CEGUI::RightButton);
        break;

    case WM_RBUTTONUP:
        s_samplesFramework->injectMouseButtonUp(CEGUI::RightButton);
        break;

    case WM_MBUTTONDOWN:
        s_samplesFramework->injectMouseButtonDown(CEGUI::MiddleButton);
        break;

    case WM_MBUTTONUP:
        s_samplesFramework->injectMouseButtonUp(CEGUI::MiddleButton);
        break;

    case 0x020A: // WM_MOUSEWHEEL:
        s_samplesFramework->injectMouseWheelChange(static_cast<float>((short)HIWORD(wParam)) / static_cast<float>(120));
        break;

    case WM_DESTROY:
        PostQuitMessage(0);
        break;

    case WM_SIZE:
        {
            // get CEGUI::System as a pointer so we can detect if it's not
            // instantiated yet.
            CEGUI::System* cegui_system = CEGUI::System::getSingletonPtr();

            // only continue if CEGUI is up an running and window was not
            // minimised (else it's just a waste of time)
            if ((cegui_system != 0) && (wParam != SIZE_MINIMIZED))
            {
                // get renderer identification string
                CEGUI::Renderer* renderer = cegui_system->getRenderer();
                CEGUI::String id(renderer->getIdentifierString());

                // invoke correct function based on the renderer we have ID'd
#ifdef CEGUI_BUILD_RENDERER_DIRECT3D9
                if (id.find("Official Direct3D 9") != id.npos)
                    DeviceReset_Direct3D9(hWnd, renderer);
#endif
#ifdef CEGUI_BUILD_RENDERER_DIRECT3D10
                if (id.find("Official Direct3D 10") != id.npos)
                    DeviceReset_Direct3D10(hWnd, renderer);
#endif
#ifdef CEGUI_BUILD_RENDERER_DIRECT3D11
                if (id.find("Official Direct3D 11") != id.npos)
                    DeviceReset_Direct3D11(hWnd, renderer);
#endif
            }
        }
        break;

    case WM_PAINT:
        {
            HDC         hDC;
            PAINTSTRUCT ps;

            hDC = BeginPaint(hWnd, &ps);
            EndPaint(hWnd, &ps);
            break;
        }

    default:
        return(DefWindowProc(hWnd, message, wParam, lParam));
//.........这里部分代码省略.........
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:101,代码来源:Win32AppHelper.cpp

示例2: Desktop

static int Desktop(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	char cwd[MAX_PATH + 1];

        //DEB("-Desktop: \n ");

	switch (message) {
	case MSG_CREATE:
	{
                DEB("--MSG_CREATE\n ");	
                /*	
		CreateWindow(CTRL_LISTBOX,
			     "",
			     LBS_NOTIFY  | WS_VSCROLL | WS_BORDER | WS_VISIBLE,
			     IDC_FUN_3G_NOW_LISTBOX_FILE,
			     10, 30, 100, 100,
			     hWnd,
			     0);
*/
		CreateWindow(CTRL_LISTBOX,
			     "",
			     LBS_NOTIFY  | WS_VSCROLL | WS_BORDER | WS_VISIBLE,
			     IDC_FUN_3G_NOW_LISTBOX_FILE,
			     10, 30, 100, 100,
			     hWnd,
			     0);
			     
		CreateWindow(CTRL_LISTBOX,
			     "",
			     LBS_NOTIFY  | WS_VSCROLL | WS_BORDER | WS_VISIBLE,
			     IDC_FUN_3G_ADD_LISTBOX_FILE,
			     110, 30, 100, 100,
			     hWnd,
			     0);

		CreateWindow(CTRL_STATIC,
			     MSG_PATH,
			     WS_VISIBLE | SS_SIMPLE,
			     IDC_FUN_MPLAYER_MUSICADD_STATIC_PATH,
			     10, 10, 130, 15,
			     hWnd,
			     0);

		CreateWindow(CTRL_BUTTON,
			     MSG_DOWNLOAD,
			     WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON,
			     IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE,
			     230, 50, 70, 25,
			     hWnd,
			     0);

		CreateWindow(CTRL_BUTTON,
			     MSG_CANCEL,
			     WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON,
			     IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL,
			     230, 100, 50, 25,
			     hWnd,
			     0);

		SetNotificationCallback(GetDlgItem(hWnd, IDC_FUN_3G_NOW_LISTBOX_FILE), now_notif_proc);
		SetNotificationCallback(GetDlgItem(hWnd, IDC_FUN_3G_ADD_LISTBOX_FILE), file_notif_proc);
		fill_boxes(hWnd, getcwd(cwd, MAX_PATH));
	}
	break;

	case MSG_COMMAND:
	{
                DEB("--MSG_COMMAND hWnd=%d\n ,hWnd");	
		switch (wParam)	{
		case IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE:
                        DEB("---IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE\n ");		
			fn_3gFileSave(hWnd);
                                     	
			DEB("---SendNotifyMessage fWnd=%d\n ",fWnd);
			SendNotifyMessage(fWnd, MSG_MUSIC_ADD, 0, 0L);
			DEB("---SendNotifyMessage end\n ");			
			break;

		case IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL:
                        DEB("---IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL\n ");		
			DestroyMainWindow(hWnd);
			PostQuitMessage(hWnd);
			return 0;
		}
                DEB("--MSG_COMMAND END\n ");		
	}
	break;

	case MSG_CLOSE:
	{
                DEB("--MSG_CLOSE\n ");	
		DestroyMainWindow(hWnd);
		PostQuitMessage(hWnd);
		return 0;
	}
	}
	
	
	return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
开发者ID:HsiangYu,项目名称:SQ_demo1,代码行数:100,代码来源:3gadd.c

示例3: WinVoutEventProc


//.........这里部分代码省略.........
        vlc_mutex_unlock( &p_event->lock );
#endif

        switch( message )
        {
#ifdef MODULE_NAME_IS_directdraw
        case WM_ERASEBKGND:
        /* For overlay, we need to erase background */
            return !use_overlay ? 1 : DefWindowProc(hwnd, message, wParam, lParam);
        case WM_PAINT:
        /*
        ** For overlay, DefWindowProc() will erase dirty regions
        ** with colorkey.
        ** For non-overlay, vout will paint the whole window at
        ** regular interval, therefore dirty regions can be ignored
        ** to minimize repaint.
        */
            if( !use_overlay )
            {
                ValidateRect(hwnd, NULL);
            }
            // fall through to default
#else
        /*
        ** For OpenGL and Direct3D, vout will update the whole
        ** window at regular interval, therefore dirty region
        ** can be ignored to minimize repaint.
        */
        case WM_ERASEBKGND:
            /* nothing to erase */
            return 1;
        case WM_PAINT:
            /* nothing to repaint */
            ValidateRect(hwnd, NULL);
            // fall through
#endif
        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
        }
    }

    switch( message )
    {

    case WM_WINDOWPOSCHANGED:
        vlc_mutex_lock( &p_event->lock );
        p_event->has_moved = true;
        vlc_mutex_unlock( &p_event->lock );
        return 0;

    /* the user wants to close the window */
    case WM_CLOSE:
        vout_display_SendEventClose(vd);
        return 0;

    /* the window has been closed so shut down everything now */
    case WM_DESTROY:
        msg_Dbg( vd, "WinProc WM_DESTROY" );
        /* just destroy the window */
        PostQuitMessage( 0 );
        return 0;

    case WM_SYSCOMMAND:
        switch (wParam)
        {
        case IDM_TOGGLE_ON_TOP:            /* toggle the "on top" status */
        {
            msg_Dbg(vd, "WinProc WM_SYSCOMMAND: IDM_TOGGLE_ON_TOP");
            HMENU hMenu = GetSystemMenu(vd->sys->hwnd, FALSE);
            vout_display_SendWindowState(vd, (GetMenuState(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND) & MF_CHECKED) ?
                    VOUT_WINDOW_STATE_NORMAL : VOUT_WINDOW_STATE_ABOVE);
            return 0;
        }
        default:
            break;
        }
        break;

    case WM_PAINT:
    case WM_NCPAINT:
    case WM_ERASEBKGND:
        return DefWindowProc(hwnd, message, wParam, lParam);

    case WM_KILLFOCUS:
        return 0;

    case WM_SETFOCUS:
        return 0;

    case WM_GESTURE:
        return DecodeGesture( VLC_OBJECT(vd), p_event->p_gesture, hwnd, message, wParam, lParam );

    default:
        //msg_Dbg( vd, "WinProc WM Default %i", message );
        break;
    }

    /* Let windows handle the message */
    return DefWindowProc(hwnd, message, wParam, lParam);
}
开发者ID:yexihu,项目名称:vlc-2.2.0-rc2.32-2013,代码行数:101,代码来源:events.c

示例4: WndProc


//.........这里部分代码省略.........
        bool enterWnd = LOWORD(lParam) == HTCLIENT;
        if (enterWnd && winCursor)
        {
            winCursor = !winCursor;
            ShowCursor(winCursor != 0);
            plMouseDevice::ShowCursor();
        }
        else if (!enterWnd && !winCursor)
        {
            winCursor = !winCursor;
            ShowCursor(winCursor != 0);
            plMouseDevice::HideCursor();
        }
        return TRUE;
    }
    break;

    case WM_ACTIVATE:
    {
        bool active = (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE);
        bool minimized = (HIWORD(wParam) != 0);

        if (gClient && !minimized && !gClient->GetDone())
        {
            gClient->WindowActivate(active);
        }
        else
        {
            gPendingActivate = true;
            gPendingActivateFlag = active;
        }
    }
    break;

    // Let go of the mouse if the window is being moved.
    case WM_ENTERSIZEMOVE:
        gDragging = true;
        if( gClient )
            gClient->WindowActivate(false);
        break;

    // Redo the mouse capture if the window gets moved
    case WM_EXITSIZEMOVE:
        gDragging = false;
        if( gClient )
            gClient->WindowActivate(true);
        break;

    // Redo the mouse capture if the window gets moved (special case for Colin
    // and his cool program that bumps windows out from under the taskbar)
    case WM_MOVE:
        if (!gDragging && gClient && gClient->GetInputManager())
            gClient->GetInputManager()->Activate(true);
        break;

    /// Resize the window
    // (we do WM_SIZING here instead of WM_SIZE because, for some reason, WM_SIZE is
    //  sent to the window when we do fullscreen, and what's more, it gets sent BEFORE
    //  the fullscreen flag is sent. How does *that* happen? Anyway, WM_SIZING acts
    //  just like WM_SIZE, except that it ONLY gets sent when the user changes the window
    //  size, not when the window is minimized or restored)
    case WM_SIZING:
    {
        RECT r;
        ::GetClientRect(hWnd, &r);
        gClient->GetPipeline()->Resize(r.right - r.left, r.bottom - r.top);
    }
    break;

    case WM_SIZE:
        // Let go of the mouse if the window is being minimized
        if (wParam == SIZE_MINIMIZED)
        {
            if (gClient)
                gClient->WindowActivate(false);
        }
        // Redo the mouse capture if the window gets restored
        else if (wParam == SIZE_RESTORED)
        {
            if (gClient)
                gClient->WindowActivate(true);
        }
        break;

    case WM_CLOSE:
        gClient->SetDone(TRUE);
        if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
            mgr->QueueDisableNet(false, nil);
        DestroyWindow(gClient->GetWindowHandle());
        break;
    case WM_DESTROY:
        gClient->SetDone(TRUE);
        if (plNetClientMgr * mgr = plNetClientMgr::GetInstance())
            mgr->QueueDisableNet(false, nil);
        PostQuitMessage(0);
        break;
    }

    return DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:TOC-Shard,项目名称:Plasma,代码行数:101,代码来源:winmain.cpp

示例5: WinProc


//.........这里部分代码省略.........
            }
            return (LONG) color;
        }
        break;

		case WM_COMMAND: {
            switch(LOWORD(wParam)) {
                case BUTTON_ADD_FOOD: {

                    char buffer[256];
                    SendMessage(hInputFood,
                        WM_GETTEXT,
                        sizeof(buffer)/sizeof(buffer[0]),
                        reinterpret_cast<LPARAM>(buffer));

                    if(strlen(buffer) > 0){
                        char newInput[255] = "";
                        char stat[30];
                        strcat(newInput, itoa((foodNumber+1), stat, 10) );
                        strcat(newInput, " ) ");
                        strcat(newInput, buffer);
                        strcat(newInput, "\r\n");

                        SendMessage(hFoodList, EM_REPLACESEL, FALSE, (LPARAM)newInput);
                        SendMessage(hInputFood, WM_SETTEXT, NULL, (LPARAM)"");
                        foodNumber++;
                        InvalidateRect(hWnd, &updateRect, TRUE);
                    }

                }
                break;

                case BUTTON_DISPLAY_FOOD_NR: {
                    char buffer[255] = "";

                    switch(foodNumber){
                    case 0:http://pastebin.com/62fGU90U
                    case 1:
                    case 2:
                    case 3:
                        strcat(buffer, "You are not hungry at all");
                        break;
                    case 4:
                    case 5:
                    case 6:
                        strcat(buffer, "I see you are hungry now");
                        break;
                    default:
                        strcat(buffer, "You are starvin... go get something to eat");
                        break;
                    }
                    MessageBox(NULL,
                        buffer,
                        "Funny",
                        MB_ICONINFORMATION);
                }
                break;
            }
        }
        break;

        case WM_SIZE: {
            INT nWidth = LOWORD(lParam);
            HWND hFunnyButton = GetDlgItem(hWnd, BUTTON_DISPLAY_FOOD_NR);

            MoveWindow(hFunnyButton, 10, 180, nWidth - 17, 40, TRUE);

            HWND hShowFoodInput = GetDlgItem(hWnd, INPUT_TEXT_SHOW_FOOD);
            HWND hAddFood = GetDlgItem(hWnd, INPUT_TEXT_ADD_FOOD);

            MoveWindow(hShowFoodInput, 10, 40, nWidth - 18, 100, TRUE);
            MoveWindow(hAddFood, 120, 150, nWidth - 128, 25, TRUE);
        }
        break;

        case WM_GETMINMAXINFO: {
            MINMAXINFO * mmiStruct;
			mmiStruct = (MINMAXINFO*)lParam;

			POINT ptPoint;

			ptPoint.x = 335;    //Minimum width of the window.
			ptPoint.y = 260;    //Minimum height of the window.
			mmiStruct->ptMinTrackSize = ptPoint;

			ptPoint.x = GetSystemMetrics(SM_CXMAXIMIZED);   //Maximum width of the window.
			ptPoint.y = GetSystemMetrics(SM_CYMAXIMIZED);   //Maximum height of the window.
			mmiStruct->ptMaxTrackSize = ptPoint;
        }
        break;

		case WM_DESTROY: {
			PostQuitMessage(0);
			return 0;
		}
		break;
	}

	return DefWindowProc(hWnd,msg,wParam,lParam);
}
开发者ID:TUM-FAF,项目名称:WP-FAF-111-Terman-Sergiu,代码行数:101,代码来源:main.cpp

示例6: PostQuitMessage

VOID jcwin32::jcwin32_exit(INT exitCode)
{
	PostQuitMessage(exitCode);
}
开发者ID:chengkehan,项目名称:lab,代码行数:4,代码来源:jcwin32.cpp

示例7: OnDestroy

void OnDestroy() {
	PostQuitMessage(0);
}
开发者ID:Gajotres100,项目名称:v01,代码行数:3,代码来源:main.cpp

示例8: WndProc


//.........这里部分代码省略.........
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;

	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		worldHandle.update(playerAct);
		EndPaint(hWnd, &ps);
		break;	
	
	case WM_MOUSEMOVE:
		// 부드럽게 보이기 위해서는 잔상처리를 그대로 하는 게 더 부드럽게 보임
		// 잔상처리를 안할경우 화면이 번쩍거리는 현상이 보이게 됨
		mX = LOWORD(lParam); // x coordinate
		mY = HIWORD(lParam); // y coordinate
		/*
		*/
		switch (wParam){
		case MK_LBUTTON:
			if (player.moveFlag == true){
				player.pos = worldHandle.getPlayerCoordinate(mX, mY);
				player.curpos = { mX, mY };

				if (worldHandle.isCurInside(player)){
					player.obj = worldHandle.getTileCoordnate(mX, mY);
					hdc = ::GetDC(hWnd);
					::Ellipse(hdc, player.obj.left, player.obj.top, player.obj.right, player.obj.bottom);
					::ReleaseDC(hWnd, hdc);
					playerAct = true;
				}
				else if (playerAct){
					hdc = ::GetDC(hWnd);
					::Ellipse(hdc, player.obj.left, player.obj.top, player.obj.right, player.obj.bottom);
					::ReleaseDC(hWnd, hdc);
				}
				else{
					//
				}
			}
			break;				
		}			
		/*
		*/
		break;

	case WM_LBUTTONUP:
		InvalidateRect(hWnd, NULL, true);
		break;

	case WM_LBUTTONDOWN:
		mX = LOWORD(lParam); // x coordinate
		mY = HIWORD(lParam); // y coordinate

		//test
		if (player.pos.x == worldHandle.getPlayerCoordinate(mX, mY).x &&
			player.pos.y == worldHandle.getPlayerCoordinate(mX, mY).y){
			player.moveFlag = true;
		}
		else {
			player.moveFlag = false;
		}
		//

		player.pos = worldHandle.getPlayerCoordinate(mX, mY);
		player.curpos = { mX, mY };

		if ( worldHandle.isCurInside(player) ){
			player.obj = worldHandle.getTileCoordnate(mX, mY);
			InvalidateRect(hWnd, NULL, true);
			playerAct = true;
		}
		else if(playerAct){
			InvalidateRect(hWnd, NULL, true);
		}
		else{
			playerAct = false;
		}		
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
开发者ID:arkiny,项目名称:C-Cpp-WinApi,代码行数:101,代码来源:TileMapDrawer.cpp

示例9: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static HWND  hwndList, hwndText ;
     int          iIndex, iLength, cxChar, cyChar ;
     TCHAR      * pVarName, * pVarValue ;

     switch (message)
     {
     case WM_CREATE :
          cxChar = LOWORD (GetDialogBaseUnits ()) ;
          cyChar = HIWORD (GetDialogBaseUnits ()) ;

               // Create listbox and static text windows.
          
          hwndList = CreateWindow (TEXT ("listbox"), NULL,
                              WS_CHILD | WS_VISIBLE | LBS_STANDARD,
                              cxChar, cyChar * 3,
                              cxChar * 16 + GetSystemMetrics (SM_CXVSCROLL),
                              cyChar * 5,
                              hwnd, (HMENU) ID_LIST,
                              (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE),
                              NULL) ;
          
          hwndText = CreateWindow (TEXT ("static"), NULL,
                              WS_CHILD | WS_VISIBLE | SS_LEFT,
                              cxChar, cyChar, 
                              GetSystemMetrics (SM_CXSCREEN), cyChar,
                              hwnd, (HMENU) ID_TEXT,
                              (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE),
                              NULL) ;

          FillListBox (hwndList) ;
          return 0 ;
          
     case WM_SETFOCUS :
          SetFocus (hwndList) ;
          return 0 ;
          
     case WM_COMMAND :
          if (LOWORD (wParam) == ID_LIST && HIWORD (wParam) == LBN_SELCHANGE)
          {
                    // Get current selection.

               iIndex  = SendMessage (hwndList, LB_GETCURSEL, 0, 0) ;
               iLength = SendMessage (hwndList, LB_GETTEXTLEN, iIndex, 0) + 1 ;
               pVarName = calloc (iLength, sizeof (TCHAR)) ;
               SendMessage (hwndList, LB_GETTEXT, iIndex, (LPARAM) pVarName) ;

                    // Get environment string.

               iLength = GetEnvironmentVariable (pVarName, NULL, 0) ;
               pVarValue = calloc (iLength, sizeof (TCHAR)) ;
               GetEnvironmentVariable (pVarName, pVarValue, iLength) ;

                    // Show it in window.
               
               SetWindowText (hwndText, pVarValue) ;
               free (pVarName) ;
               free (pVarValue) ;
          }
          return 0 ;

     case WM_DESTROY :
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:68,代码来源:Environ.c

示例10: window_procedure

LRESULT CALLBACK window_procedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_CREATE:
		{
			game.create_dc(GetDC(hWnd));

			int
				resolution_x = GetSystemMetrics(SM_CXSCREEN),
				resolution_y = GetSystemMetrics(SM_CYSCREEN);
			RECT window_rectangle;
			GetWindowRect(hWnd, &window_rectangle);
			int
				width = window_rectangle.right - window_rectangle.left,
				height = window_rectangle.bottom - window_rectangle.top;

			SetWindowPos(hWnd, HWND_TOP, (resolution_x - width) / 2, (resolution_y - height) / 2, 0, 0, SWP_NOSIZE);
			break;
		}

		case WM_ERASEBKGND:
			return 1;

		case WM_PAINT:
			game.process_frame(hWnd);
			break;

		/*
		case WM_TIMER:
			game.invalidate(hWnd);
			break;

		case WM_ERASEBKGND:
			return 1;

		case WM_PAINT:
			try
			{
				game_mutex.lock();
				game.process_frame(hWnd);
				game_mutex.unlock();
			}
			catch(std::exception const & exception)
			{
				MessageBox(hWnd, (std::string("The following exception has occured:\n\n\t") + exception.what() + "\n\nTerminating program.").c_str(), "Exception", MB_OK | MB_ICONERROR);
				run_timer = false;
				PostQuitMessage(WM_QUIT);
			}
			break;
			*/

		case WM_CLOSE:
		case WM_DESTROY:
			run = false;
			PostQuitMessage(WM_QUIT);
			break;

		case WM_LBUTTONDOWN:
			return DefWindowProc(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);

		case WM_KEYDOWN:
			game.process_key_down(wParam);
			break;

		case WM_KEYUP:
			game.process_key_up(wParam);
			break;
	}

	return DefWindowProc(hWnd, msg, wParam, lParam);
}
开发者ID:epicvrvs,项目名称:pong,代码行数:72,代码来源:main.cpp

示例11: OnCommand

void OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
    if (wParam == IDM_LOCK_NOW)
    {
        Lock(hWnd);
    }
    else if (wParam == IDM_BLACK_SCREEN)
    {
        CheckMenuRadioItem(g_hTrayMenu, IDM_BLACK_SCREEN, IDM_SCREENSHOT, 
            IDM_BLACK_SCREEN, MF_BYCOMMAND);
        g_enumMode = Black;
    }
    else if (wParam == IDM_TRANSPARENT)
    {
        CheckMenuRadioItem(g_hTrayMenu, IDM_BLACK_SCREEN, IDM_SCREENSHOT, 
            IDM_TRANSPARENT, MF_BYCOMMAND);
        g_enumMode = Transparent;
    }
    else if (wParam == IDM_TRANSPARENT_50)
    {
        CheckMenuRadioItem(g_hTrayMenu, IDM_BLACK_SCREEN, IDM_SCREENSHOT, 
            IDM_TRANSPARENT_50, MF_BYCOMMAND);
        g_enumMode = Transparent50;
    }
    if (wParam == IDM_SCREENSHOT)
    {
        CheckMenuRadioItem(g_hTrayMenu, IDM_BLACK_SCREEN, IDM_SCREENSHOT, 
            IDM_SCREENSHOT, MF_BYCOMMAND);
        g_enumMode = Screenshot;
    }
    if (wParam == IDM_AUTO_LOCK)
    {
        CheckMenuItem(g_hTrayMenu, IDM_AUTO_LOCK, MF_BYCOMMAND | 
            (!g_bAutoLock ? MF_CHECKED : MF_UNCHECKED));
        g_bAutoLock = !g_bAutoLock;
    }
    else if (wParam == IDM_SET_PASSWORD)
    {
        // 1. If HKCU\Software\ScreenLock does not exist, display the set password window
        // 2. If HKCU\Software\ScreenLock\Password does not exist, display the set password window
        // 3. Otherwise, display the modify password window
        HKEY hScreenLockKey;
        if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\ScreenLock", 
            0, KEY_QUERY_VALUE, &hScreenLockKey) != 0) // Key not exist
        {
            RegCloseKey(hScreenLockKey);
            DialogBoxParam(g_hInstance, "DLG_SET_PASSWORD", hWnd, ProcDlgSetPassword, 0);
        }
        else if (RegGetValue(hScreenLockKey, 0, "Password", 
            RRF_RT_REG_SZ, 0, 0, 0) != 0) // Value not exist
        {
            RegCloseKey(hScreenLockKey);
            DialogBoxParam(g_hInstance, "DLG_SET_PASSWORD", hWnd, ProcDlgSetPassword, 0);
        }
        else
        {
            DialogBoxParam(g_hInstance, "DLG_MODIFY_PASSWORD", hWnd, ProcDlgModifyPassword, 0);
        }
    }
    else if (wParam == IDM_SET_TIMEOUT)
    {
        DialogBoxParam(g_hInstance, "DLG_SET_TIMEOUT", hWnd, ProcDlgSetTimeout, 0);
    }
    else if (wParam == IDM_EXIT)
    {
        // Delete Tray Icon
        NOTIFYICONDATA nti; 

        nti.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(ICO_MAIN)); 
        nti.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE; 
        nti.hWnd = hWnd; 
        nti.uID = 0;
        nti.uCallbackMessage = WM_USER_TRAY; 
        strcpy_s(nti.szTip, sizeof(nti.szTip), "Screen Locker"); 

        Shell_NotifyIcon(NIM_DELETE, &nti);

        // Exit
        PostQuitMessage(0);
    }
}
开发者ID:shenminNJ,项目名称:win32-screen-locker,代码行数:81,代码来源:Main.cpp

示例12: WndProc

LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
	LRESULT  lRet = 1;
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (uMsg){
		case WM_CREATE:
			break;
		case WM_PAINT:
			ValidateRect(g_wnd, NULL);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		case WM_CHAR:
			break;
		case WM_LBUTTONDOWN:
		{
			POINT ptMouse;
			GetCursorPos(&ptMouse);
			ScreenToClient(g_wnd, &ptMouse);
			g_ptLastPoint = ptMouse;
		}
		break;
		case WM_RBUTTONDOWN:
		{
			GetCursorPos(&g_ptLastPoint);
			ScreenToClient(g_wnd, &g_ptLastPoint);
		break;
		}
		case WM_MOUSEMOVE:
		{
			switch (wParam)
			{
			case MK_LBUTTON:
			{

			}
			break;
			case MK_RBUTTON:
			{
			POINT pt;
			pt.x = LOWORD(lParam);
			pt.y = HIWORD(lParam);
			g_camera->SetRotAngleDelta((pt.y - g_ptLastPoint.y) / 150.0f, (pt.x - g_ptLastPoint.x) / 150.0f, 0.0f);
			g_ptLastPoint = pt;
			}
			default:
			break;
			}
			break;
			}
			case WM_KEYDOWN:
			{
			Vector *vcDirc = new Vector();
			Vector *vcUp = new Vector();
			Vector *vcRight = new Vector();
			g_camera->GetDirection(vcDirc, vcUp, vcRight);
			switch (wParam)
			{
			case VK_A:
			{
			g_camera->SetMoveDirection(*vcRight);
			g_camera->SetMoveDelta(-20.0f);

			g_camera->Update();
			Matrix matView;
			g_camera->GetViewMatrix(&matView);
			break;
			}
			case VK_D:
			{
			Vector vcPosCamera;
			g_camera->SetMoveDirection(*vcRight);
			g_camera->SetMoveDelta(20.0f);
			g_camera->Update();
			Matrix matView;
			g_camera->GetViewMatrix(&matView);
			break;
			}
			case VK_W:
			{
			g_camera->SetMoveDirection(*vcDirc);
			g_camera->SetMoveDelta(20.0f);

			g_camera->Update();
			Matrix matView;
			g_camera->GetViewMatrix(&matView);
			break;
			}
			case VK_S:
			{
			g_camera->SetMoveDirection(*vcDirc);
			g_camera->SetMoveDelta(-20.0f);

			g_camera->Update();
			Matrix matView;
			g_camera->GetViewMatrix(&matView);
			break;
//.........这里部分代码省略.........
开发者ID:arundev,项目名称:AREngine,代码行数:101,代码来源:win32.cpp

示例13: WndProc

LRESULT CALLBACK WndProc(	HWND	hWnd,			// Handle For This Window
							UINT	uMsg,			// Message For This Window
							WPARAM	wParam,			// Additional Message Information
							LPARAM	lParam)			// Additional Message Information
{
	switch (uMsg)									// Check For Windows Messages
	{
		case WM_ACTIVATE:							// Watch For Window Activate Message
		{
			if (!HIWORD(wParam))					// Check Minimization State
			{
				active=TRUE;						// Program Is Active
			}
			else
			{
				active=FALSE;						// Program Is No Longer Active
			}

			return 0;								// Return To The Message Loop
		}

		case WM_SYSCOMMAND:							// Intercept System Commands
		{
			switch (wParam)							// Check System Calls
			{
				case SC_SCREENSAVE:					// Screensaver Trying To Start?
				case SC_MONITORPOWER:				// Monitor Trying To Enter Powersave?
				return 0;							// Prevent From Happening
			}
			break;									// Exit
		}

		case WM_CLOSE:								// Did We Receive A Close Message?
		{
			PostQuitMessage(0);						// Send A Quit Message
			return 0;								// Jump Back
		}

		case WM_LBUTTONDOWN:
		{
			gleft=TRUE;
			return 0;
		}

		case WM_LBUTTONUP:
		{
			gleft=FALSE;
			return 0;
		}

		case WM_RBUTTONDOWN:
		{
			gright=TRUE;
			return 0;
		}

		case WM_RBUTTONUP:
		{
			gright=FALSE;
			return 0;
		}

		case WM_KEYDOWN:							// Is A Key Being Held Down?
		{
			keys[wParam] = TRUE;					// If So, Mark It As TRUE
			return 0;								// Jump Back
		}

		case WM_KEYUP:								// Has A Key Been Released?
		{
			keys[wParam] = FALSE;					// If So, Mark It As FALSE
			return 0;								// Jump Back
		}

		case WM_SIZE:								// Resize The OpenGL Window
		{
			b1.ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));  // LoWord=Width, HiWord=Height
			return 0;								// Jump Back
		}

		case WM_MOUSEMOVE:
		{
			mousex=LOWORD(lParam);
			mousey=HIWORD(lParam);
			return 0;
		}
	}

	// Pass All Unhandled Messages To DefWindowProc
	return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
开发者ID:featherless,项目名称:2003-JetPack-Jack,代码行数:91,代码来源:Main.cpp

示例14: WndProc

static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
  switch (uMessage)
    {
    case WM_PAINT:
      {
	PAINTSTRUCT ps;
	BeginPaint(hwnd, &ps);
	SetMapMode(ps.hdc, MM_ANISOTROPIC);
	/* Set the window extent to a sane value in case the metafile doesn't */
	SetWindowExtEx(ps.hdc, width, height, NULL);
	SetViewportExtEx(ps.hdc, width, height, NULL);
	SetViewportOrgEx(ps.hdc, deltax, deltay, NULL);
       if (isEnhanced && enhmf)
       {
           RECT r;
           GetClientRect(hwnd, &r);
           PlayEnhMetaFile(ps.hdc, enhmf, &r);
       }
       else if (hmf)
           PlayMetaFile(ps.hdc, hmf);
	EndPaint(hwnd, &ps);
      }
      break;

    case WM_COMMAND: /* message: command from application menu */
        switch (LOWORD(wparam))
	{
	case IDM_OPEN:
	  {
              WCHAR filename[MAX_PATH];
              if (FileOpen(hwnd, filename, sizeof(filename)/sizeof(WCHAR)))
              {
                  szFileTitle[0] = 0;
                  GetFileTitleW(filename, szFileTitle, sizeof(szFileTitle)/sizeof(WCHAR));
                  DoOpenFile(filename);
                  UpdateWindowCaption();
              }
	  }
	  break;

	case IDM_SET_EXT_TO_WIN:
	  {
	    RECT r;
	    GetClientRect(hwnd, &r);
	    width = r.right - r.left;
	    height = r.bottom - r.top;
	    deltax = deltay = 0;
	    InvalidateRect( hwnd, NULL, TRUE );
	  }
	  break;


	case IDM_LEFT:
	  deltax += 100;
	  InvalidateRect( hwnd, NULL, TRUE );
	  break;
	case IDM_RIGHT:
	  deltax -= 100;
	  InvalidateRect( hwnd, NULL, TRUE );
	  break;
	case IDM_UP:
	  deltay += 100;
	  InvalidateRect( hwnd, NULL, TRUE );
	  break;
	case IDM_DOWN:
	  deltay -= 100;
	  InvalidateRect( hwnd, NULL, TRUE );
	  break;

	case IDM_EXIT:
	  DestroyWindow(hwnd);
	  break;

	default:
	  return DefWindowProcW(hwnd, uMessage, wparam, lparam);
	}
      break;

    case WM_DESTROY:  /* message: window being destroyed */
      PostQuitMessage(0);
      break;

    default:          /* Passes it on if unprocessed */
      return DefWindowProcW(hwnd, uMessage, wparam, lparam);
    }
    return 0;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:88,代码来源:view.c

示例15: MainWndProc


//.........这里部分代码省略.........
	KeyDown(wParam, lParam);
	break;

	// Buttons

    case WM_COMMAND:
	switch (LOWORD(wParam))
	{
	    // Sine
	case SINE_ID:
	    audio.waveform = SINE;
	    break;

	    // Square

	case SQUARE_ID:
	    audio.waveform = SQUARE;
	    break;

	    // Sawtooth

	case SAWTOOTH_ID:
	    audio.waveform = SAWTOOTH;
	    break;

	    // Mute

	case MUTE_ID:
	    audio.mute = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0);
	    break;

	    // Quit

	case QUIT_ID:
	    waveOutReset(audio.hwo);
	    waveOutClose(audio.hwo);
	    PostQuitMessage(0);
	    break;
	}

	// Set the focus back to the window

	SetFocus(hWnd);
	break;

	// Slider change

    case WM_VSCROLL:
	SliderChange(wParam, lParam);

	// Set the focus back to the window

	SetFocus(hWnd);
	break;

	// Set the focus back to the window by clicking

    case WM_LBUTTONDOWN:
    case WM_MBUTTONDOWN:
	SetFocus(hWnd);
	break;

    case WM_RBUTTONDOWN:
	// Not used
	break;

	// Notify

    case WM_NOTIFY:
	switch (((LPNMHDR)lParam)->code)
	{
	    // Tooltip

	case TTN_SHOW:
	    TooltipShow(wParam, lParam);
	    break;

	case TTN_POP:
	    TooltipPop(wParam, lParam);
	    break;
	}
	break;

        // Process other messages.

    case WM_DESTROY:

	PostQuitMessage(0);
	waveOutReset(audio.hwo);
	waveOutClose(audio.hwo);
	break;

	// Everything else

    default:
	return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }

    return 0;
}
开发者ID:Climberirw,项目名称:audiotools,代码行数:101,代码来源:SigGen.c


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