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


C++ CheckMenuItem函数代码示例

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


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

示例1: SetDynamicConsole

void SetDynamicConsole() {
  CheckMenuItem(vmPrefsMenu, ID_DYNAMICCONSOLE, MF_BYCOMMAND | 
		(fDynamicConsole ? MF_CHECKED : MF_UNCHECKED));
  WritePrivateProfileString(U_GLOBAL,TEXT("DynamicConsole"),
			    fDynamicConsole ? U_ON:U_OFF,squeakIniName);
}
开发者ID:OpenSmalltalk,项目名称:opensmalltalk-vm,代码行数:6,代码来源:sqWin32Prefs.c

示例2: switch

LRESULT main_window::onCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
{  
  unsigned long params[2] = { 0, 0 };

  switch(LOWORD(wParam))
  {
    case ID_FILE_EXIT:
      ExitProcess(0);
    break; 
    case ID_FILE_OPEN:
    {
      char fileName[MAX_PATH] = "";
      FileOpenBox("NSD Files (*.nsd)\0*.nsd\0All Files (*.*)\0*.*\0", fileName, false);
      params[0] = (unsigned long)fileName;
      SendMessageRoot(MSG_LOAD_NSD, (WPARAM)0, (LPARAM)params);
    }
    break;
  }
  
  switch(LOWORD(wParam))
  {
    case ID_GOOL_STEP:
    {
      //SendMessage(objhWnd, WM_ACTIVATE, 0, 0);
      //resumeGoolSystem();
    }
    break;
    case ID_VIEW_OCTREE:
    {
      if (menu_flags[0] = (!menu_flags[0]))
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_OCTREE, MF_CHECKED);
      else
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_OCTREE, MF_UNCHECKED);
      
      SendMessageRoot(CPM_VISUAL_ZONE_TOGGLE_OCTREES, (WPARAM)0, (LPARAM)params);
    }
    break;
    
    case ID_VIEW_CAMERA_MODELMODE:
    {
      menu_flags[4] = true;
      
      CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_MODELMODE, MF_CHECKED);
  
      if (menu_flags[5] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_FLIGHTMODE, MF_UNCHECKED);
       if (menu_flags[7] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_CRASHMODE, MF_UNCHECKED);
        
      menu_flags[5] = false;
      menu_flags[6] = false;
      menu_flags[7] = false;
    
      params[0] = 0;
      SendMessageRoot(CPM_CAMERA_SELECT, (WPARAM)0, (LPARAM)params);
    }
    break;
    case ID_VIEW_CAMERA_FLIGHTMODE:
    {
      menu_flags[5] = true;
      
      CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_FLIGHTMODE, MF_CHECKED);
  
      if (menu_flags[4] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_MODELMODE, MF_UNCHECKED);
      if (menu_flags[7] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_CRASHMODE, MF_UNCHECKED);
        
      menu_flags[4] = false;
      menu_flags[6] = false;
      menu_flags[7] = false;
    
      params[0] = 1;
      SendMessageRoot(CPM_CAMERA_SELECT, (WPARAM)0, (LPARAM)params);
    }
    break;
    case ID_VIEW_CAMERA_CRASHMODE:
    {
      menu_flags[7] = true;
      
      CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_CRASHMODE, MF_CHECKED);
  
      if (menu_flags[4] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_MODELMODE, MF_UNCHECKED);
      if (menu_flags[5] == true)
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMERA_FLIGHTMODE, MF_UNCHECKED);

      menu_flags[4] = false;
      menu_flags[5] = false;
      menu_flags[6] = false;
    
      params[0] = 2;
      SendMessageRoot(CPM_CAMERA_SELECT, (WPARAM)0, (LPARAM)params);
    }
    break;
    
    case ID_VIEW_CAMPTH:
    {
      if (menu_flags[1] = (!menu_flags[1]))
        CheckMenuItem(GetMenu(hFrame), ID_VIEW_CAMPTH, MF_CHECKED);
//.........这里部分代码省略.........
开发者ID:wurlyfox,项目名称:crashutils,代码行数:101,代码来源:main_window.cpp

示例3: initmenu

static void initmenu()
{
        char t[512];
        HMENU hmenu = GetMenu(ghwnd);

        CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0])     ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1])     ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_DISC_WPROT_D, (defaultwriteprot) ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_DISC_VDFS_ENABLE, (vdfs_enabled) ? MF_CHECKED : MF_UNCHECKED);

        CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_CHECKED);
        CheckMenuItem(hmenu, IDM_MODEL_0   + curmodel,   MF_CHECKED);

        if (vid_scanlines)      CheckMenuItem(hmenu, IDM_VIDEO_SCANLINES,  MF_CHECKED);
        else if (vid_interlace) CheckMenuItem(hmenu, IDM_VIDEO_INTERLACED, MF_CHECKED);
        else if (vid_linedbl)   CheckMenuItem(hmenu, IDM_VIDEO_SLINEDBL,   MF_CHECKED);
        else if (vid_pal)       CheckMenuItem(hmenu, IDM_VIDEO_PAL,        MF_CHECKED);
        else                    CheckMenuItem(hmenu, IDM_VIDEO_LINEDBL,    MF_CHECKED);

        if (sound_internal) CheckMenuItem(hmenu, IDM_SOUND_INTERNAL, MF_CHECKED);
        if (sound_beebsid)  CheckMenuItem(hmenu, IDM_SOUND_BEEBSID,  MF_CHECKED);
        if (sound_music5000) CheckMenuItem(hmenu, IDM_SOUND_MUSIC5000, MF_CHECKED);
        if (sound_ddnoise)  CheckMenuItem(hmenu, IDM_SOUND_DDNOISE,  MF_CHECKED);
        if (sound_tape)     CheckMenuItem(hmenu, IDM_SOUND_TAPE,     MF_CHECKED);

        CheckMenuItem(hmenu, IDM_SOUND_FILTER, (sound_filter) ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_CHECKED);

        CheckMenuItem(hmenu, IDM_SID_TYPE   + cursid,    MF_CHECKED);
        CheckMenuItem(hmenu, IDM_SID_INTERP + sidmethod, MF_CHECKED);

        CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type,     MF_CHECKED);
        CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_CHECKED);

        CheckMenuItem(hmenu, IDM_TAPES_NORMAL + fasttape, MF_CHECKED);

        CheckMenuItem(hmenu, IDM_TUBES_4 + (tube_6502_speed - 1), MF_CHECKED);

        CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_CHECKED);

        append_filename(t, exedir, "roms\\tube\\ReCo6502ROM_816", 511);
        if (!file_exists(t, FA_ALL, NULL)) EnableMenuItem(hmenu, IDM_TUBE_65816, MF_GRAYED);

        if (keyas)     CheckMenuItem(hmenu, IDM_KEY_AS, MF_CHECKED);

        if (mouse_amx) CheckMenuItem(hmenu, IDM_MOUSE_AMX, MF_CHECKED);

        CheckMenuItem(hmenu, IDM_SCSI_ENABLE, scsi_enabled ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_IDE_ENABLE, ide_enable ? MF_CHECKED : MF_UNCHECKED);

        CheckMenuItem(hmenu, IDM_VIDEO_RESIZE, (videoresize) ? MF_CHECKED : MF_UNCHECKED);
        CheckMenuItem(hmenu, IDM_VIDEO_NULA, (nula_disable) ? MF_UNCHECKED : MF_CHECKED);

        CheckMenuItem(hmenu, IDM_SPD_100, MF_CHECKED);
}
开发者ID:hoglet67,项目名称:b-em,代码行数:55,代码来源:win.c

