Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
/*
 * 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);
    }
}
Exemplo n.º 3
0
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;
}
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
}
Exemplo n.º 5
0
Bool WCreatePrevWindow( HINSTANCE inst, WMenuEditInfo *einfo )
{
    int         x, y, width, height, i;
    HWND        win;
    HMENU       sys_menu;
    RECT        rect;
    char        *title;

    if( !einfo || ( einfo->edit_dlg == (HWND)NULL ) ) {
        return ( FALSE );
    }

    win = GetDlgItem( einfo->edit_dlg, IDM_MENUEDTESTPOS );
    GetWindowRect( win, &rect );

    x = rect.left;
    y = rect.top;
    width  = 206;
    height = 63;

    title = WAllocRCString( W_PREVIEWMENU );

    einfo->preview_window =
        CreateWindow( WPrevClass, title,
                      WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
                      x, y, width, height, einfo->edit_dlg,
                      (HMENU) NULL, inst, einfo );

    if( title ) {
        WFreeRCString( title );
    }

    if( einfo->preview_window == (HWND)NULL ) {
        return( FALSE );
    }

    sys_menu = GetSystemMenu( einfo->preview_window, FALSE );
    if( sys_menu != (HMENU)NULL ) {
        i = GetMenuItemCount( sys_menu );
        for( ; i>=0; i-- ) {
            DeleteMenu( sys_menu, i, MF_BYPOSITION );
        }
    }

    SendMessage( einfo->preview_window, WM_NCACTIVATE, (WPARAM)TRUE, (LPARAM)NULL );

    return ( TRUE );
}
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;
}
Exemplo n.º 7
0
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);
		}
	}
}
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);
		*/
	}
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
void CConsole::DisableClose()
{
    CHECK(hConsole);

    HWND hWnd = GetHWND();

    // disable the [x] button if we found our console
    if(hWnd != NULL)
    {
        HMENU hMenu = GetSystemMenu(hWnd,0);
        if(hMenu != NULL)
        {
            DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
            DrawMenuBar(hWnd);
        }
    }
}
Exemplo n.º 11
0
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;
	 }
