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


C++ DrawMenuBar函数代码示例

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


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

示例1: GetMenu

void SAX::OnUpdateMenu(CCmdUI* pCmdUI)
{
   CMenu *pMainMenu = GetMenu();
   if (pMainMenu)
   {
      const MenuId2CmdNum* pmi2cn;
      for (pmi2cn = g_MenuId2CmdNum; pmi2cn->id; ++pmi2cn)
      {
         // Update for menu items that are either checked or unchecked
         if (m_sbpro.IsMenuCommandChecked(pmi2cn->cmd))
            pMainMenu->CheckMenuItem(pmi2cn->id, MF_CHECKED);
         else
            pMainMenu->CheckMenuItem(pmi2cn->id, MF_UNCHECKED);

         // Update for menu items that are either enabled or disabled
         if (m_sbpro.IsMenuCommandEnabled(pmi2cn->cmd))
            pMainMenu->EnableMenuItem(pmi2cn->id, MF_ENABLED);
         else
            pMainMenu->EnableMenuItem(pmi2cn->id, MF_GRAYED);
      }
   }

   DrawMenuBar();
}
开发者ID:mpatwa,项目名称:CCEtoODB_Translator,代码行数:24,代码来源:SAX.cpp

示例2: SpellsExit

/*
 * SpellsExit:  Free spells when game exited.
 */
void SpellsExit(void)
{
   int i;

   for (i=0; i < num_schools; i++)
   {
      if (submenus[i])
	 DestroyMenu(submenus[i]);
   }

   // Remove "Spells" menu
   if (spell_menu != NULL)
   {
      RemoveMenu(cinfo->main_menu, MENU_POSITION_SPELLS, MF_BYPOSITION);
      DrawMenuBar(cinfo->hMain);
      DestroyMenu(spell_menu);
   }

   spell_menu = NULL;

   SafeFree(submenus);
   submenus = NULL;
   FreeSpells();
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:27,代码来源:spells.c

示例3: text_OnMDIActivate

static void text_OnMDIActivate(
  HWND hwnd, 
  BOOL active, 
  HWND hActivate, 
  HWND hDeactivate)
  {
#if WIN_MCW
#pragma unused(hActivate)
#pragma unused(hDeactivate)
#endif
   CheckMenuItem(TextMenu,GetWindowWord(hwnd,0), 
                 (unsigned) (active ? MF_CHECKED : MF_UNCHECKED));
                 
   if (active)
     {
      text_OnUpdateMenu(hwnd,GetMenu(hMainFrame));
      if (FORWARD_WM_MDISETMENU(MDIClientWnd,TRUE,TextMenu,
                                TextWindowMenu,SendMessage) != 0)
        {
         DrawMenuBar(hMainFrame);
         PostMessage(hMainFrame,UWM_UPDATE_TOOLBAR,0,0);
        }
     }
  }
开发者ID:atrniv,项目名称:CLIPS,代码行数:24,代码来源:Text.c

示例4: mh_addsubitem

static int mh_addsubitem (lua_State* l) {
menu* m = lua_touserdata(l,1);
if (!m->sub) return 0;
int k = 2, pos = 0;
if (lua_isnumber(l,k)) pos = lua_tointeger(l,k++);
if (pos==0) pos=-1;
else if (pos>0) pos--;
else if (pos<-1) pos += GetMenuItemCount(m->menu);
const char* str = luaL_checkstring(l,k++);
const wchar_t* wstr = strcvt(str, CP_UTF8, CP_UTF16, NULL);
HMENU h = CreateMenu();
InsertMenu(m->menu, pos, MF_BYPOSITION | MF_STRING | MF_POPUP, h, wstr);
DrawMenuBar(win);
free(wstr);
menu it;
it.sub = TRUE;
it.parent = m->menu;
it.origin = m->origin;
it.position = GetMenuItemCount(m->menu) -1;
it.menu = h;
lua_settop(l,0);
lua_pushfulluserdata(l, &it, sizeof(it), "menuhandle");
return 1;
}
开发者ID:qtnc,项目名称:6pad,代码行数:24,代码来源:luamenuhandle.c

示例5: WndProc

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
   switch( uMsg )
   {
      case WM_COMMAND :
              switch( LOWORD( wParam ) )
              {
                 case IDM_TEST :
                        // Add new menu option on a new line.
                        //...................................
                        AppendMenu( GetMenu( hWnd ), 
                                    MFT_STRING | MFT_MENUBARBREAK,
                                    120, "New Item" );
                        DrawMenuBar( hWnd );
                        break;

                 case IDM_ABOUT :
                        DialogBox( hInst, "AboutBox", hWnd, (DLGPROC)About );
                        break;

                 case IDM_EXIT :
                        DestroyWindow( hWnd );
                        break;
              }
              break;
      
      case WM_DESTROY :
              PostQuitMessage(0);
              break;

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

   return( 0L );
}
开发者ID:d4nie1,项目名称:TotulDespreCPP,代码行数:36,代码来源:Add_New.cpp

示例6: EnableMenuItem

LRESULT CMainFrame::EnableDisableCloseItem(bool bActivate)
{
    HMENU hMenu = ::GetMenu(m_hwnd);

    UINT EnableFlag;
    if (bActivate)
    {
        EnableFlag = MF_ENABLED;
    }
    else
    {
        EnableFlag = MF_GRAYED;
    }

    EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag);

    HMENU hFileMenu = ::GetSubMenu(hMenu, 0);

    ::EnableMenuItem(hFileMenu, IDM_FILE_CLOSE, MF_BYCOMMAND | EnableFlag);
    ::EnableMenuItem(hFileMenu, IDM_WINDOW_CLOSE_ALL, MF_BYCOMMAND | EnableFlag);

    DrawMenuBar();
    return 0;
}
开发者ID:sanjayui,项目名称:tinymux,代码行数:24,代码来源:cmainframe.cpp