示例4: OnCreate


//.........这里部分代码省略.........
    nOldHeight = rc.bottom;
    /* nOldStartX = rc.left; */
    /*nOldStartY = rc.top;  */

#define PAGE_OFFSET_LEFT    17
#define PAGE_OFFSET_TOP     72
#define PAGE_OFFSET_WIDTH   (PAGE_OFFSET_LEFT*2)
#define PAGE_OFFSET_HEIGHT  (PAGE_OFFSET_TOP+32)

    if ((TaskManagerSettings.Left != 0) ||
        (TaskManagerSettings.Top != 0) ||
        (TaskManagerSettings.Right != 0) ||
        (TaskManagerSettings.Bottom != 0))
    {
        MoveWindow(hWnd, TaskManagerSettings.Left, TaskManagerSettings.Top, TaskManagerSettings.Right - TaskManagerSettings.Left, TaskManagerSettings.Bottom - TaskManagerSettings.Top, TRUE);
#ifdef __GNUC__TEST__
        MoveWindow(hApplicationPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE);
        MoveWindow(hProcessPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE);
        MoveWindow(hPerformancePage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE);
#endif
    }
    if (TaskManagerSettings.Maximized)
        ShowWindow(hWnd, SW_MAXIMIZE);

    /* Set the always on top style */
    hMenu = GetMenu(hWnd);
    hEditMenu = GetSubMenu(hMenu, 1);
    hViewMenu = GetSubMenu(hMenu, 2);
    hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
    hCPUHistoryMenu = GetSubMenu(hViewMenu, 7);

    /* Check or uncheck the always on top menu item */
    if (TaskManagerSettings.AlwaysOnTop) {
        CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED);
        SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
    } else {
        CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED);
        SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
    }

    /* Check or uncheck the minimize on use menu item */
    if (TaskManagerSettings.MinimizeOnUse)
        CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED);
    else
        CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED);

    /* Check or uncheck the hide when minimized menu item */
    if (TaskManagerSettings.HideWhenMinimized)
        CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED);
    else
        CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED);

    /* Check or uncheck the show 16-bit tasks menu item */
    if (TaskManagerSettings.Show16BitTasks)
        CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
    else
        CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);

    if (TaskManagerSettings.View_LargeIcons)
        CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE, MF_BYCOMMAND);
    else if (TaskManagerSettings.View_SmallIcons)
        CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL, MF_BYCOMMAND);
    else
        CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS, MF_BYCOMMAND);

    if (TaskManagerSettings.ShowKernelTimes)
