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


C++ GetSystemMenu函数代码示例

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


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

示例1: m_OwnConsole

CConsole::CConsole() : m_OwnConsole(false) {
	if (!AllocConsole()) return;

	SetConsoleCtrlHandler(MyConsoleCtrlHandler, TRUE);
	RemoveMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND);
	const int in = _open_osfhandle(INT_PTR(GetStdHandle(STD_INPUT_HANDLE)), _O_TEXT);
	const int out = _open_osfhandle(INT_PTR(GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT);
	m_OldStdin = *stdin;
	m_OldStdout = *stdout;

	*stdin = *_fdopen(in, "r");
	*stdout = *_fdopen(out, "w");

	m_OwnConsole = true;
}
开发者ID:Kilandor,项目名称:Payday-2-BLT,代码行数:15,代码来源:console.cpp

示例2: SetupSysMenu

/*
 * Add the default or a custom menu depending on the class match
 */
void
SetupSysMenu(unsigned long hwndIn)
{
    HWND hwnd;
    HMENU sys;
    int i;
    WindowPtr pWin;
    char *res_name, *res_class;

    hwnd = (HWND) hwndIn;
    if (!hwnd)
        return;

    pWin = GetProp(hwnd, WIN_WINDOW_PROP);

    sys = GetSystemMenu(hwnd, FALSE);
    if (!sys)
        return;

    if (pWin) {
        /* First see if there's a class match... */
        if (winMultiWindowGetClassHint(pWin, &res_name, &res_class)) {
            for (i = 0; i < pref.sysMenuItems; i++) {
                if (!strcmp(pref.sysMenu[i].match, res_name) ||
                    !strcmp(pref.sysMenu[i].match, res_class)) {
                    free(res_name);
                    free(res_class);

                    MakeMenu(pref.sysMenu[i].menuName, sys,
                             pref.sysMenu[i].menuPos == AT_START ? 0 : -1);
                    return;
                }
            }

            /* No match, just free alloc'd strings */
            free(res_name);
            free(res_class);
        }                       /* Found wm_class */
    }                           /* if pwin */

    /* Fallback to system default */
    if (pref.defaultSysMenuName[0]) {
        if (pref.defaultSysMenuPos == AT_START)
            MakeMenu(pref.defaultSysMenuName, sys, 0);
        else
            MakeMenu(pref.defaultSysMenuName, sys, -1);
    }
}
开发者ID:LeadHyperion,项目名称:RaspberryPiXServer,代码行数:51,代码来源:winprefs.c

示例3: windowsInit

static int windowsInit( HINSTANCE hinstance )
{
    WNDCLASS  		wc;						/* Window class */
    HMENU			hSysMenu;
    emfInstSet( ( int ) hinstance );
    wc.style		 = CS_HREDRAW | CS_VREDRAW;
    wc.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
    wc.hCursor		 = LoadCursor( NULL, IDC_ARROW );
    wc.cbClsExtra	 = 0;
    wc.cbWndExtra	 = 0;
    wc.hInstance	 = hinstance;
    wc.hIcon		 = NULL;
    wc.lpfnWndProc	 = ( WNDPROC ) websWindProc;
    wc.lpszMenuName	 = wc.lpszClassName = name;

    if ( ! RegisterClass( &wc ) )
    {
        return -1;
    }

    /*
     *	Create a window just so we can have a taskbar to close this web server
     */
    hwnd = CreateWindow( name, title, WS_MINIMIZE | WS_POPUPWINDOW,
                         CW_USEDEFAULT, 0, 0, 0, NULL, NULL, hinstance, NULL );

    if ( hwnd == NULL )
    {
        return -1;
    }

    /*
     *	Add the about box menu item to the system menu
     *	a_assert: IDM_ABOUTBOX must be in the system command range.
     */
    hSysMenu = GetSystemMenu( hwnd, FALSE );

    if ( hSysMenu != NULL )
    {
        AppendMenu( hSysMenu, MF_SEPARATOR, 0, NULL );
        AppendMenu( hSysMenu, MF_STRING, IDM_ABOUTBOX, T( "About WebServer" ) );
    }

    ShowWindow( hwnd, SW_SHOWNORMAL );
    UpdateWindow( hwnd );
    hwndAbout = NULL;
    return 0;
}
开发者ID:codywon,项目名称:bell-jpg,代码行数:48,代码来源:main.c

示例4: ASSERT