示例7: sizeof


//.........这里部分代码省略.........
    // set environments
    SetCurrentDirectoryA(_project.getProjectDir().c_str());
    FileUtils::getInstance()->setDefaultResourceRootPath(_project.getProjectDir());
    FileUtils::getInstance()->setWritablePath(_project.getWritableRealPath().c_str());

    // check screen DPI
    HDC screen = GetDC(0);
    int dpi = GetDeviceCaps(screen, LOGPIXELSX);
    ReleaseDC(0, screen);

    // set scale with DPI
    //  96 DPI = 100 % scaling
    // 120 DPI = 125 % scaling
    // 144 DPI = 150 % scaling
    // 192 DPI = 200 % scaling
    // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#dpi_and_the_desktop_scaling_factor
    //
    // enable DPI-Aware with DeclareDPIAware.manifest
    // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#declaring_dpi_awareness
    float screenScale = 1.0f;
    if (dpi >= 120 && dpi < 144)
    {
        screenScale = 1.25f;
    }
    else if (dpi >= 144 && dpi < 192)
    {
        screenScale = 1.5f;
    }
    else if (dpi >= 192)
    {
        screenScale = 2.0f;
    }
    CCLOG("SCREEN DPI = %d, SCREEN SCALE = %0.2f", dpi, screenScale);

    // create opengl view
    Size frameSize = _project.getFrameSize();
    float frameScale = 1.0f;
    if (_project.isRetinaDisplay())
    {
        frameSize.width *= screenScale;
        frameSize.height *= screenScale;
    }
    else
    {
        frameScale = screenScale;
    }

    const Rect frameRect = Rect(0, 0, frameSize.width, frameSize.height);
    const bool isResize = _project.isResizeWindow();
    std::stringstream title;
    title << "Cocos Simulator - " << ConfigParser::getInstance()->getInitViewName();
    initGLContextAttrs();
    auto glview = GLViewImpl::createWithRect(title.str(), frameRect, frameScale);
    _hwnd = glview->getWin32Window();
    DragAcceptFiles(_hwnd, TRUE);
    //SendMessage(_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
    //SendMessage(_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon);
    //FreeResource(icon);

    auto director = Director::getInstance();
    director->setOpenGLView(glview);

    director->setAnimationInterval(1.0 / 60.0);

    // set window position
    if (_project.getProjectDir().length())
    {
        setZoom(_project.getFrameScale()); 
    }
    Vec2 pos = _project.getWindowOffset();
    if (pos.x != 0 && pos.y != 0)
    {
        RECT rect;
        GetWindowRect(_hwnd, &rect);
        MoveWindow(_hwnd, pos.x, pos.y, rect.right - rect.left, rect.bottom - rect.top, FALSE);
    }

    // path for looking Lang file, Studio Default images
    FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str());

    // init player services
    initServices();
    setupUI();
    DrawMenuBar(_hwnd);

    // prepare
    FileUtils::getInstance()->setPopupNotify(false);
    _project.dump();
    auto app = Application::getInstance();

    g_oldWindowProc = (WNDPROC)SetWindowLong(_hwnd, GWL_WNDPROC, (LONG)SimulatorWin::windowProc);

    // update window size
    RECT rect;
    GetWindowRect(_hwnd, &rect);
    MoveWindow(_hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + GetSystemMetrics(SM_CYMENU), FALSE);

    // startup message loop
    return app->run();
}
开发者ID:hugohuang1111,项目名称:Bird,代码行数:101,代码来源:SimulatorWin.cpp