开发者ID:Sunmonds,项目名称:wine,代码行数:67,代码来源:taskmgr.c

示例5: TaskManagerWndProc


//.........这里部分代码省略.........
        case ID_FILE_EXIT:
            EndDialog(hDlg, IDOK);
            break;
        }     
        break;

    case WM_ONTRAYICON:
        switch(lParam)
        {
        case WM_RBUTTONDOWN:
            {
            POINT pt;
            BOOL OnTop;
            HMENU hMenu, hPopupMenu;
            
            GetCursorPos(&pt);
            
            OnTop = (GetWindowLongW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
            
            hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_TRAY_POPUP));
            hPopupMenu = GetSubMenu(hMenu, 0);
            
            if(IsWindowVisible(hMainWnd))
            {
              DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND);
            }
            else
            {
              SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE);
            }
            
            if(OnTop)
            {
              CheckMenuItem(hPopupMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND | MF_CHECKED);
            }
            
            SetForegroundWindow(hMainWnd);
            TrackPopupMenuEx(hPopupMenu, 0, pt.x, pt.y, hMainWnd, NULL);
            
            DestroyMenu(hMenu);
            break;
            }
        case WM_LBUTTONDBLCLK:
            TaskManager_OnRestoreMainWindow();
            break;
        }
        break;

    case WM_NOTIFY:
        pnmh = (LPNMHDR)lParam;
        if ((pnmh->hwndFrom == hTabWnd) &&
            (pnmh->idFrom == IDC_TAB) &&
            (pnmh->code == TCN_SELCHANGE))
        {
            TaskManager_OnTabWndSelChange();
        }
        break;

    case WM_NCPAINT:
        hdc = GetDC(hDlg);
        GetClientRect(hDlg, &rc);
        Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
        ReleaseDC(hDlg, hdc);
        break;

    case WM_PAINT:
开发者ID:Sunmonds,项目名称:wine,代码行数:67,代码来源:taskmgr.c

