コード例 #1
0
ファイル: aokts.cpp プロジェクト: mwhiter/aokts
INT_PTR CALLBACK MainDlgProc(HWND sheet, UINT msg, WPARAM wParam, LPARAM lParam)
{
	INT_PTR ret = FALSE;

	switch (msg)
	{
	case WM_CLOSE:
		DestroyWindow(sheet);
		return CALLPROC();

	case WM_SYSCOMMAND:
		//the overloaded DialogProc screwes up the automatic SC_CLOSE translation to WM_CLOSE
		if (wParam == SC_CLOSE)
			DestroyWindow(sheet);
		else
			return CALLPROC();
		break;

	case WM_COMMAND:
		ret = 0;	//processing message
		Sheet_HandleCommand(sheet, HIWORD(wParam), LOWORD(wParam), (HWND)lParam);
		CALLPROC();
		break;

	case WM_DESTROY:
		{
		    SendMessage(
			    PropSheet_GetCurrentPageHwnd(sheet),
			    AOKTS_Closing, 0, 0);
			WinHelp(sheet, "ts.hlp", HELP_QUIT, 0);
			PostQuitMessage(0);
		}
		return CALLPROC();

	case WM_HELP:
		WinHelp(sheet, "ts.hlp", HELP_CONTENTS, 0);
		break;

	case WM_MENUSELECT:
		OnMenuSelect(LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
		break;

	case MAP_Close:
		CheckMenuItem(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND | MF_UNCHECKED);
		propdata.mapview = NULL;
		break;

	case MAP_Click:
		SendMessage(
			PropSheet_GetCurrentPageHwnd(sheet),
			MAP_Click, wParam, lParam);
		break;

	default:
		return CALLPROC();
	}

	return ret;
}
コード例 #2
0
ファイル: MenuTipper.cpp プロジェクト: Sp1l/pwsafe
//////////////////
// Override CSubclassWnd::WindowProc to hook messages on behalf of
// main window.
//
LRESULT CMenuTipManager::WindowProc(UINT msg, WPARAM wp, LPARAM lp)
{
  if (msg == WM_MENUSELECT) {
    OnMenuSelect(LOWORD(wp), HIWORD(wp), (HMENU)lp);
  } else if (msg==WM_ENTERIDLE) {
    OnEnterIdle(wp, (HWND)lp);
  }
  return CSubclassWnd::WindowProc(msg, wp, lp);
}
コード例 #3
0
ファイル: framewnd.c プロジェクト: Moteesh/reactos
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_CREATE:
        // For now, the Help dialog item is disabled because of lacking of HTML Help support
        EnableMenuItem(GetMenu(hWnd), ID_HELP_HELPTOPICS, MF_BYCOMMAND | MF_GRAYED);
        CreateWindowExW(0, szChildClass, NULL, WS_CHILD | WS_VISIBLE,
                       CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                       hWnd, (HMENU)0, hInst, 0);
        break;
    case WM_COMMAND:
        if (!_CmdWndProc(hWnd, message, wParam, lParam))
            return DefWindowProcW(hWnd, message, wParam, lParam);
        break;
    case WM_ACTIVATE:
        if (LOWORD(hWnd) && g_pChildWnd)
            SetFocus(g_pChildWnd->hWnd);
        break;
    case WM_SIZE:
        resize_frame_client(hWnd);
        break;
    case WM_TIMER:
        break;
    case WM_INITMENU:
        OnInitMenu(hWnd);
        break;
    case WM_ENTERMENULOOP:
        OnEnterMenuLoop(hWnd);
        break;
    case WM_EXITMENULOOP:
        OnExitMenuLoop(hWnd);
        break;
    case WM_MENUSELECT:
        OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
        break;
    case WM_SYSCOLORCHANGE:
        /* Forward WM_SYSCOLORCHANGE to common controls */
        SendMessageW(g_pChildWnd->hListWnd, WM_SYSCOLORCHANGE, 0, 0);
        SendMessageW(g_pChildWnd->hTreeWnd, WM_SYSCOLORCHANGE, 0, 0);
        break;
    case WM_DESTROY:
        WinHelpW(hWnd, getAppName(), HELP_QUIT, 0);
        SaveSettings();
        PostQuitMessage(0);
    default:
        return DefWindowProcW(hWnd, message, wParam, lParam);
    }
    return 0;
}
コード例 #4
0
ファイル: framewnd.c プロジェクト: HBelusca/NasuTek-Odyssey
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_CREATE:
        CreateWindowEx(0, szChildClass, NULL, WS_CHILD | WS_VISIBLE,
                       CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                       hWnd, (HMENU)0, hInst, 0);
        break;
    case WM_COMMAND:
        if (!_CmdWndProc(hWnd, message, wParam, lParam))
            return DefWindowProc(hWnd, message, wParam, lParam);
        break;
    case WM_ACTIVATE:
        if (LOWORD(hWnd))
            SetFocus(g_pChildWnd->hWnd);
        break;
    case WM_SIZE:
        resize_frame_client(hWnd);
        break;
    case WM_TIMER:
        break;
    case WM_INITMENU:
        OnInitMenu(hWnd);
        break;
    case WM_ENTERMENULOOP:
        OnEnterMenuLoop(hWnd);
        break;
    case WM_EXITMENULOOP:
        OnExitMenuLoop(hWnd);
        break;
    case WM_MENUSELECT:
        OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
        break;
    case WM_SYSCOLORCHANGE:
        /* Forward WM_SYSCOLORCHANGE to common controls */
        SendMessage(g_pChildWnd->hListWnd, WM_SYSCOLORCHANGE, 0, 0);
        SendMessage(g_pChildWnd->hTreeWnd, WM_SYSCOLORCHANGE, 0, 0);
        break;
    case WM_DESTROY:
        WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
        PostQuitMessage(0);
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
コード例 #5
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 改变语言
VOID CMainWnd::OnViewLanguage(UINT uLang)
{
#ifdef _MAKELANG
	// 保存常规字符串
	LNG_Description; LNG_Copyright; LNG_Ready; LNG_Version; LNG_Build;
	LNG_CheckUpdate; LNG_CancelUpdate; LNG_VisitWeb; LNG_WriteEmail;
	LNG_CheckUpdateTip; LNG_VisitWebTip; LNG_WriteEmailTip;
	LNG_BitLiveCheck; LNG_BitLiveUpdate; LNG_BitLiveUpToDate; LNG_BitLiveCheckErr; LNG_BitLiveUpdateErr;
	LNG_BitLiveRecieve; LNG_BitLiveRecvPercent; LNG_BitLiveConfirm;

	LNG_ExportFilter; LNG_BrowseFolder;
	LNG_OpenErr; ERR_HelpErr; LNG_CreateShortcutErr; LNG_RemoveShortcutErr;
	LNG_ExportErr; LNG_AddToVSErr; LNG_RemoveFromVSErr; LNG_InputErr; LNG_UnexpectedErr; LNG_DirectDrawErr;
	LNG_CreateShortcutMsg; LNG_RemoveShortcutMsg; LNG_ConvertMsg; LNG_ExportMsg; LNG_AddToVSMsg; LNG_RemoveFromVSMsg;
	LNG_ColorSpaceMsg; LNG_FrameWidthMsg; LNG_FrameHeightMsg; LNG_FrameRateMsg; LNG_FrameStepMsg; LNG_FrameIndexeMsg;
	
	// 保存资源字符串
	for (INT i = IDM_File_Open; i <= IDM_Help_About; i++)
	{
		CLanguage::TranslateString(i);
	}

	// 保存菜单
	CLanguage::TranslateMenu(m_hMenu, MAKEINTRESOURCE(IDR_Menu));

	// 保存对话框字符串
	PostMessage(m_hWnd, WM_COMMAND, IDM_File_Open, 0);

#else

	// 设置语言
	CLanguage::Set(m_hMenu, uLang);

	// 翻译菜单
	OnCommand(IDM_Window_Cascade);
	CLanguage::TranslateMenu(m_hMenu, MAKEINTRESOURCE(IDR_Menu));
	DrawMenuBar(m_hWnd);

	// 设置状态栏
	OnMenuSelect(uLang);

#endif
}
コード例 #6
0
ファイル: CoolMenu.cpp プロジェクト: ZhaoboMeng/k-line-print
//////////////////
// Virtual CSubclassWnd window proc. All messages come here before frame
// window. Isn't it cool? Just like in the old days!
//
LRESULT CCoolMenuManager::WindowProc(UINT msg, WPARAM wp, LPARAM lp)
{
	switch(msg) {
	case WM_SYSCOLORCHANGE:
	case WM_SETTINGCHANGE:
		Refresh();
		break;

	case WM_MEASUREITEM:
		if (OnMeasureItem((MEASUREITEMSTRUCT*)lp))
			return TRUE; // handled
		break;

	case WM_DRAWITEM:
		if (OnDrawItem((DRAWITEMSTRUCT*)lp))
			return TRUE; // handled
		break;

	case WM_INITMENUPOPUP:
		// Very important: must let frame window handle it first!
		// Because if someone calls CCmdUI::SetText, MFC will change item to
		// MFT_STRING, so I must change back to MFT_OWNERDRAW.
		//
		CSubclassWnd::WindowProc(msg, wp, lp);
		OnInitMenuPopup(CMenu::FromHandle((HMENU)wp),
			(UINT)LOWORD(lp), (BOOL)HIWORD(lp));
		return 0;

	case WM_MENUSELECT:
		OnMenuSelect((UINT)LOWORD(wp), (UINT)HIWORD(wp), (HMENU)lp);
		break;
	
	case WM_MENUCHAR:
		LRESULT lr = OnMenuChar((TCHAR)LOWORD(wp), (UINT)HIWORD(wp),
			CMenu::FromHandle((HMENU)lp));
		if (lr!=0)
			return lr;
		break;
	}
	return CSubclassWnd::WindowProc(msg, wp, lp);
}
コード例 #7
0
ファイル: Menu.cpp プロジェクト: kento1218/TVTest
bool CChannelMenu::HandleMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT *pResult)
{
	if (m_hwnd==NULL || hwnd!=m_hwnd)
		return false;

	switch (uMsg) {
	case WM_MEASUREITEM:
		if (OnMeasureItem(hwnd,wParam,lParam)) {
			*pResult=TRUE;
			return true;
		}
		break;

	case WM_DRAWITEM:
		if (OnDrawItem(hwnd,wParam,lParam)) {
			*pResult=TRUE;
			return true;
		}
		break;

	case WM_UNINITMENUPOPUP:
		if (OnUninitMenuPopup(hwnd,wParam,lParam)) {
			*pResult=0;
			return true;
		}
		break;

	case WM_MENUSELECT:
		if (OnMenuSelect(hwnd,wParam,lParam)) {
			*pResult=0;
			return true;
		}
		break;
	}

	return false;
}
コード例 #8
0
Boolean  TAboutForm::EventHandler(TApplication  *  appP, EventType  *  eventP)
{
	Boolean     handled = FALSE;

	switch(eventP->eType)
	{
	case EVENT_WinPaint:
		{
			DrawWindow();
			handled = TRUE;
			break;
		}
	case EVENT_CtrlSelect:
		{
			if(m_BackBtn == eventP->sParam1)
			{
				handled = TRUE; 
				this->CloseWindow();

				return handled;
			}

			switch(eventP->sParam1)
			{
			case RES_SYSTEM_WINDOW_TITLE_BUTTON_ID:
				{
					handled = TRUE; 
					if(handled == TRUE)
					{
						handled = FALSE;
					}
					else
						handled = TRUE;
				}
				break;
			default:
				{	
					return OnCtlSelect(GetControlPtr(eventP->sParam1),eventP);
				}
				break;
			}
		}
		break;
	case EVENT_WinEraseClient:
		{
			TDC 	   dc(this);
			WinEraseClientEventType *pEraseEvent = reinterpret_cast< WinEraseClientEventType* >( eventP );
			TRectangle rc(pEraseEvent->rc);
			TRectangle rcBack(5, 142, 310, 314);
			this->GetBounds(&rcBack);

			// 刷主窗口背景色
			dc.SetBackColor(RGB_COLOR_WHITE);

			// 擦除
			dc.EraseRectangle(&rc, 0);

			dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_title_bg), 0, 0, SCR_W, GUI_API_STYLE_ALIGNMENT_LEFT);

			//dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_bottom_bg), 0, rcBack.Bottom()-68, 
			//320, GUI_API_STYLE_ALIGNMENT_LEFT|GUI_API_STYLE_ALIGNMENT_TOP); 


			pEraseEvent->result = 1;				
			handled = TRUE;
		}
		break;

	case EVENT_MenuSelect:
		{
			handled = OnMenuSelect(eventP->sParam1);			
		}
		break;
	case EVENT_CtrlContextMenu:
		{
			handled = OnCtlContextMenu(eventP);			
			break;
		}
	case EVENT_MenuOpen:
		{
			OnBeforeMenuOpen();
		}
		break;
	case EVENT_WinInit:
		{
			OnWinCreate();
		}
		break;
	case EVENT_WinClose:
		{
			handled = TRUE; 
			OnClosed();
			if(handled)
				handled = FALSE;
			else 
				handled = TRUE;
		}
		break;	
	case EVENT_KeyCommand: 
		{ 
			// 抓取右软键事件 
			if (eventP->sParam1 == SYS_KEY_SOFTKEY_RIGHT_UP  
				|| eventP->sParam1 == SYS_KEY_SOFTKEY_RIGHT_LONG) 
			{ 
				// 模拟退出按钮选中消息 
				HitControl(m_BackBtn); 
				handled = TRUE; 
			} 
		} 
		break;	

	}
	if (handled == FALSE)
		return TWindow::EventHandler(appP,eventP);

	return handled;
}
コード例 #9
0
/*----------------------------------------------------------------------------------------------
	Non-virtual window proc to call standard message handlers.  All handlers should be virtual.
	WARNING: This method is also called for dialogs.

	@param wm Windows message identifier.
	@param wp First message parameter.
	@param lp Second message parameter.
	@param lnRet Value to be returned to the system.  (return value for window procedure)

	@return true to prevent the message from being sent to other windows.
----------------------------------------------------------------------------------------------*/
bool AfWnd::FWndProcPre(uint wm, WPARAM wp, LPARAM lp, long & lnRet)
{
	AssertObj(this);

	bool fRet;

	switch (wm)
	{
	case WM_SYSCOLORCHANGE:
		// In an ActiveX control we may have no Papp().
		// It's a bit unusual to be handling a command in that situation, but it can happen.
		if (!AfApp::Papp())
			return false;
		// Push a color change command and enqueue a command indicating that we're done
		// processing color change messages.
		// NOTE: We get one of these per top level window.
		AfApp::Papp()->PushCid(kcidColorChange, this, wp, lp);
		AfApp::Papp()->EnqueueCid(kcidEndColorChange, this, wp, lp);
		return false;

	case WM_SETTINGCHANGE:
		// In an ActiveX control we may have no Papp().
		// It's a bit unusual to be handling a command in that situation, but it can happen.
		if (!AfApp::Papp())
			return false;
		// Push a color setting command and enqueue a command indicating that we're done
		// processing setting change messages.
		// NOTE: We may get many of these per top level window.
		AfApp::Papp()->PushCid(kcidSettingChange, this, wp, lp);
		AfApp::Papp()->EnqueueCid(kcidEndSettingChange, this, wp, lp);
		return false;

	case WM_MEASUREITEM:
		// Handle menu items.
		if (!wp && AfApp::GetMenuMgr(&m_pmum)->OnMeasureItem((MEASUREITEMSTRUCT *)lp))
			return true;
		return OnMeasureChildItem((MEASUREITEMSTRUCT *)lp);

	case WM_DRAWITEM:
		// Handle menu items.
		if (!wp && AfApp::GetMenuMgr(&m_pmum)->OnDrawItem((DRAWITEMSTRUCT *)lp))
			return true;
		return OnDrawChildItem((DRAWITEMSTRUCT *)lp);

	case WM_INITMENUPOPUP:
		// LOWORD(lp) specifies the zero-based relative position of the menu item that opens the
		// drop-down menu or submenu.
		// HIWORD(lp) If the menu is the window menu, this is TRUE; otherwise, it is FALSE.
		if (HIWORD(lp) == 0) // Ignore system menus.
		{
			AfApp::GetMenuMgr(&m_pmum)->ExpandMenuItems((HMENU)wp, LOWORD(lp));
		}
		return OnInitMenuPopup((HMENU)wp, LOWORD(lp), HIWORD(lp) != 0);

	case WM_MENUSELECT:
		if (!lp && HIWORD(wp) == 0xFFFF)
		{
			// Menu was closed if it had been open.
			AfApp::GetMenuMgr(&m_pmum)->OnMenuClose();
			AfMainWnd * pafw = MainWindow();
			if (pafw)
				pafw->SetContextInfo(NULL, MakePoint(0));
		}
		return OnMenuSelect((int)LOWORD(wp), (UINT)HIWORD(wp), (HMENU)lp);

	case WM_MENUCHAR:
		lnRet = AfApp::GetMenuMgr(&m_pmum)->OnMenuChar((achar)LOWORD(wp), (HMENU)lp);
		return lnRet != 0;

	case WM_PAINT:
		return OnPaint((HDC)wp);

	case WM_SIZE:
		fRet = OnSize(wp, LOWORD(lp), HIWORD(lp));
		OnClientSize();
		return fRet;

	case WM_COMMAND:
		return OnCommand(LOWORD(wp), HIWORD(wp), (HWND)lp);

	case WM_NOTIFY:
		return OnNotifyChild(wp, (NMHDR *)lp, lnRet);

	case WM_SETFOCUS:
		return OnSetFocus();

	case WM_CONTEXTMENU:
		return OnContextMenu((HWND)wp, MakePoint(lp));
	}

	// Keep passing the message.
	return false;
}
コード例 #10
0
ファイル: CMainWnd.cpp プロジェクト: ifplusor/SAUGamePlatform
LRESULT CMainWnd::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	//创建窗口后先发送WM_CREATE消息创建控件,再发送WM_ERASEBKGND消息擦除背景,然后发送WM_SIZE消息调整窗口大小,发送WM_PAINT消息进行重绘
	switch (uMsg)
	{
	case WM_CREATE:
		OnCreate(hWnd, wParam, lParam);
		break;
	case WM_PAINT:
		OnPaint(wParam, lParam);//绘制消息		
		break;
	case WM_ERASEBKGND:
		return OnEraseBkgnd(wParam, lParam);
	case WM_SIZE:
		OnSize(wParam, lParam);//大小改变消息
		break;
	case WM_MOVE:
		GetWindowRect(hWnd, &rtWindow);//获取整个主窗体的窗口矩形
		GetClientRectEx(&rtClient);//获取主窗体客户区的矩形
		break;
	case WM_NOTIFY:
		OnNotify(wParam, lParam);//子窗体通知消息
		break;
	case WM_COMMAND:
		OnCommand(wParam, lParam);//菜单或者按钮控件消息
		break;
	case WM_MENUSELECT:
		OnMenuSelect(wParam, lParam);	//菜单选择消息			
		break;
	case WM_LBUTTONDOWN:
		OnLButtonDown(wParam, lParam);//左键单击消息
		break;
	case WM_LBUTTONDBLCLK:
		OnLButtonDbClick(wParam, lParam);//左键双击消息
		break;
	case WM_RBUTTONDOWN:
		OnRButtonDown(wParam, lParam);//右键单击消息
		break;
	case WM_MOUSEMOVE:
		OnMouseMove(wParam, lParam);//鼠标移动消息
		break;
	case WM_KEYDOWN:
		OnKeyDown(wParam, lParam);//键盘按键消息
		break;
	case WM_TIMER:
		OnTimer(wParam, lParam);//定时器消息
		break;
	case WM_CLOSE:
		OnClose(wParam, lParam);	//关闭窗体消息
		break;//用户点击关闭按钮时,不需要系统来处理
	case WM_DESTROY:
		OnDestroy(wParam, lParam);		//破坏窗体消息
		break;

		//自定义消息
	case GM_NAME://设置引擎名
		SetName((char*)wParam, (int)lParam);
		break;
	case GM_SHOWSTEP://显示着法信息(由其中支持模块发送)
		AppendStepHis((char*)wParam);
		Function::SaveBoardShot();
		Function::SaveChessManual((char*)wParam);
		break;
	case GM_WINLOSE:
		Function::GameStop();
		ShowWiner((int)lParam);
		break;

	default:
		return DefWindowProc(hWnd, uMsg, wParam, lParam);//处理不完全的消息或者其它消息统一由系统处理		
	}
	return 0;
}
コード例 #11
0
ファイル: WinQLMenuController.cpp プロジェクト: chenbk85/QOR
	//--------------------------------------------------------------------------------
	bool CMenuController::ProcessMessage( COSWindow& Window, Cmp_long_ptr& lResult, unsigned int uMsg, Cmp_uint_ptr wParam, Cmp_long_ptr lParam )
	{
		_WINQ_FCONTEXT( "CMenuController::ProcessMessage" );

		bool bProcessed = ProcessHook( Window, lResult, uMsg, wParam, lParam );

		switch ( uMsg )
		{
		case COSWindow::wmContextMenu:
			{
				COSWindow::refType refWnd = COSWindow::FromHandle( CWindowHandle( 0, (void*)(wParam) ).Ref() );
				unsigned short wXPos = LoWord( lParam );
				unsigned short wYPos = HiWord( lParam );
				OnContextMenu( Window, refWnd, wXPos, wYPos );
				bProcessed = true;
			}
			break;
		case COSWindow::wmInitMenu:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)(wParam) ).Ref() );
				OnInitMenu( Window, refMenu );
				lResult = 0;
				bProcessed = true;
			}
			break;
		case COSWindow::wmInitMenuPopup:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( wParam ) ).Ref() );
				unsigned short wPos = LoWord( lParam );
				int bWindowMenu = static_cast< int >( HiWord( lParam ) );
				OnInitMenuPopup( Window, refMenu, wPos, bWindowMenu ? true : false );
				lResult = 0;
				bProcessed = true;
			}
			break;