BOOL CTranslateDlg::OnInitDialog()
{
   CDialogEx::OnInitDialog();

   // Add "About..." menu item to system menu.

   // IDM_ABOUTBOX must be in the system command range.
   ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
   ASSERT(IDM_ABOUTBOX < 0xF000);

   CMenu* pSysMenu = GetSystemMenu(FALSE);
   if (pSysMenu != NULL)
   {
      BOOL bNameValid;
      CString strAboutMenu;
      bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
      ASSERT(bNameValid);
      if (!strAboutMenu.IsEmpty())
      {
         pSysMenu->AppendMenu(MF_SEPARATOR);
         pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
      }
   }

   // Set the icon for this dialog.  The framework does this automatically
   //  when the application's main window is not a dialog
   SetIcon(m_hIcon, TRUE);			// Set big icon
   SetIcon(m_hIcon, FALSE);		// Set small icon

   // TODO: Add extra initialization here

   CStringArray sLanguages;
   m_cTranslator.GetAllLanguages(sLanguages);
   int count = sLanguages.GetCount();
   for (int i = 0 ; i < count; i++)
      m_cToLang.AddString(sLanguages.GetAt(i));

   if(count)
      m_cToLang.SelectString(0, _T("Kannada"));

   m_font.CreateFont(30, 0, 0, 0, FW_DEMIBOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, 0, 0, 0, 0, NULL);
   m_cTranslatedText.SetFont(&m_font,TRUE);

   m_Errorfont.CreateFont(20, 0, 0, 0, FW_NORMAL, TRUE, FALSE, 0, DEFAULT_CHARSET, 0, 0, 0, 0, NULL);
   m_cErrorText.SetFont(&m_Errorfont,TRUE);

   return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:suresh3554,项目名称:MFC-Windows-Programs,代码行数:48,代码来源:TranslateDlg.cpp

示例5: ModifyStyle

BOOL DFUSheet::OnInitDialog() 
{
	// Pass on to the base class first
	BOOL result = CPropertySheet::OnInitDialog();
	
	// Modified behaviour for development mode
	if (developmentMode)
	{
		// Add a minimize icon
		ModifyStyle(0, WS_MINIMIZEBOX, 0);
		GetSystemMenu(false)->AppendMenu(MF_STRING, SC_MINIMIZE, _T("Minimize"));
	}
	
	// Return the result
	return result;
}
开发者ID:philiplin4sp,项目名称:production-test-tool,代码行数:16,代码来源:DFUSheet.cpp

示例6: GetSystemMenu

void TaskBar::ShowAppSystemMenu(TaskBarMap::iterator it)
{
	HMENU hmenu = GetSystemMenu(it->first, FALSE);

	if (hmenu) {
		POINT pt;

		GetCursorPos(&pt);
		int cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, _hwnd, NULL);

		if (cmd) {
			ActivateApp(it, false, false);	// reactivate window after the context menu has closed
			PostMessage(it->first, WM_SYSCOMMAND, cmd, 0);
		}
	}
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:16,代码来源:taskbar.cpp

示例7: AfxMessageBox

void CMainFrame::OnClose() 
{
	if(m_pApp->m_iCurrentTasks>0)
	{
		AfxMessageBox("You have " + str(m_pApp->m_iCurrentTasks)+ " job(s) pending completion. Please wait for this to finish before closing.");
	}
	else
	{
		//disable close system menu.
		CMenu* pmenu = GetSystemMenu(FALSE);
		UINT size = pmenu->GetMenuItemCount( );
		pmenu->EnableMenuItem(pmenu->GetMenuItemID(6), MF_DISABLED | MF_GRAYED);
		DrawMenuBar();

		//instead of the 2 phase shutdown, i'm
		//just gonna risk leaking a little memory 
		//and simplify the code. markme saw a crash here.
		m_pApp->Terminate();
		
		//close the frame.
		CMDIFrameWnd::OnClose();

		//ALERT. Unusual code.
		//This is a 2phase shutdown to ensure we don't leak any memory due to floating msgs coming
		//in from the server.
		/*if(m_ShutDownPhase==0)
		{
			if(E_FAIL==m_pApp->Terminate())
			{
				//Terminate's already happened. Shutdown now.
				m_ShutDownPhase = 0;
				CMDIFrameWnd::OnClose();
				return;
			}
			m_ShutDownPhase=-23; //number same as below. number not used anywhere else.
			PostMessage(WM_CLOSE);
		}
		else if(m_ShutDownPhase==-23) //see number above.
		{
			m_ShutDownPhase = 0;
			CMDIFrameWnd::OnClose();
		}
		else
			ASSERT(0);
		*/
	}
}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:47,代码来源:mainfrm.cpp

示例8: TRACE0

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;
    
    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
        | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
        TRACE0("Failed to create toolbar\n");
        return -1;      // fail to create
    }

    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
          sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

    // TODO: Delete these three lines if you don't want the toolbar to
    //  be dockable
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    m_wndToolBar.ShowWindow(SW_HIDE);
    m_wndStatusBar.ShowWindow(SW_HIDE);
    this->SetMenu(0);

    ASSERT((ID_APP_ABOUT & 0xFFF0) == ID_APP_ABOUT);
    ASSERT(ID_APP_ABOUT < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu("µ{¦¡»¡©ú");
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, ID_APP_ABOUT, strAboutMenu);
        }
    }

    return 0;
}
开发者ID:ShadowDL,项目名称:project,代码行数:47,代码来源:MainFrm.cpp