示例6: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    PAINTSTRUCT ps;
	SYSTEMTIME st;
	RECT crt;
	HPEN hPen, OldPen;
	HBRUSH OldBrush;
	CHOOSEFONT CFT;
	HFONT MyFont, OldFont;
	
	static TCHAR sTime[128];
	static TCHAR sTimeExceptSecond[128];
	static TCHAR sDate[128];
	static bool isAnalog = false;
	static bool showSecond = true;
	static bool showDate = true;
	static bool top = false;
	int radius;
	static NEEDLE ndlHour, ndlMin, ndlSec;
	POINT secRoot, secEdge;
	
    switch(iMessage)
    {
	
    case WM_CREATE:
        hWndMain = hWnd;
		SetTimer(hWnd, 1, 50, NULL);
		SendMessage(hWnd, WM_TIMER, 1, 0);

		lf.lfHeight = 20;
		lf.lfCharSet = HANGEUL_CHARSET;
		lf.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
		lstrcpy(lf.lfFaceName, TEXT("바탕"));
        return 0;
	case WM_INITMENU:
		if(top)
			CheckMenuItem((HMENU)wParam, 40017, MF_BYCOMMAND | MF_CHECKED);
		else
			CheckMenuItem((HMENU)wParam, 40017, MF_BYCOMMAND | MF_UNCHECKED);
		if(isAnalog)
		{
			CheckMenuItem((HMENU)wParam, ID_ANALOG, MF_BYCOMMAND | MF_CHECKED);
			CheckMenuItem((HMENU)wParam, ID_DIGITAL, MF_BYCOMMAND | MF_UNCHECKED);
			EnableMenuItem((HMENU)wParam, ID_FONT, MF_BYCOMMAND | MF_GRAYED);
		}
		else
		{
			CheckMenuItem((HMENU)wParam, ID_DIGITAL, MF_BYCOMMAND | MF_CHECKED);
			CheckMenuItem((HMENU)wParam, ID_ANALOG, MF_BYCOMMAND | MF_UNCHECKED);
			EnableMenuItem((HMENU)wParam, ID_FONT, MF_BYCOMMAND | MF_ENABLED);
		}
		if(showSecond)
			CheckMenuItem((HMENU)wParam, ID_SECOND, MF_BYCOMMAND | MF_CHECKED);
		else
			CheckMenuItem((HMENU)wParam, ID_SECOND, MF_BYCOMMAND | MF_UNCHECKED);
		if(showDate)
			CheckMenuItem((HMENU)wParam, ID_DATE, MF_BYCOMMAND | MF_CHECKED);
		else
			CheckMenuItem((HMENU)wParam, ID_DATE, MF_BYCOMMAND | MF_UNCHECKED);
	case WM_TIMER:
		GetLocalTime(&st);
		GetClientRect(hWnd, &crt);
		// 시침, 분침, 초침 크기 지정

		// 반지름
		radius = min(crt.right, crt.bottom) / 2;

		// 시침
		ndlHour.edgeLen = radius * 0.55;
		ndlHour.rootLen = radius * 0.12;
		ndlHour.sideLen = radius * 0.06;
		ndlHour.edgePos.x = crt.right / 2 + ndlHour.edgeLen * cos(st.wHour * PI / 6 + st.wMinute * PI / 360 - PI / 2);
		ndlHour.edgePos.y = crt.bottom / 2 + ndlHour.edgeLen * sin(st.wHour * PI / 6 + st.wMinute * PI / 360 - PI / 2);
		ndlHour.rootPos.x = crt.right / 2 + ndlHour.rootLen * cos(st.wHour * PI / 6 + st.wMinute * PI / 360 + PI / 2);
		ndlHour.rootPos.y = crt.bottom / 2 + ndlHour.rootLen * sin(st.wHour * PI / 6 + st.wMinute * PI / 360 + PI / 2);
		ndlHour.leftPos.x = crt.right / 2 + ndlHour.sideLen * cos(st.wHour * PI / 6 + st.wMinute * PI / 360); 
		ndlHour.leftPos.y = crt.bottom / 2 + ndlHour.sideLen * sin(st.wHour * PI / 6 + st.wMinute * PI / 360);
		ndlHour.rightPos.x = crt.right / 2 + ndlHour.sideLen * cos(st.wHour * PI / 6 + st.wMinute * PI / 360 + PI); 
		ndlHour.rightPos.y = crt.bottom / 2 + ndlHour.sideLen * sin(st.wHour * PI / 6 + st.wMinute * PI / 360 + PI);
		// 분침
		ndlMin.edgeLen = radius * 0.65;
		ndlMin.rootLen = radius * 0.16;
		ndlMin.sideLen = radius * 0.04;
		ndlMin.edgePos.x = crt.right / 2 + ndlMin.edgeLen * cos(st.wMinute * PI / 30 + st.wSecond * PI / 1800 - PI / 2);
		ndlMin.edgePos.y = crt.bottom / 2 + ndlMin.edgeLen * sin(st.wMinute * PI / 30 + st.wSecond * PI / 1800 - PI / 2);
		ndlMin.rootPos.x = crt.right / 2 + ndlMin.rootLen * cos(st.wMinute * PI / 30 + st.wSecond * PI / 1800 + PI / 2);
		ndlMin.rootPos.y = crt.bottom / 2 + ndlMin.rootLen * sin(st.wMinute * PI / 30 + st.wSecond * PI / 1800 + PI / 2);
		ndlMin.leftPos.x = crt.right / 2 + ndlMin.sideLen * cos(st.wMinute * PI / 30 + st.wSecond * PI / 1800); 
		ndlMin.leftPos.y = crt.bottom / 2 + ndlMin.sideLen * sin(st.wMinute * PI / 30 + st.wSecond * PI / 1800);
		ndlMin.rightPos.x = crt.right / 2 + ndlMin.sideLen * cos(st.wMinute * PI / 30 + st.wSecond * PI / 1800 + PI);
		ndlMin.rightPos.y = crt.bottom / 2 + ndlMin.sideLen * sin(st.wMinute * PI / 30 + st.wSecond * PI / 1800 + PI);

		// 초침
		ndlSec.edgeLen = radius * 0.65;
		ndlSec.rootLen = 0;
		ndlSec.sideLen = 0;
		ndlSec.edgePos.x = crt.right / 2 + ndlSec.edgeLen * cos(st.wSecond * PI / 30 - PI / 2);
		ndlSec.edgePos.y = crt.bottom / 2 + ndlSec.edgeLen * sin(st.wSecond * PI / 30 - PI / 2);
		ndlSec.rootPos.x = crt.right / 2;
//.........这里部分代码省略.........
开发者ID:AncientGratin,项目名称:Clock,代码行数:101,代码来源:Clock.cpp

示例7: InitMenuPopup


//.........这里部分代码省略.........
        mf_state = MF_GRAYED;
    EnableMenuItem(menu, IDM_OPENWS, mf_state);
    EnableMenuItem(menu, IDM_CLOSEWS, mf_state);
    EnableMenuItem(menu, IDM_NEWWS, mf_state);
    EnableMenuItem(menu, IDM_REOPENWS, mf_state);
    EnableMenuItem(menu, IDM_IMPORTWS, mf_state);

    mf_state = ((uState == notDebugging || uState == atException || uState == atBreakpoint) && !making && activeProject) ? MF_ENABLED : MF_GRAYED;
    EnableMenuItem(menu, IDM_RUN, mf_state);

    mf_state = (uState != notDebugging && (uState == atException || uState == atBreakpoint)  && !making && activeProject) ? MF_ENABLED : MF_GRAYED;
    EnableMenuItem(menu, IDM_STOPDEBUGGING, mf_state);
    EnableMenuItem(menu, IDM_RUNTO, mf_state);
    EnableMenuItem(menu, IDM_SCROLLTOBP, mf_state);
//    EnableMenuItem(menu, IDM_VIEWBP, mf_state);
    EnableMenuItem(menu, IDM_VIEWASM, mf_state);
    EnableMenuItem(menu, IDM_VIEWMEM, mf_state);
    EnableMenuItem(menu, IDM_VIEWMEM2, mf_state);
    EnableMenuItem(menu, IDM_VIEWMEM3, mf_state);
    EnableMenuItem(menu, IDM_VIEWMEM4, mf_state);
    EnableMenuItem(menu, IDM_VIEWREGISTER, mf_state);
    EnableMenuItem(menu, IDM_VIEWSTACK, mf_state);
    EnableMenuItem(menu, IDM_VIEWWATCH, mf_state);
    EnableMenuItem(menu, IDM_VIEWWATCH2, mf_state);
    EnableMenuItem(menu, IDM_VIEWWATCH3, mf_state);
    EnableMenuItem(menu, IDM_VIEWWATCH4, mf_state);
    EnableMenuItem(menu, IDM_VIEWLOCALS, mf_state);
    EnableMenuItem(menu, IDM_VIEWTHREAD, mf_state);
    EnableMenuItem(menu, IDM_HBREAK, mf_state);
    EnableMenuItem(menu, IDM_DATABREAKPOINT, mf_state);
    EnableMenuItem(menu, IDM_FUNCTIONBREAKPOINT, mf_state);
    
    mf_state = uState == Running ? MF_ENABLED : MF_GRAYED;
    EnableMenuItem(menu, IDM_STOP, mf_state);

    {
        BOOL state = TagAnyDisabledBreakpoints() || hbpAnyDisabledBreakpoints() || databpAnyDisabledBreakpoints();
        ModifyMenu(menu, IDM_DISABLEALLBREAKPOINTS, MF_BYCOMMAND | MF_STRING, IDM_DISABLEALLBREAKPOINTS, state ? "E&nable All Breakpoints" : "D&isable All Breakpoints");
        
    }
    mf_state = (TagAnyBreakpoints() || hbpAnyBreakpoints() || databpAnyBreakpoints()) ? MF_ENABLED : MF_GRAYED;
    EnableMenuItem(menu, IDM_REMOVEALLBREAKPOINTS, mf_state);
    EnableMenuItem(menu, IDM_DISABLEALLBREAKPOINTS, mf_state);

    mf_state = MF_GRAYED;
    if (activeProject && GetResData(activeProject))
        mf_state = MF_ENABLED;       
    EnableMenuItem(menu, IDM_NEWRESOURCE, mf_state);
    mf_state = MF_GRAYED;
    if (IsWindow(win) && IsResourceWindow(win))
    {
        struct resRes *res = (struct resRes *)GetWindowLong(win, 0);
        if (res->resource->itype == RESTYPE_DIALOG)
            mf_state = MF_ENABLED;
    }
    EnableMenuItem(menu, IDM_CREATIONORDER, mf_state);
    EnableMenuItem(menu, IDM_SETTABSTOPS, mf_state);
    EnableMenuItem(menu, IDM_SETGROUPFLAGS, mf_state);
    EnableMenuItem(menu, IDM_GRIDMENU, mf_state);
    EnableMenuItem(menu, IDM_SHOWGRID, mf_state);
    EnableMenuItem(menu, IDM_SNAPTOGRID, mf_state);
    if (mf_state == MF_ENABLED)
    {
        if (snapToGrid)
        {
            CheckMenuItem( menu, IDM_SNAPTOGRID, MF_BYCOMMAND | MF_CHECKED);
        }
        else
        {
            CheckMenuItem( menu, IDM_SNAPTOGRID, MF_BYCOMMAND);
        }
        if (showGrid)
        {
            CheckMenuItem( menu, IDM_SHOWGRID, MF_BYCOMMAND | MF_CHECKED);
        }
        else
        {
            CheckMenuItem( menu, IDM_SHOWGRID, MF_BYCOMMAND);
        }
    }
    mf_state = MF_GRAYED;
    if (IsWindow(win) && IsResourceWindow(win))
    {
        struct resRes *res = (struct resRes *)GetWindowLong(win, 0);
        if (res->resource->itype == RESTYPE_BITMAP || res->resource->itype == RESTYPE_CURSOR || res->resource->itype == RESTYPE_ICON)
            mf_state = MF_ENABLED;
    }
    EnableMenuItem(menu, IDM_FLIPMENU, mf_state);
    EnableMenuItem(menu, IDM_ROTATEMENU, mf_state);
    EnableMenuItem(menu, IDM_CLEAR, mf_state);
    EnableMenuItem(menu, IDM_CLEARSELECTION, mf_state);

    //         mf_state = uState == atBreakpoint || uState == atException ? MF_ENABLED : MF_GRAYED ;
    //         EnableMenuItem(menu,IDM_HBREAK, mf_state ) ;

    mf_state = PropGetInt(NULL, "MSDN_HELP_MODE") == 0 ? MF_ENABLED : MF_GRAYED;
    EnableMenuItem(menu,IDM_CONFIGWEBHELP, mf_state ) ;


}
开发者ID:bencz,项目名称:OrangeC,代码行数:101,代码来源:idemenu.c