#if		( WINVER >= 0x0500 )
		case COSWindow::wmUninitMenuPopup:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)(wParam) ).Ref() );
				unsigned short wDestroyedMenu = HiWord( lParam );
				OnDestroyedMenuPopup( Window, refMenu, wDestroyedMenu );
				bProcessed = true;
			}
			break;
#endif//( WINVER >= 0x0500 )
		case COSWindow::wmMenuSelect:
			{
				unsigned short wIndex = LoWord( wParam );
				unsigned short wFlags = HiWord( wParam );
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() );
				OnMenuSelect( Window, refMenu, wIndex, wFlags );
				lResult = 0;
				bProcessed = true;
			}
			break;
		case COSWindow::wmMenuChar:
			{
				unsigned short wCharCode = LoWord( wParam );
				unsigned short wMenuType = HiWord( wParam );
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() );
				lResult = OnMenuChar( Window, refMenu, wCharCode, wMenuType );
				bProcessed = true;
			}
			break;
		case COSWindow::wmNextMenu:
			{
				MDINextMenu* pNextMenu = reinterpret_cast< MDINextMenu* >( lParam );

				CMenu::refType refMenuIn = CMenu::FromHandle( CMenuHandle( 0, (void*)( pNextMenu->hmenuIn ) ).Ref() );
				CMenu::refType refMenuNext = CMenu::FromHandle( CMenuHandle( 0, (void*)( pNextMenu->hmenuNext ) ).Ref() );

				OnNextMenu( Window, wParam, refMenuIn, refMenuNext );
				bProcessed = true;
			}
			break;