示例9: PrintDlgProc

BOOL CALLBACK PrintDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
     {
     switch (msg)
          {
          case WM_INITDIALOG :
               EnableMenuItem (GetSystemMenu (hDlg, FALSE), SC_CLOSE,
                                                            MF_GRAYED) ;
               return TRUE ;
          case WM_COMMAND :
               bUserAbort = TRUE ;
               EnableWindow (ghMainWindow, TRUE) ;
               DestroyWindow (hDlg) ;
               hDlgPrint = 0 ;
               return TRUE ;
          }
     return FALSE;
	 }
开发者ID:ygmpkk,项目名称:house,代码行数:17,代码来源:cprinter_121.c

示例10: wintitle

void wintitle(void)
{
    char buf[256];
    if (strlen(gli_story_name))
	sprintf(buf, "%s - %s", gli_story_name, gli_program_name);
    else
	sprintf(buf, "%s", gli_program_name);
    SetWindowTextA(hwndframe, buf);

	if (strcmp(gli_program_name, "Unknown"))
		sprintf(buf, "About Gargoyle / %s...", gli_program_name);
	else
		strcpy(buf, "About Gargoyle...");

	ModifyMenu(GetSystemMenu(hwndframe, 0), ID_ABOUT, MF_BYCOMMAND | MF_STRING, ID_ABOUT, buf);
	DrawMenuBar(hwndframe);
}
开发者ID:KeanW,项目名称:zlr--git,代码行数:17,代码来源:syswin.c

示例11: onTopMostMenuCommand

BOOL	onTopMostMenuCommand(HWND hWnd)
{
	HMENU hMenu = GetSystemMenu(hWnd, FALSE);

	UINT uState = GetMenuState( hMenu, IDM_TOPMOST, MF_BYCOMMAND);
	DWORD dwExStyle = GetWindowLong(hWnd,GWL_EXSTYLE);
	if( uState & MFS_CHECKED )
	{
		SetWindowPos(hWnd, HWND_NOTOPMOST,NULL,NULL,NULL,NULL,SWP_NOMOVE | SWP_NOSIZE); 
	}else{
		SetWindowPos(hWnd, HWND_TOPMOST,NULL,NULL,NULL,NULL,SWP_NOMOVE | SWP_NOSIZE); 
	}

	changeStateTopMostMenu(hWnd, hMenu);

	return(TRUE);
}
开发者ID:u338steven,项目名称:afxtools,代码行数:17,代码来源:misc.cpp

示例12: ErrorBox

//创建引擎窗体
bool CEngine::CreateEngineInfoBoard()
{
	//为了保持对控制台类型引擎信息显示的原味性,程序创建了另外的一个控制台辅助显示程序,并通过匿名管道向辅助控制台写入引擎信息
	STARTUPINFO si;
	PROCESS_INFORMATION pi;
	SECURITY_ATTRIBUTES sa;
	sa.nLength=sizeof(sa);
	sa.lpSecurityDescriptor=NULL;//Default security attributes
	sa.bInheritHandle=true;//handle can be inherited

	if(!CreatePipe(&pde.console_read,&pde.console_write,&sa,BUFSIZE))//创建引擎与显示控制台之间互相通信的匿名管道
	{
		ErrorBox("CreatePipe failed");
		return false;
	}		
	ZeroMemory(&si,sizeof(si));
	si.cb=sizeof(si);
	si.dwFlags=STARTF_USESHOWWINDOW |STARTF_USESTDHANDLES;
	si.wShowWindow=SW_HIDE;
	si.hStdInput=pde.console_read;
	si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
	si.hStdError=GetStdHandle(STD_ERROR_HANDLE);
	if(!CreateProcess("bin\\console1.exe",NULL,NULL,NULL,true,0,NULL,gameSet.CurDir,&si,&pi))//打开引擎进程
	{
		ErrorBox("CreateProcess console1 failed");
		return false;
	}
	CloseHandle(pde.console_read);
	pde.hCProcess = pi.hProcess;
	CloseHandle(pi.hThread);
	WaitForInputIdle(pi.hProcess,INFINITE);
	while((pde.console_hwnd=GetProcessMainWnd(pi.dwProcessId))==NULL)
	{//(由于进程创建函数是异步的)子进程刚建立时并不能立刻枚举窗口,需要等待
		Sleep(50);
	}
	//设置窗口标题为引擎路径
	SetWindowText(pde.console_hwnd,path);
	//获取窗口菜单句柄
	HMENU hMenu=GetSystemMenu(pde.console_hwnd,NULL);
	//使关闭按钮无效
	EnableMenuItem(hMenu,SC_CLOSE,MF_GRAYED);
	if(gameSet.swEngine==true)
		ShowWindow(pde.console_hwnd,SW_SHOW);
	return true;
}
开发者ID:ifplusor,项目名称:SAUGamePlatform,代码行数:46,代码来源:CEngine.cpp