示例8: WindowProcedure

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static int idColor [5] = { WHITE_BRUSH,  LTGRAY_BRUSH, GRAY_BRUSH,
                               DKGRAY_BRUSH, BLACK_BRUSH } ;
    static int iSelection = IDM_BKGND_WHITE ;
    HMENU      hMenu ;

    switch (message)                  /* handle the messages */
    {
        case WM_COMMAND:
            hMenu = GetMenu (hwnd) ;
            switch (LOWORD (wParam)) {
                case IDM_FILE_NEW:
                case IDM_FILE_OPEN:
                case IDM_FILE_SAVE:
                case IDM_FILE_SAVE_AS:
                    MessageBeep (0) ;
                    return 0 ;

                case IDM_APP_EXIT:
                    SendMessage (hwnd, WM_CLOSE, 0, 0) ;
                    return 0 ;

                case IDM_EDIT_UNDO:
                case IDM_EDIT_CUT:
                case IDM_EDIT_COPY:
                case IDM_EDIT_PASTE:
                case IDM_EDIT_CLEAR:
                    MessageBeep (0) ;
                    return 0 ;

                case IDM_BKGND_WHITE:         // Note: Logic below
                case IDM_BKGND_LTGRAY:        //   assumes that IDM_WHITE
                case IDM_BKGND_GRAY:          //   through IDM_BLACK are
                case IDM_BKGND_DKGRAY:        //   consecutive numbers in
                case IDM_BKGND_BLACK:         //   the order shown here.

                    CheckMenuItem (hMenu, iSelection, MF_UNCHECKED) ;
                    iSelection = LOWORD (wParam) ;
                    CheckMenuItem (hMenu, iSelection, MF_CHECKED) ;

                    SetClassLong (hwnd, GCL_HBRBACKGROUND, (LONG)GetStockObject
                                    (idColor [LOWORD (wParam) - IDM_BKGND_WHITE])) ;

                    InvalidateRect (hwnd, NULL, TRUE) ;
                    return 0 ;

        case IDM_TIMER_START:
            if (SetTimer (hwnd, ID_TIMER, 1000, NULL)) {
                EnableMenuItem (hMenu, IDM_TIMER_START, MF_GRAYED) ;
                EnableMenuItem (hMenu, IDM_TIMER_STOP,  MF_ENABLED) ;
            }
            return 0 ;

        case IDM_TIMER_STOP:
             KillTimer (hwnd, ID_TIMER) ;
             EnableMenuItem (hMenu, IDM_TIMER_START, MF_ENABLED) ;
             EnableMenuItem (hMenu, IDM_TIMER_STOP,  MF_GRAYED) ;
             return 0 ;

        case IDM_APP_HELP:
             MessageBox (hwnd, TEXT ("Help not yet implemented!"),
                         szClassName, MB_ICONEXCLAMATION | MB_OK) ;
             return 0 ;

        case IDM_APP_ABOUT:
             MessageBox (hwnd, TEXT ("Menu Demonstration Program\n")
                               TEXT ("(c) Charles Petzold, 1998"),
                         szClassName, MB_ICONINFORMATION | MB_OK) ;
             return 0 ;
        }
        break;
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
开发者ID:robinlan,项目名称:LiearAlgebraImplement,代码行数:81,代码来源:main.cpp

示例9: check_menu_item

/* change menu item checkmark */
void
check_menu_item(int menuid, int itemid, BOOL checked)
{
        CheckMenuItem(hmenu, itemid, MF_BYCOMMAND | (checked ? MF_CHECKED : MF_UNCHECKED));
}
开发者ID:131,项目名称:gsview,代码行数:6,代码来源:gvwmisc.c

示例10: AddContactToFavorites

/*
 * add a contact to recent or favorites menu
 * mode = 1, add
 * mode = 0, only modify it..
 * hMenu specifies the menu handle (the menus are identical...)
 * cares about updating the menu entry. It sets the hIcon (proto status icon) in
 * dwItemData of the the menu entry, so that the WM_DRAWITEM handler can retrieve it
 * w/o costly service calls.
 *
 * Also, the function does housekeeping on the Recent Sessions menu to enforce the
 * maximum number of allowed entries (20 at the moment). The oldest (topmost) entry
 * is deleted, if necessary.
 */
void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu)
{
	TCHAR szMenuEntry[80];
	TCHAR	szFinalNick[100];

	if (szNickname == NULL)
		_tcsncpy_s(szFinalNick, pcli->pfnGetContactDisplayName(hContact, 0), _TRUNCATE);
	else
		_tcsncpy_s(szFinalNick, szNickname, _TRUNCATE);

	if (szProto == NULL)
		szProto = GetContactProto(hContact);
	if (szProto) {
		if (wStatus == 0)
			wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
		if (szStatus == NULL)
			szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0);
	}
	else
		return;

	if (hIcon == 0)
		hIcon = Skin_LoadProtoIcon(szProto, wStatus);

	PROTOACCOUNT *acc = Proto_GetAccount(szProto);
	if (acc && acc->tszAccountName) {
		MENUITEMINFO mii = { 0 };
		mii.cbSize = sizeof(mii);
		mir_sntprintf(szMenuEntry, _T("%s: %s (%s)"), acc->tszAccountName, szFinalNick, szStatus);
		if (mode) {
			if (hMenu == PluginConfig.g_hMenuRecent) {
				if (CheckMenuItem(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == 0) {
					DeleteMenu(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND);
					goto addnew;                                            // move to the end of the menu...
				}
				if (GetMenuItemCount(PluginConfig.g_hMenuRecent) > nen_options.wMaxRecent) {           // throw out oldest entry in the recent menu...
					UINT uid = GetMenuItemID(hMenu, 0);
					if (uid) {
						DeleteMenu(hMenu, (UINT_PTR)0, MF_BYPOSITION);
						db_set_dw((MCONTACT)uid, SRMSGMOD_T, "isRecent", 0);
					}
				}
			addnew:
				db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(NULL));
				AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry);
			}
			else if (hMenu == PluginConfig.g_hMenuFavorites) {            // insert the item sorted...
				TCHAR szBuffer[142];
				int i, c = GetMenuItemCount(PluginConfig.g_hMenuFavorites);

				MENUITEMINFO mii2 = { 0 };
				mii2.fMask = MIIM_STRING;
				mii2.cbSize = sizeof(mii2);
				if (c == 0)
					InsertMenu(PluginConfig.g_hMenuFavorites, 0, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry);
				else {
					for (i = 0; i <= c; i++) {
						mii2.cch = 0;
						mii2.dwTypeData = NULL;
						GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2);
						mii2.cch++;
						mii2.dwTypeData = szBuffer;
						GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2);
						if (_tcsncmp((TCHAR*)mii2.dwTypeData, szMenuEntry, 140) > 0 || i == c) {
							InsertMenu(PluginConfig.g_hMenuFavorites, i, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry);
							break;
						}
					}
				}
			}
		}
		mii.fMask = MIIM_BITMAP | MIIM_DATA;
		if (!mode) {
			mii.fMask |= MIIM_STRING;
			mii.dwTypeData = (LPTSTR)szMenuEntry;
			mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
		}
		mii.hbmpItem = HBMMENU_CALLBACK;
		mii.dwItemData = (ULONG_PTR)hIcon;
		SetMenuItemInfo(hMenu, (UINT)hContact, FALSE, &mii);
	}
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:95,代码来源:trayicon.cpp