示例8: WndProc

// funkcja okna zawieraj¹ca obs³ugê meldunków przesy³anych do okna
LRESULT CALLBACK WndProc (HWND Okno, UINT KodMeldunku, WPARAM wParam, LPARAM lParam)
{
	// deklaracja zmiennych
	HMENU mGlowne, mPlik, mInfo;
    	
	// obs³uga meldunku w zale¿noœci od kodu meldunku
	switch (KodMeldunku) 
	{ case WM_CREATE:  // obs³uga utworzenia okna - stworzenie menu
		mPlik = CreateMenu();
		AppendMenu(mPlik, MF_STRING, 100, "&Gong...");
		AppendMenu(mPlik, MF_SEPARATOR, 0, "");
		AppendMenu(mPlik, MF_STRING, 101, "&Koniec");
		mInfo = CreateMenu();
		AppendMenu(mInfo, MF_STRING, 102, "&Autor...");
		mGlowne = CreateMenu();
		AppendMenu(mGlowne, MF_POPUP, (UINT_PTR) mPlik, "&Plik");
		AppendMenu(mGlowne, MF_POPUP, (UINT_PTR) mInfo, "&Info");
		SetMenu(Okno, mGlowne);
		DrawMenuBar(Okno);
		return 0;

	  case WM_COMMAND: // obs³uga wyboru opcji z menu
		switch (wParam)
		{
		case 100: if(MessageBox(Okno, "Czy wygenerowaæ gong?", "Gong", MB_YESNO) == IDYES)
					MessageBeep(0);
                  break;
		case 101: DestroyWindow(Okno); // wymuszenie meldunku WM_DESTROY
        		  break;
		case 102: MessageBox(Okno, "imiê i nazwisko:\nnumer indeksu: ", "Student PJWSTK", MB_OK);
		}
		return 0;
	
	  case WM_PAINT: // obs³uga odœwie¿enia okna
		{	PAINTSTRUCT Paint;
			HDC Kontekst = BeginPaint(Okno, &Paint);
			HPEN Pioro = CreatePen(PS_SOLID, 15, RGB(255,0,0)); // czerwone pióro o gruboœci 15
			HBRUSH Pedzel = CreateSolidBrush(RGB(255,0,0)); // czerwony pêdzel

			SelectObject(Kontekst, Pioro);
			// SelectObject(Kontekst, GetStockObject(WHITE_BRUSH)); // standardowy bia³y pêdzel
			Ellipse(Kontekst, 100, 100, 300, 300);	// narysowanie okrêgu za pomoc¹ aktywnych pióra i pêdzla

			SelectObject(Kontekst, Pedzel);
			POINT wielokat[] = {{106, 200}, {118, 248}, {152, 282}, {200, 294}, {248, 282}, {282, 248}, {294, 200}};
			Polygon(Kontekst, wielokat, 7);  // narysowanie wielok¹ta wype³niaj¹cego doln¹ po³owê okrêgu na czerwono

			SetBkMode(Kontekst, TRANSPARENT); // wypisanie tekstu
			SetTextAlign(Kontekst, TA_CENTER | TA_BOTTOM);
			// SetTextColor(Kontekst, RGB(0,0,0));
			TextOut(Kontekst, 200, 200, "P J W S T K", 11);

			DeleteObject(Pioro); // usuniêcie niepotrzebnych przyborów graficznych
			DeleteObject(Pedzel);
			EndPaint(Okno, &Paint);
		}
		return 0;
  	
	  case WM_DESTROY: // obs³uga zamkniêcia okna - wygenerowanie meldunku WM_QUIT
		PostQuitMessage (0) ;
		return 0;
    
	  default: // standardowa obs³uga wszystkich pozosta³ych meldunków
		return DefWindowProc(Okno, KodMeldunku, wParam, lParam);
	}
}
开发者ID:wolkat,项目名称:grk-cwiczenia,代码行数:67,代码来源:GDI1.cpp