Exemplo n.º 12
0
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);
}
Exemplo n.º 13
0
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);
}
Exemplo n.º 14
0
//创建引擎窗体
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;
}
Exemplo n.º 15
0
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
}
Exemplo n.º 16
0
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);
}
Exemplo n.º 17
0
//
/// 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);
    }
}
Exemplo n.º 18
0
void CBaseDialog::OnRButtonDown(UINT nFlags, CPoint point)
{
	if ( point.y < 40 )
	{
		CMenu* pSysMenu = GetSystemMenu(FALSE);
		if ( pSysMenu != NULL )
		{
			//获取光标
			CPoint MousePoint;
			GetCursorPos(&MousePoint);

			//弹出菜单
			pSysMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,MousePoint.x,MousePoint.y,this);
		}
	}

	CSkinDialog::OnRButtonDown(nFlags, point);
}
Exemplo n.º 19
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// 创建一个视图以占用框架的工作区
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0("未能创建视图窗口\n");
		return -1;
	}
	// 修改系统菜单
	CMenu *pSystemMenu = GetSystemMenu(FALSE);
	pSystemMenu->AppendMenuW(MF_SEPARATOR);
	pSystemMenu->AppendMenuW(MF_STRING, ID_APP_ABOUT,_T("关于我(&A)"));
	return 0;
}
Exemplo n.º 20
0
static void setupSystemMenu( HWND hwnd ) {
    HMENU       smh;
    HMENU       mh;
    char        menuname[256];

    smh = GetSystemMenu( hwnd, FALSE );
    mh = GetMenu( hwnd );
    AppendMenu( smh, MF_SEPARATOR, 0,NULL );
    GetMenuString( mh, MENU_LOG_CURRENT_STATE, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_LOG_CURRENT_STATE, menuname );
    GetMenuString( mh, MENU_LOG_OPTIONS, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_LOG_OPTIONS, menuname );
    GetMenuString( mh, MENU_TASK_CTL, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_TASK_CTL, menuname );
}
Exemplo n.º 21
0
void InitDocWnd(HWND hParentWnd)
{
	HMENU hMenu;
	HICON hIcon;
	if (hDocWnd != NULL) {
		DestroyWindow(hDocWnd);
		hDocWnd = NULL;
	}
	DocWndInfoReset2(hDocWnd);
	INILoadDocWnd();
	switch(PlayerLanguage){
  	case LANGUAGE_ENGLISH:
		hDocWnd = CreateDialog
			(hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC_EN),hParentWnd,DocWndProc);
		break;
 	default:
	case LANGUAGE_JAPANESE:
		hDocWnd = CreateDialog
			(hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC),hParentWnd,DocWndProc);
	break;
	}
	hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0);
	if (hIcon!=NULL) SendMessage(hDocWnd,WM_SETICON,FALSE,(LPARAM)hIcon);
	DocWndInfoReset2(hDocWnd);
	hMenu = GetSystemMenu(DocWndInfo.hwnd,FALSE);
	switch(PlayerLanguage){
	case LANGUAGE_JAPANESE:
		AppendMenu(hMenu,MF_SEPARATOR,0,0);
		AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"フォントの選択");
		break;
 	default:
  	case LANGUAGE_ENGLISH:
		AppendMenu(hMenu,MF_SEPARATOR,0,0);
		AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"Choose Font");
		break;
	}
	DocWndInfoReset2(hDocWnd);
	INILoadDocWnd();
	DocWndInfoApply();
	ShowWindow(hDocWnd,SW_HIDE);
	UpdateWindow(hDocWnd);
	EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE);
	EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE);
}
Exemplo n.º 22
0
void CDlgVectorize::UpdateControls()
{
    CMenu* pSysMenu = GetSystemMenu(FALSE);

    if ( !pSysMenu )
    {
        return;
    }

    if ( m_pRedirect )
    {
        m_EditRun.EnableWindow(FALSE);
        //m_BtnBrowse.EnableWindow(FALSE);
        m_BtnRun.EnableWindow(FALSE);
        m_BtnStop.EnableWindow(TRUE);
        m_BtnShow.EnableWindow(FALSE);
        m_BtnExit.EnableWindow(FALSE);

        //----------------------------------------------------------------------
        //	Disable Close in System Menu (this also disables close box).
        //----------------------------------------------------------------------
        if (pSysMenu != NULL)
        {
            pSysMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
        }
    }
    else 
    {
        m_EditRun.EnableWindow(TRUE);
        //m_BtnBrowse.EnableWindow(TRUE);
        m_BtnRun.EnableWindow(m_EditRun.GetWindowTextLength() > 0);
        m_BtnStop.EnableWindow(FALSE);
        m_BtnShow.EnableWindow(TRUE);
        m_BtnExit.EnableWindow(TRUE);

        //----------------------------------------------------------------------
        //	Enable Close in System Menu (this also enables close box).
        //----------------------------------------------------------------------
        if (pSysMenu != NULL)
        {
            pSysMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
        }
    }
}
Exemplo n.º 23
0
BOOL CDlgModelManage::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	// 将“关于...”菜单项添加到系统菜单中。

	// IDM_ABOUTBOX 必须在系统命令范围内。
	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);
		}
	}
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标
	m_strModelName=GetModelName();
	SetWindowTextA(m_hWnd,m_strModelName.c_str());
	m_trayiocn.AddIcon(m_hWnd,m_hIcon,WM_USER+1234,MultCharToWideChar(m_strModelName).c_str());
	ShowWindow(SW_MAXIMIZE);
	CRect rt;
	m_listModelState.GetClientRect (&rt);
	m_listModelState.SetExtendedStyle(m_listModelState.GetExtendedStyle() |LVS_EX_HEADERDRAGDROP| LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES|LVS_EX_SUBITEMIMAGES|LVS_EX_AUTOSIZECOLUMNS);   
	m_listModelState.InsertColumn (0,_T("模块名"),LVCFMT_LEFT,100);
	m_listModelState.InsertColumn (1,_T("编号"),LVCFMT_LEFT,200);
	m_listModelState.InsertColumn (2,_T("城市名"),LVCFMT_LEFT,180);
	m_listModelState.InsertColumn (3,_T("PID"),LVCFMT_LEFT,80);
	m_listModelState.InsertColumn (4,_T("接收地址"),LVCFMT_LEFT,180);
	m_listModelState.InsertColumn (5,_T("接收量"),LVCFMT_LEFT,150);
	m_listModelState.InsertColumn (6,_T("状态"),LVCFMT_LEFT,100);
	//m_listModelState.SetImageList(&m_imgList,LVSIL_SMALL);
	m_ProManager.Initiate();
	SetTimer(IDS_UPDATE_STATES,1000,NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Exemplo n.º 24
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static int   cxClient, cyClient ;
     HDC          hdc ;
     HMENU        hMenu ;
     PAINTSTRUCT  ps ;
     
     switch (message)
     {
     case WM_CREATE:
          hMenu = GetSystemMenu (hwnd, FALSE) ;
          AppendMenu (hMenu, MF_SEPARATOR, 0, NULL) ;
          AppendMenu (hMenu, 0, 1, TEXT ("&Print")) ;
          return 0 ;
          
     case WM_SIZE:
          cxClient = LOWORD (lParam) ;
          cyClient = HIWORD (lParam) ;
          return 0 ;
          
     case WM_SYSCOMMAND:
          if (wParam == 1)
          {
               if (!PrintMyPage (hwnd))
                    MessageBox (hwnd, TEXT ("Could not print page!"),
                                szAppName, MB_OK | MB_ICONEXCLAMATION) ;
               return 0 ;
          }
          break ;
          
     case WM_PAINT :
          hdc = BeginPaint (hwnd, &ps) ;
          
          PageGDICalls (hdc, cxClient, cyClient) ;
          
          EndPaint (hwnd, &ps) ;
          return 0 ;
          
     case WM_DESTROY :
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
/*
 * Callback routine that is executed once per window class.
 * Removes or creates custom window settings depending on LPARAM
 */
static wBOOL CALLBACK
ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
{
  HICON   hicon;
  Window  wid;

  if (!hwnd) {
    ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
    return FALSE;
  }

  /* It's our baby, either clean or dirty it */
  if (lParam==FALSE) 
    {
      /* Reset the window's icon to undefined. */
      hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0);

      /* If the old icon is generated on-the-fly, get rid of it, will regen */
      winDestroyIcon (hicon);

      /* Same for the small icon */
      hicon = (HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0);
      winDestroyIcon (hicon);

      /* Remove any menu additions; bRevert=TRUE destroys any modified menus */
      GetSystemMenu (hwnd, TRUE);
      
      /* This window is now clean of our taint (but with undefined icons) */
    }
  else
    {
      /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */
      wid = (Window)GetProp (hwnd, WIN_WID_PROP);
      if (wid)
	winUpdateIcon (wid);

      /* Update the system menu for this window */
      SetupSysMenu ((unsigned long)hwnd);

      /* That was easy... */
    }

  return TRUE;
}
Exemplo n.º 26
0
void	sysmenu_init(HWND hWnd)
{
	MENUITEMINFO mii;
	HMENU hMenu = GetSystemMenu(hWnd, FALSE);

	memset(&mii, 0, sizeof(mii));
	mii.cbSize = sizeof(mii);
	mii.fMask = MIIM_TYPE | MIIM_ID;

	mii.fType = MFT_STRING;
	mii.wID = IDM_COPYALL;
	mii.dwTypeData = L"Copy All(&C)";
	mii.cch = (UINT) wcslen(mii.dwTypeData);
	InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);

	mii.fType = MFT_STRING;
	mii.wID = IDM_NEW;
	mii.dwTypeData = L"New (&N)";
	mii.cch = (UINT) wcslen(mii.dwTypeData);
	InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);

	sysmenu_init_topmost(hWnd, hMenu);

    // sysmenu_init_subconfig(hWnd, hMenu);

	mii.fType = MFT_SEPARATOR;
	mii.wID = 0;
	mii.dwTypeData = 0;
	mii.cch = 0;
	InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);

	mii.fType = MFT_STRING;
	mii.wID = IDM_ABOUT;
	mii.dwTypeData = L"About (&A)";
	mii.cch = (UINT) wcslen(mii.dwTypeData);
	InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);

	mii.fType = MFT_SEPARATOR;
	mii.wID = 0;
	mii.dwTypeData = 0;
	mii.cch = 0;
	InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);
}
Exemplo n.º 27
0
static int
OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
    HMENU hSysMenu;
    WCHAR lpAboutText[256];

    hCharmapDlg = CreateDialog(hInstance,
                               MAKEINTRESOURCE(IDD_CHARMAP),
                               hWnd,
                               CharMapDlgProc);

    hAdvancedDlg = CreateDialog(hInstance,
                               MAKEINTRESOURCE(IDD_ADVANCED),
                               hWnd,
                               AdvancedDlgProc);

    hStatusWnd = CreateWindow(STATUSCLASSNAME,
                              NULL,
                              WS_CHILD | WS_VISIBLE,
                              0, 0, 0, 0,
                              hWnd,
                              (HMENU)IDD_STATUSBAR,
                              hInstance,
                              NULL);

    // Set the status bar for multiple parts output
    SendMessage(hStatusWnd, SB_SIMPLE, (WPARAM)FALSE, (LPARAM)0);

    ChangeView(hWnd);

    hSysMenu = GetSystemMenu(hWnd, FALSE);

    if (hSysMenu != NULL)
    {
        if (LoadStringW(hInstance, IDS_ABOUT, lpAboutText, SIZEOF(lpAboutText)))
        {
            AppendMenuW(hSysMenu, MF_SEPARATOR, 0, NULL);
            AppendMenuW(hSysMenu, MF_STRING, ID_ABOUT, lpAboutText);
        }
    }

    return 0;
}
Exemplo n.º 28
0
static void WaitOnConsole()
{
  DWORD wrote;

  stdio_kills_prog = 1;
  if (console_hwnd) {
    AppendMenu(GetSystemMenu(console_hwnd, FALSE), 
	       MF_STRING,
	       SC_CLOSE,
	       "Close");
    /* Un-gray the close box: */
    RedrawWindow(console_hwnd, NULL, NULL, 
		 RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
  }

  WriteConsole(console_out, "\n[Exited. Close box or Ctrl-C closes the console.]\n", 51, &wrote, NULL);

  WaitForSingleObject(waiting_sema, INFINITE);
}
Exemplo n.º 29
0
void CVideoDlg::InitCodec(DWORD fccHandler)
{
	if (m_pVideoCodec != NULL)
		return;

	m_pVideoCodec = new CVideoCodec;
	//同样的m_pVideoCodec 是CVideoCodec类的对象
	//回到DrawDIB
	if (!m_pVideoCodec->InitCompressor(m_lpbmi, fccHandler))
	{
		delete m_pVideoCodec;
		// 置NULL, 发送时判断是否为NULL来判断是否压缩
		m_pVideoCodec = NULL;
		// 通知服务端不启用压缩
		BYTE bToken = COMMAND_WEBCAM_DISABLECOMPRESS;
		m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
		GetSystemMenu(FALSE)->EnableMenuItem(IDM_ENABLECOMPRESS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}	
}
Exemplo n.º 30
0
BOOL CDownloadMonitorDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CDownloadMonitorDlg"), IDI_DOWNLOAD_MONITOR );

	CMenu* pMenu = GetSystemMenu( FALSE );
	pMenu->InsertMenu( 0, MF_BYPOSITION|MF_SEPARATOR, ID_SEPARATOR );
	pMenu->InsertMenu( 0, MF_BYPOSITION|MF_STRING, SC_NEXTWINDOW, _T("&Always on Top") );

	CSingleLock pLock( &Transfers.m_pSection, TRUE );

	if ( Downloads.Check( m_pDownload ) )
	{
		m_sName = m_pDownload->m_sName;
		m_wndIcon.SetIcon( ShellIcons.ExtractIcon(
			ShellIcons.Get( m_sName, 32 ), 32 ) );
		m_wndFile.SetWindowText( m_sName );
	}

	pLock.Unlock();

	m_pGraph	= new CLineGraph();
	m_pItem		= new CGraphItem( 0, 1.0f, RGB( 0xFF, 0, 0 ) );

	m_pGraph->m_bShowLegend		= FALSE;
	m_pGraph->m_bShowAxis		= FALSE;
	m_pGraph->m_crBack			= RGB( 255, 255, 240 );
	m_pGraph->m_crGrid			= RGB( 220, 220, 170 );
	m_pGraph->m_nMinGridVert	= 16;

	m_pGraph->AddItem( m_pItem );

	OnTimer( 1 );

	CenterWindow();
	ShowWindow( SW_SHOW );

	SetTimer( 1, 100, NULL );
	EnableToolTips();

	return TRUE;
}