示例13: ASSERT

BOOL CMSDNIntegratorDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // Add "About..." menu item to system menu.

    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
        }
    }

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);			// Set big icon
    SetIcon(m_hIcon, FALSE);		// Set small icon

    // Since we are using a progress control, set the progress
    // control for the integration.
    m_MSDNIntegrate.SetProgressCtrl(&m_progress);

    if ( m_strEditTitle.IsEmpty() )
        m_strEditTitle = _T("<Enter a title for your collection>");

    if ( m_strEditID.IsEmpty() )
        m_strEditID    = _T("<Enter a unique ID for your collection>");

    // Set the integrator defaults.
    m_MSDNIntegrate.SetTitleString(m_strEditTitle);
    m_MSDNIntegrate.SetUniqueID(m_strEditID);
    m_MSDNIntegrate.SetHelpVer(m_strEditVer);

    UpdateData(FALSE);
    return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:blytkerchan,项目名称:cppunit,代码行数:45,代码来源:MSDNIntegratorDlg.cpp

示例14: winopen

void winopen()
{
    HMENU menu;

    int sizew = gli_wmarginx * 2 + gli_cellw * gli_cols;
    int sizeh = gli_wmarginy * 2 + gli_cellh * gli_rows;

    sizew += GetSystemMetrics(SM_CXFRAME) * 2;
    sizeh += GetSystemMetrics(SM_CYFRAME) * 2;
    sizeh += GetSystemMetrics(SM_CYCAPTION);

    hwndframe = CreateWindow("XxFrame",
        NULL, // window caption
        WS_CAPTION|WS_THICKFRAME|
        WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|
        WS_CLIPCHILDREN,
        CW_USEDEFAULT, // initial x position
        CW_USEDEFAULT, // initial y position
        sizew, // initial x size
        sizeh, // initial y size
        NULL, // parent window handle
        NULL, // window menu handle
        0, //hInstance, // program instance handle
        NULL); // creation parameters

    hwndview = CreateWindow("XxView",
        NULL,
        WS_VISIBLE | WS_CHILD,
        CW_USEDEFAULT, CW_USEDEFAULT,
        CW_USEDEFAULT, CW_USEDEFAULT,
        hwndframe,
        NULL, NULL, 0);

    hdc = NULL;

    menu = GetSystemMenu(hwndframe, 0);
    AppendMenu(menu, MF_SEPARATOR, 0, NULL);
    AppendMenu(menu, MF_STRING, ID_ABOUT, "About Gargoyle...");
    AppendMenu(menu, MF_STRING, ID_CONFIG, "Options...");
    // AppendMenu(menu, MF_STRING, ID_TOGSCR, "Toggle scrollbar");

    wintitle();

    ShowWindow(hwndframe, SW_SHOW);
}
开发者ID:BPaden,项目名称:garglk,代码行数:45,代码来源:syswin.c

示例15: GetSystemMenu

//
/// Gets the system menu and sets up menu items. DoSysMenu is also responsible for
/// displaying and tracking the status of the menu.
//
void
TTinyCaption::DoSysMenu()
{
    HMENU hSysMenu = GetSystemMenu();
    if (hSysMenu) {
        uint32 style = GetWindowLong(GWL_STYLE);
        EnableMenuItem(hSysMenu, SC_RESTORE, (IsIconic() || IsZoomed()) ? MF_ENABLED : MF_GRAYED);
        EnableMenuItem(hSysMenu, SC_MOVE, (1/*style & WS_CAPTION*/) ? MF_ENABLED : MF_GRAYED);
        EnableMenuItem(hSysMenu, SC_SIZE, (style & WS_THICKFRAME) ? MF_ENABLED : MF_GRAYED);
        EnableMenuItem(hSysMenu, SC_MINIMIZE, ((style&WS_MINIMIZEBOX) && !IsIconic()) ? MF_ENABLED : MF_GRAYED);
        EnableMenuItem(hSysMenu, SC_MAXIMIZE, ((style&WS_MAXIMIZEBOX) && !IsZoomed()) ? MF_ENABLED : MF_GRAYED);
        TRect r(GetSysBoxRect());
        ClientToScreen(r.TopLeft());     // Cvt pt to screen coord
        ClientToScreen(r.BottomRight());
        TrackPopupMenu(hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
                       r.left-Frame.cx, r.top-Frame.cy, 0, GetHandle(), &r);
    }
}
开发者ID:bowlofstew,项目名称:Meridian59,代码行数:22,代码来源:tinycapt.cpp


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