示例9: DeleteMenuItem

void DeleteMenuItem ( int iMenuID )
{
	DeleteItem ( iMenuID );
	DrawMenuBar ( hwndOriginalParent );
}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:5,代码来源:WinGUI.cpp

示例10: AddMenu

/*
向被注入进程添加额外的菜单
*/
void AddMenu()
{
    assert(g_hCalc != NULL);
    
    int nCount = 0;
    HMENU hMenu = NULL;
    HMENU hSubMenu = NULL;
    hMenu = GetMenu(g_hCalc);
    if (NULL == hMenu)
    {
        return;
    }

    if (g_bUnicode)
    {
        #define AppendMenu  AppendMenuW
        #define TEXT(quote) __TEXT(quote)   // r_winnt
    }
    else
    {
        #define AppendMenu  AppendMenuA
        #define __TEXT(quote) quote         
    }

    BOOL bRet = AppendMenu(hMenu,   
                            MF_POPUP | MF_STRING,
                            (UINT)hMenu,
                            TEXT("插件")
                            );
    if (!bRet)
    {
        goto ERROR_CLEAN;
    }

    nCount = GetMenuItemCount(hMenu);
    if (-1 == nCount)
    {
        goto ERROR_CLEAN;
    }

    //SAVE
    g_nMenus = nCount;
    g_hMenu = hMenu;

    hSubMenu = GetSubMenu(hMenu, nCount - 1);
    if (NULL == hSubMenu)
    {
        goto ERROR_CLEAN;
    }

    bRet = AppendMenu(hSubMenu, MF_STRING, MYMSG_FEATURE, TEXT("功能"));
    if (!bRet)
    {
        CloseHandle(hSubMenu);
        hSubMenu = NULL;
        goto ERROR_CLEAN;
    }

    bRet = AppendMenu(hSubMenu, MF_STRING, MYMSG_ABOUT, TEXT("关于"));
    if (!bRet)
    {
        CloseHandle(hSubMenu);
        hSubMenu = NULL;
        goto ERROR_CLEAN;
    }


    DrawMenuBar(g_hCalc);

    CloseHandle(hSubMenu);
    hSubMenu = NULL;

ERROR_CLEAN:
    CloseHandle(hMenu);
    hMenu = NULL;
    return;
}
开发者ID:xuwenbo,项目名称:KR_Ph2,代码行数:80,代码来源:InjectDll.cpp

示例11: DrawMenuBar

void QMenuBarPrivate::wceRefresh()
{
    DrawMenuBar(wce_menubar->menubarHandle);
}
开发者ID:crobertd,项目名称:qtbase,代码行数:4,代码来源:qmenu_wince.cpp

示例12: EXPORT

EXPORT(sqInt) primitiveDrawMenuBar(void) {
	DrawMenuBar();
	return null;
}
开发者ID:BrettThePark,项目名称:Scratch.app.for.iOS,代码行数:4,代码来源:MacMenubarPlugin.c

示例13: DoCreateStatusBar