#if		( WINVER >= 0x0500 )
		case COSWindow::wmMenuGetObject:
			{
				MenuGetObjectInfo* pMenuObjectInfo = reinterpret_cast< MenuGetObjectInfo* >( lParam );
				lResult = OnGetObject( Window, pMenuObjectInfo );
				bProcessed = true;
			}
			break;
		case COSWindow::wmMenuRButtonUp:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() );
				OnRButtonUp( Window, refMenu, wParam );
				bProcessed = true;
			}
			break;
		case COSWindow::wmMenuCommand:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() );

				unsigned short wItemID = static_cast< unsigned short >( -1 );
				int iIndex = 0;

				if( System().Information(QOR_PP_SHARED_OBJECT_ACCESS).IsWindows98orME() )
				{
					wItemID = LoWord( wParam );
					iIndex = static_cast< int >( HiWord( wParam ) );
				}
				else
				{
					iIndex = wParam;
				}

				OnMenuCommand( Window, refMenu, iIndex, wItemID );

				bProcessed = true;
			}
			break;
		case COSWindow::wmMenuDrag:
			{
				CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() );
				lResult = OnMenuDrag( Window, refMenu, static_cast< unsigned short >( wParam ) );
				bProcessed = true;
			}
			break;
#endif//( WINVER >= 0x0500 )
		case COSWindow::wmCommand:
			{
				unsigned short wCode = HiWord( wParam );
					
				if( wCode == 0 )
				{
					unsigned short wMenuID = LoWord( wParam );						
					OnCommand( Window, wMenuID );
					lResult = 0;
					bProcessed = true;
				}
			}
			break;
		}

		return bProcessed;
	}