示例11: switch

INT_PTR DialogInstall::OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
	case IDC_INSTALL_ADVANCED_BUTTON:
		{
			RECT r;
			GetWindowRect((HWND)lParam, &r);
			HMENU menu = LoadMenu(GetInstanceHandle(), MAKEINTRESOURCE(IDR_INSTALL_MENU));
			HMENU subMenu = GetSubMenu(menu, 0);

			if (m_PackageSkins.empty() || m_MergeSkins || m_BackupPackage)
			{
				EnableMenuItem(subMenu, IDM_INSTALL_BACKUPSKINS, MF_BYCOMMAND | MF_GRAYED);
			}
			else
			{
				CheckMenuItem(subMenu, IDM_INSTALL_BACKUPSKINS, (m_BackupSkins ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND);
			}

			if (m_PackageFonts.empty())
			{
				EnableMenuItem(subMenu, IDM_INSTALL_SYSTEMFONTS, MF_BYCOMMAND | MF_GRAYED);
			}
			else
			{
				CheckMenuItem(subMenu, IDM_INSTALL_SYSTEMFONTS, (m_SystemFonts ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND);
			}

			const WCHAR* formatName = m_PackageFormat == PackageFormat::New ? L"New format" : L"Old format";
			ModifyMenu(subMenu, IDM_INSTALL_FORMAT, MF_STRING | MF_GRAYED | MF_BYCOMMAND, IDM_INSTALL_FORMAT, formatName);

			TrackPopupMenu(
				subMenu,
				TPM_RIGHTBUTTON | TPM_LEFTALIGN,
				r.left,
				--r.bottom,
				0,
				m_Window,
				nullptr);

			DestroyMenu(menu);
		}
		break;

	case IDC_INSTALL_INSTALL_BUTTON:
		BeginInstall();
		break;

	case IDCANCEL:
		if (!m_InstallThread)
		{
			EndDialog(m_Window, 0);
		}
		break;

	case IDM_INSTALL_BACKUPSKINS:
		m_BackupSkins = !m_BackupSkins;
		break;

	case IDM_INSTALL_SYSTEMFONTS:
		m_SystemFonts = !m_SystemFonts;
		break;

	default:
		return FALSE;
	}

	return TRUE;
}
开发者ID:ATTRAYANTDESIGNS,项目名称:rainmeter,代码行数:70,代码来源:DialogInstall.cpp