VOID DoCreateStatusBar(VOID)
{
    RECT rc;
    RECT rcstatus;
    BOOL bStatusBarVisible;

    /* Check if status bar object already exists. */
    if (Globals.hStatusBar == NULL)
    {
        /* Try to create the status bar */
        Globals.hStatusBar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_EX_STATICEDGE,
                                                NULL,
                                                Globals.hMainWnd,
                                                CMD_STATUSBAR_WND_ID);

        if (Globals.hStatusBar == NULL)
        {
            ShowLastError();
            return;
        }

        /* Load the string for formatting column/row text output */
        LoadString(Globals.hInstance, STRING_LINE_COLUMN, Globals.szStatusBarLineCol, MAX_PATH - 1);

        /* Set the status bar for single-text output */
        SendMessage(Globals.hStatusBar, SB_SIMPLE, (WPARAM)TRUE, (LPARAM)0);
    }

    /* Set status bar visiblity according to the settings. */
    if (Globals.bWrapLongLines == TRUE || Globals.bShowStatusBar == FALSE)
    {
        bStatusBarVisible = FALSE;
        ShowWindow(Globals.hStatusBar, SW_HIDE);
    }
    else
    {
        bStatusBarVisible = TRUE;
        ShowWindow(Globals.hStatusBar, SW_SHOW);
        SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
    }

    /* Set check state in show status bar item. */
    if (bStatusBarVisible)
    {
        CheckMenuItem(Globals.hMenu, CMD_STATUSBAR, MF_BYCOMMAND | MF_CHECKED);
    }
    else
    {
        CheckMenuItem(Globals.hMenu, CMD_STATUSBAR, MF_BYCOMMAND | MF_UNCHECKED);
    }

    /* Update menu mar with the previous changes */
    DrawMenuBar(Globals.hMainWnd);

    /* Sefety test is edit control exists */
    if (Globals.hEdit != NULL)
    {
        /* Retrieve the sizes of the controls */
        GetClientRect(Globals.hMainWnd, &rc);
        GetClientRect(Globals.hStatusBar, &rcstatus);

        /* If status bar is currently visible, update dimensions of edit control */
        if (bStatusBarVisible)
            rc.bottom -= (rcstatus.bottom - rcstatus.top);

        /* Resize edit control to right size. */
        MoveWindow(Globals.hEdit,
                   rc.left,
                   rc.top,
                   rc.right - rc.left,
                   rc.bottom - rc.top,
                   TRUE);
    }

    /* Update content with current row/column text */
    DIALOG_StatusBarUpdateCaretPos();
}
开发者ID:RPG-7,项目名称:reactos,代码行数:77,代码来源:dialog.c

示例14: ASSERT

void CMainFrame::OnInitMenu(CMenu* pMenu)
{
   CMDIFrameWnd::OnInitMenu(pMenu);
  
	// CG: This block added by 'Tip of the Day' component.
	{
		// TODO: This code adds the "Tip of the Day" menu item
		// on the fly.  It may be removed after adding the menu
		// item to all applicable menu items using the resource
		// editor.

		// Add Tip of the Day menu item on the fly!
		static CMenu* pSubMenu = NULL;

		CString strHelp; strHelp.LoadString(CG_IDS_TIPOFTHEDAYHELP);
		CString strMenu;
		int nMenuCount = pMenu->GetMenuItemCount();
		BOOL bFound = FALSE;
		for (int i=0; i < nMenuCount; i++) 
		{
			pMenu->GetMenuString(i, strMenu, MF_BYPOSITION);
			if (strMenu == strHelp)
			{ 
				pSubMenu = pMenu->GetSubMenu(i);
				bFound = TRUE;
				ASSERT(pSubMenu != NULL);
			}
		}

		CString strTipMenu;
		strTipMenu.LoadString(CG_IDS_TIPOFTHEDAYMENU);
		if (!bFound)
		{
			// Help menu is not available. Please add it!
			if (pSubMenu == NULL) 
			{
				// The same pop-up menu is shared between mainfrm and frame 
				// with the doc.
				static CMenu popUpMenu;
				pSubMenu = &popUpMenu;
				pSubMenu->CreatePopupMenu();
				pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION, 
					CG_IDS_TIPOFTHEDAY, strTipMenu);
			} 
			pMenu->AppendMenu(MF_STRING|MF_BYPOSITION|MF_ENABLED|MF_POPUP, 
				(UINT)pSubMenu->m_hMenu, strHelp);
			DrawMenuBar();
		} 
		else
		{      
			// Check to see if the Tip of the Day menu has already been added.
			pSubMenu->GetMenuString(0, strMenu, MF_BYPOSITION);

			if (strMenu != strTipMenu) 
			{
				// Tip of the Day submenu has not been added to the 
				// first position, so add it.
				pSubMenu->InsertMenu(0, MF_BYPOSITION);  // Separator
				pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION, 
					CG_IDS_TIPOFTHEDAY, strTipMenu);
			}
		}
	}

}
开发者ID:alannet,项目名称:example,代码行数:65,代码来源:MainFrm.cpp

示例15: showMenuBar

void showMenuBar() {
	if(menuHandle == NULL) return;
	SetMenu(mainPtr.getSystemHandle(), menuHandle);
	DrawMenuBar(mainPtr.getSystemHandle());
}
开发者ID:Ircher,项目名称:CBoE,代码行数:5,代码来源:boe.menus.win.cpp


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