コード例 #12
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 回调函数
LRESULT CALLBACK CMainWnd::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CChildWnd *pWnd;
	TCHAR tzTemp[MAX_PATH];

	switch (uMsg)
	{
	case WM_CREATE:
		// 窗口被创建
		m_hWnd = hWnd;
		m_hMenu = GetMenu(m_hWnd);
		OnCreate();
		break;

	case WM_SIZE:
		// 尺寸改变
		OnSize(wParam, lParam);
		return 0;

	case WM_WINDOWPOSCHANGED:
		// 位置改变
		for (pWnd = CChildWnd::m_pHead; pWnd; pWnd = pWnd->m_pNext)
		{
			if (pWnd->m_hWnd)
			{
				pWnd->SetDrawRect();
			}
		}
		break;

	case WM_INITMENUPOPUP:
		// 弹出菜单初始化
		OnMenuPopup(wParam, lParam);
		break;

	case WM_MENUSELECT:
		// 菜单项被选择
		OnMenuSelect(LOWORD(wParam));
		break;

	case WM_EXITMENULOOP:
		// 退出菜单循环
		CClientWnd::SetStatusText(LNG_Ready);
		break;

	case WM_COMMAND:
		// 命令处理
		OnCommand(wParam, lParam);
		break;

	case WM_COPYDATA:
		// 本程序的其它实例通知打开文件
		if (((PCOPYDATASTRUCT) lParam)->dwData == IDM_File_Open)
		{
			static TCHAR s_tzFileName[MAX_PATH];

			lstrcpyn(s_tzFileName, (PTSTR) ((PCOPYDATASTRUCT) lParam)->lpData, MAX_PATH);
			PostMessage(m_hWnd, WM_COMMAND, IDM_File_Open, (LPARAM) s_tzFileName);
		}
		break;

	case WM_HOTKEY:
		// 热键消息
		if ((m_hWnd != GetForegroundWindow()) && (wParam == IDC_TrayIcon))
		{
			OnTrayIcon(FALSE);
		}
		break;

	case WM_DROPFILES:
		// 拖动文件
		DragQueryFile((HDROP) wParam, 0, tzTemp, MAX_PATH);
		DragFinish((HDROP) wParam);
		OnFileOpen(tzTemp);
		break;

	case WM_HELP:
		// 帮助
		OnCommand(IDM_Help_Content);
		break;

	case WM_DESTROY:
		// 窗口被销毁
		OnDestroy();
		break;
	}

	return DefFrameProc(hWnd, CClientWnd::m_hWnd, uMsg, wParam, lParam);
}