示例12: Set1ButtonMouse

void Set1ButtonMouse() {
  CheckMenuItem(vmPrefsMenu, ID_1BUTTONMOUSE, MF_BYCOMMAND | 
		(f1ButtonMouse ? MF_CHECKED : MF_UNCHECKED));
  WritePrivateProfileString(U_GLOBAL,TEXT("1ButtonMouse"),
			    f1ButtonMouse ? U_ON : U_OFF,squeakIniName);
}
开发者ID:OpenSmalltalk,项目名称:opensmalltalk-vm,代码行数:6,代码来源:sqWin32Prefs.c

示例13: SetReduceCPUInBackground

void SetReduceCPUInBackground() {
  CheckMenuItem(vmPrefsMenu, ID_REDUCEBACKGROUNDCPU, MF_BYCOMMAND | 
		(fReduceCPUInBackground ? MF_CHECKED : MF_UNCHECKED));
  WritePrivateProfileString(U_GLOBAL,TEXT("ReduceCPUInBackground"),
			    fReduceCPUInBackground ? U_ON:U_OFF,squeakIniName);
}
开发者ID:OpenSmalltalk,项目名称:opensmalltalk-vm,代码行数:6,代码来源:sqWin32Prefs.c

示例14: SetReduceCPUUsage

void SetReduceCPUUsage() {
  CheckMenuItem(vmPrefsMenu, ID_REDUCECPUUSAGE, MF_BYCOMMAND | 
		(fReduceCPUUsage ? MF_CHECKED : MF_UNCHECKED));
  WritePrivateProfileString(U_GLOBAL,TEXT("ReduceCPUUsage"),
			    fReduceCPUUsage ? U_ON:U_OFF,squeakIniName);
}
开发者ID:OpenSmalltalk,项目名称:opensmalltalk-vm,代码行数:6,代码来源:sqWin32Prefs.c

示例15: DlgProc

INT_PTR CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    HINSTANCE hInstance = GetModuleHandle(NULL);
    HWND hButton = GetDlgItem(hDlg, IDC_START);
    HMENU hMenu = GetSystemMenu(hDlg, FALSE);
    HICON hBigIcon, hSmallIcon;
    WCHAR buf[BUFSIZ];

    if (msg == WM_TASKBARCREATED && !IsWindowVisible(hDlg)) {
        WorkerMinimize();
        return 0;
    }

    switch (msg) {
    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDC_START:
            WorkerMinimize();
            WorkerStart();
            break;

        case IDC_TIMEOUT:
            if (HIWORD(wParam) == EN_CHANGE) {
                GetDlgItemText(hDlg, IDC_TIMEOUT, buf, BUFSIZ);
                EnableWindow(hButton, (Worker.dwTimeout = _wtoi(buf)) > 0);
            }
        }
        break;

    case WM_SYSCOMMAND:
        switch(LOWORD(wParam)) {
        case WM_INVISIBLE:
            if (Worker.isInvisible = !(GetMenuState(hMenu, WM_INVISIBLE, MF_BYCOMMAND) & MF_CHECKED)) {
                CheckMenuItem(hMenu, WM_INVISIBLE, MF_BYCOMMAND | MF_CHECKED);
            } else {
                CheckMenuItem(hMenu, WM_INVISIBLE, MF_BYCOMMAND | MF_UNCHECKED);
            }
        }
        break;

    case WM_INITDIALOG:
        SetWindowText(hDlg, App.Strings.appName);

        hSmallIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
        SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hSmallIcon);

        hBigIcon = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 64, 64, 0);
        SendDlgItemMessage(hDlg, IDC_START, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hBigIcon);

        SendDlgItemMessage(hDlg, IDC_TIMEOUT, EM_LIMITTEXT, 5, 0);
        SetDlgItemText(hDlg, IDC_TIMEOUT, DEF_TIMEOUT);

        DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND);
        DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND);
        DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND);

        InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING | MF_CHECKED, WM_INVISIBLE, App.Strings.cfgInvisible);
        InsertMenu(hMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, 0);

        return TRUE;

    case WM_CLOSE:
        DestroyWindow(hDlg);
        return TRUE;

    case WM_DESTROY:
        PostQuitMessage(0);
        return TRUE;

    case WM_TRAYICON:
        switch (lParam) {
        case WM_LBUTTONUP:
        case WM_RBUTTONUP:
            WorkerStop();
            WorkerRestore();
        }
        return FALSE;
    }

    return FALSE;
}
开发者ID:lokhman,项目名称:magicworker,代码行数:81,代码来源:main.c


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