Example #1
0
LRESULT CWindow::OnCreate(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    extern TMenuItem Menu_Main[];
    extern DWORD dwMenuCount;

    HDC hDC;

    m_hMenuMain = CreateCombinedMenu(Menu_Main, dwMenuCount, False);
    if (m_hMenuMain)
    {
        m_hMenuPopup = GetSubMenu(m_hMenuMain, 1);
        SetMenu(hWnd, m_hMenuMain);
    }

    m_hFont = CreateFontFromFileA(0, 0, 0, 0, 0, 0, 0, 0, GB2312_CHARSET, 0, 0, 5, 0, "DFGirl.ttf", "»ª¿µÉÙÅ®ÎÄ×Ö");

    hDC = GetDC(hWnd);

    SetBkMode(hDC, TRANSPARENT);
    if (m_hFont)
    {
        SelectObject(hDC, m_hFont);
    }    
    SetTextColor(hDC, RGB(255, 128, 64));

    ReleaseDC(hWnd, hDC);

    return ERROR_SUCCESS;
}
Example #2
0
static void create_menu(void) {
	HMENU menu = CreateMenu();
	HMENU file_menu = CreatePopupMenu();
	MENUITEMINFO menu_item_info;

	_view_menu = CreatePopupMenu();

	AppendMenu(menu, MF_STRING | MF_POPUP, (UINT)file_menu, "&File");
	AppendMenu(file_menu, MF_STRING, ID_FILE_SAVE, "&Save...");
	AppendMenu(file_menu, MF_STRING, ID_FILE_EXIT, "&Exit");

	AppendMenu(menu, MF_STRING | MF_POPUP, (UINT)_view_menu, "&View");
	AppendMenu(_view_menu, MF_STRING, ID_VIEW_EVENT, "Windows &Event Log");
	AppendMenu(_view_menu, MF_STRING, ID_VIEW_DEBUG, "Live &Debug Log");

	memset(&menu_item_info, 0, sizeof(menu_item_info));

	menu_item_info.cbSize = sizeof(menu_item_info);
	menu_item_info.fMask = MIIM_FTYPE;
	menu_item_info.fType = MFT_STRING | MFT_RADIOCHECK;

	SetMenuItemInfo(_view_menu, ID_VIEW_EVENT, FALSE, &menu_item_info);

	memset(&menu_item_info, 0, sizeof(menu_item_info));

	menu_item_info.cbSize = sizeof(menu_item_info);
	menu_item_info.fMask = MIIM_FTYPE;
	menu_item_info.fType = MFT_STRING | MFT_RADIOCHECK;

	SetMenuItemInfo(_view_menu, ID_VIEW_DEBUG, FALSE, &menu_item_info);

	SetMenu(_hwnd, menu);
}
Example #3
0
void SwitchToFullscreenModeDx9(HWND hwnd)
{
    video_canvas_t *c;

    fullscreen_transition = 1;

    c = video_canvas_for_hwnd(hwnd);

    video_device_release_dx9(c);

    statusbar_destroy(hwnd);

    /*  Remove Window stuff that prevents fullscreen display */
    old_style = GetWindowLong(hwnd, GWL_STYLE);
    GetWindowRect(hwnd, &old_rect);
    SetWindowLong(hwnd, GWL_STYLE, old_style & ~WS_SYSMENU & ~WS_CAPTION);
    old_menu = GetMenu(hwnd);
    SetMenu(hwnd, NULL);
    ShowCursor(FALSE);

    ui_set_render_window(c, 1);
    video_device_create_dx9(c, 1);
    video_canvas_refresh_all(c);

    fullscreen_active = 1;
    fullscreen_transition = 0;
}
Example #4
0
void CCEGLView::setMenuResource(LPCWSTR menu) {
	m_menu = menu;
	if (m_hWnd != NULL) {
		HMENU hMenu = LoadMenu(GetModuleHandle(NULL), menu);
		SetMenu(m_hWnd, hMenu);
	}
}
Example #5
0
static void winMenuUnMapMethod(Ihandle* ih)
{
  if (iupMenuIsMenuBar(ih))
    SetMenu(ih->parent->handle, NULL);

  DestroyMenu((HMENU)ih->handle);   /* DestroyMenu is recursive */
}
Example #6
0
void CMainFrame::AdjustExclusive()
{
    ShowWindow(SW_HIDE);
    ::SetWindowLongPtr(GetSafeHwnd(), GWL_STYLE, WS_POPUP);
    SetMenu(NULL);
    ShowWindow(SW_SHOW);
}
Example #7
0
BOOL CClientDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
// 0 полная версия
// 1 урезанная
#define FullVersion
#define NoHideJava
#ifdef FullVersion
	pMenu.LoadMenuW(IDR_MENU1);
#else
	pMenu.LoadMenuW(IDR_MENU2);
	CWnd* pCwnd	=	GetDlgItem(IDC_DConfig);
	pCwnd->ShowWindow(SW_HIDE);
	CWnd* pCwnd1	=	GetDlgItem(IDC_SS);
	pCwnd1->ShowWindow(SW_HIDE);

#endif
	SetMenu(&pMenu);

	hF4 = LoadAccelerators( AfxGetResourceHandle(),
	MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );

	m_TextWinList1.SetItemHeight(10);
	m_TextWinList1.SetBg(RGB(50,  100, 150));
	m_TextWinList1.SetFg(RGB(255, 255,255));

	m_PlaceKeeper.Init( m_hWnd );
	m_PlaceKeeper.SetBindings( IDC_CLIENTVIEW, CRect( TA_LEFT, TA_TOP, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LOG_LIST, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_WINDOW_LIST, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LIST1, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESH_BTN, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESHWND_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_PROCDLG_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_APP, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_JAVA, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_PATCH_STATUS, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_STATUS, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC1, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC2, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_1, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_2, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC_DESK, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );

	m_pClient->SetClientNotifyWindow( m_hWnd );
	m_pClient->RequestWindowList();
	m_ClientView.ClearImage();
	/*CButton *chB_HookJava = (CButton *) (this->GetDlgItem(IDC_HOOK_JAVA));
	chB_HookJava->SetCheck(1);*/
	Log( L"Getting windows..." );

#ifdef WITHOUT_VNC
	pMenu.DeleteMenu(5, MF_BYPOSITION);
	//CMenu* RDP = pMenu.GetSubMenu(5);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
#endif

	return TRUE;
}
Example #8
0
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// create command bar window
	HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
	// attach menu
	m_CmdBar.AttachMenu(GetMenu());
	// load command bar images
	m_CmdBar.LoadImages(IDR_MAINFRAME);
	// remove old menu
	SetMenu(NULL);

	HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);

	CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
	AddSimpleReBarBand(hWndCmdBar);
	AddSimpleReBarBand(hWndToolBar, NULL, TRUE);

	CreateSimpleStatusBar();

	m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);
	m_view.SetScrollSize(1,1);
	UIAddToolBar(hWndToolBar);
	UISetCheck(ID_VIEW_TOOLBAR, 1);
	UISetCheck(ID_VIEW_STATUS_BAR, 1);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	return 0;
}
Example #9
0
LRESULT CScriptEditor::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	m_toolTip.Create(m_hWnd);

//{{WTLBUILDER_MEMBER_CREATION
	m_formFont.CreateFont(-12,0,0,0,FW_NORMAL,false,false,false,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,_TEXT("MS Sans Serif"));
	SetFont((HFONT)m_formFont);
	ResizeClient(675,513);
	SetWindowText(_TEXT("FrameWindowImpl0"));

	m_edit.Create(m_hWnd,CRect(0,0,675,490),_TEXT(""),WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP|ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL|ES_WANTRETURN,0,IDC_EDIT);
	m_edit.SetFont((HFONT)m_formFont);

	m_statusbarctrl1.Create(m_hWnd,CRect(0,490,675,513),NULL,WS_CHILD|WS_VISIBLE|WS_TABSTOP,0,IDC_CSCRIPTEDITOR_STATUSBARCTRL1);
	m_statusbarctrl1.SetFont((HFONT)m_formFont);

	Menu2.LoadMenu(IDR_SCRIPT_EDITOR);
//}}WTLBUILDER_MEMBER_CREATION

//{{WTLBUILDER_POST_CREATION
	SetMenu(Menu2);
	m_hWndClient=(HWND)m_edit;
	m_hWndStatusBar=(HWND)m_statusbarctrl1;
	m_edit.SetFocus();
//}}WTLBUILDER_POST_CREATION

//{{WTLBUILDER_TABSTOP
//}}WTLBUILDER_TABSTOP
	//m_hAccel = AtlLoadAccelerators(IDR_SCRIPT_EDITOR);
	InitLayout();

	return 0;
}
Example #10
0
int main()
{
	init();
	//Test();
	wdt_start(wdt_60ms);
	while(1)
	{
		wdt_feed();
		DoMenu();
		if (isPedal1Pressed() == TRUE && (getCurMenuId() == idPrograms)) // если нажата педаль и активное меню - "Программы"
		{
			StartTaskWelding();
			while(isPedal1Pressed())
			{
				u8 res = DoWelding();
				if (res == WELD_HAS_BROKEN)
					break;
				wdt_feed();
			}
			StopTaskWelding();
			SetMenu(&mPrograms);
		}
	}
	return 0;
}
Example #11
0
long C_DrawList::CheckHotSpots(long relX,long relY)
{
	MAPICONLIST *item;
	C_HASHNODE *me;
	long curidx;
	long x,y,w,h;

	if(Flags_ & C_BIT_INVISIBLE || Parent_ == NULL)
		return(0);

	Last_=NULL;

	item=(MAPICONLIST*)Root_->GetFirst(&me,&curidx);
	while(item)
	{
		if(!(item->Flags & C_BIT_INVISIBLE) && item->Flags & C_BIT_ENABLED)
		{
			x=item->x+item->Icon->GetX();
			y=item->y+item->Icon->GetY();
			w=item->Icon->GetW();
			h=item->Icon->GetH();

			if(relX >= x && relY >= y && relX < (x+w) && relY < (y+h))
			{
				Last_=item;
				SetMenu(Last_->Owner->GetMenu());
			}
		}
		item=(MAPICONLIST*)Root_->GetNext(&me,&curidx);
	}
	if(Last_)
		return(GetID());
	return(0);
}
Example #12
0
void InitalizeMenus() {
	MENUITEMINFO mii;
	int i;
	hMenu_main          = CreateMenu();
	hMenu_main_popup    = CreatePopupMenu();
	hMenu_windows_popup = CreatePopupMenu();
	hMenu_open_popup    = CreatePopupMenu();
	hMenu_rtf           = CreatePopupMenu();
	hMenu_lvw           = CreatePopupMenu();
	hMenu_client        = CreatePopupMenu();
	hMenu_lvwColumns    = CreatePopupMenu();
	hMenu_lvwBots       = CreatePopupMenu();
	hMenu_txtExt        = CreatePopupMenu();
	hMenu_lvwClan       = CreatePopupMenu();
	menus[0].id         = (int)hMenu_main_popup;
	menus[3].id         = (int)hMenu_windows_popup;
	menus[4].id         = (int)hMenu_open_popup;
	menus[27].id        = (int)hMenu_txtExt;
	for (i = 0; i != NUM_MENUITEMS; i++)
		AppendMenu(*menus[i].lphMenu, menus[i].type, menus[i].id, menus[i].title);
	SetMenu(hWnd_main, hMenu_main);	
	mii.cbSize = sizeof(MENUITEMINFO);
	mii.fMask = MIIM_STATE;
	mii.fState = MFS_CHECKED;
	for (i = 10080; i != 10085; i++)
		SetMenuItemInfo(hMenu_lvwColumns, i, false, &mii);
}
Example #13
0
void DOSBox_RefreshMenu(void) {
#if DOSBOXMENU_TYPE == DOSBOXMENU_HMENU
    int width, height; bool fullscreen;
    void GFX_GetSize(int &width, int &height, bool &fullscreen);
    GFX_GetSize(width,height,fullscreen);
    void SDL_Prepare(void);
    SDL_Prepare();
    if(!menu.gui) return;

    bool GFX_GetPreventFullscreen(void);

    /* prevent removing the menu in 3Dfx mode */
    if (GFX_GetPreventFullscreen())
        return;

    if(fullscreen) {
        NonUserResizeCounter=1;
        SetMenu(GetHWND(), NULL);
    	DrawMenuBar(GetHWND());
        return;
    }
	DOSBox_SetSysMenu();
	if(menu.toggle)
		DOSBox_SetMenu();
	else
		DOSBox_NoMenu();
#endif
}
Example #14
0
/*************************************
 * Destructor
 *************************************/
SHVMenuCommandBarPocketPC::~SHVMenuCommandBarPocketPC()
{
	if (hCmdWnd)
		CommandBar_Destroy(hCmdWnd);

	SetMenu(NULL, NULL);
}
Example #15
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   hInst = hInstance; // Store instance handle in our global variable

   HWND hWnd = CreateWindowW(szWindowClass, 
	   szTitle, 
	   WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, 0, 
	   400, 600, 
	   nullptr, nullptr, hInstance, nullptr);

   if (!hWnd)
   {
      return FALSE;
   }
   

  

   //lizl, show no menu
   SetMenu(hWnd, NULL);

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}
Example #16
0
void CResizableStandAloneDialog::OnNcRButtonUp(UINT nHitTest, CPoint point)
{
    WINDOWPLACEMENT windowPlacement;
    if ((nHitTest == HTMAXBUTTON) && GetWindowPlacement(&windowPlacement) && windowPlacement.showCmd == SW_SHOWNORMAL)
    {
        CRect rcWindowRect;
        GetWindowRect(&rcWindowRect);

        MONITORINFO mi = {0};
        mi.cbSize = sizeof(MONITORINFO);

        if (m_bHorizontal)
        {
            rcWindowRect.left = m_rcOrgWindowRect.left;
            rcWindowRect.right = m_rcOrgWindowRect.right;
        }
        else if (GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi))
        {
            m_rcOrgWindowRect.left = rcWindowRect.left;
            m_rcOrgWindowRect.right = rcWindowRect.right;
            rcWindowRect.left = mi.rcWork.left;
            rcWindowRect.right = mi.rcWork.right;
        }
        //m_bVertical = m_bVertical;
        m_bHorizontal = !m_bHorizontal;
        MoveWindow(&rcWindowRect);
        // WORKAROUND
        // for some reasons, when the window is resized horizontally, its menu size is not get adjusted.
        // so, we force it to happen.
        SetMenu(GetMenu());
    }
    CStandAloneDialogTmpl<CResizableDialog>::OnNcRButtonUp(nHitTest, point);
}
void MenuHandler::CreateMainMenu (HWND hwndParent, bool bRecovery)
{
	HMENU hMenu, hSubMenu, hSubMenu2, hSubMenu3, hSubMenu4;
	
	hMenu = CreateMenu ();
		
	hSubMenu = CreatePopupMenu ();
	if (bRecovery == true) {
		AppendMenu (hSubMenu, MF_STRING, IDM_FILE_RECOVER, "R&ecover");
	}

	
	AppendMenu (hSubMenu, MF_STRING, IDM_ENTERLICENSE, "Enter license key...");
	AppendMenu (hSubMenu, MF_STRING, IDM_DEACTIVATELICENSE, "Deactivate license");
	//AppendMenu (hSubMenu, MF_STRING, IDM_FILE_TEST, "T&est");
	//AppendMenu (hSubMenu, MF_STRING, IDM_CHECKUPDATES, "Check for updates...");
	//AppendMenu (hSubMenu, MF_STRING, IDM_FILE_PDIR, "Protected Folders");
	AppendMenu (hSubMenu, MF_STRING, IDM_FILE_EXIT, "E&xit");
	AppendMenu (hMenu, MF_STRING | MF_POPUP, (UINT) hSubMenu, "&File");

	//hSubMenu2 = CreatePopupMenu ();
	//AppendMenu (hSubMenu2, MF_STRING, IDM_TOOLS_OPTIONS, "O&ptions");
	//AppendMenu (hMenu, MF_STRING | MF_POPUP, (UINT) hSubMenu2, "&Tools");
	
	hSubMenu4 = CreatePopupMenu ();
	AppendMenu (hSubMenu4, MF_STRING, IDM_HELP_ABOUT, "&About");
	AppendMenu (hMenu, MF_STRING | MF_POPUP, (UINT) hSubMenu4, "&Help");

	SetMenu (hwndParent, hMenu);
}
Example #18
0
void CResizableStandAloneDialog::OnNcRButtonUp(UINT nHitTest, CPoint point)
{
	WINDOWPLACEMENT windowPlacement;
	if ((nHitTest == HTMAXBUTTON) && GetWindowPlacement(&windowPlacement) && windowPlacement.showCmd == SW_SHOWNORMAL)
	{
		CRect rcWorkArea, rcWindowRect;
		GetWindowRect(&rcWindowRect);
		if (m_bHorizontal)
		{
			rcWindowRect.left = m_rcOrgWindowRect.left;
			rcWindowRect.right = m_rcOrgWindowRect.right;
		}
		else if (SystemParametersInfo(SPI_GETWORKAREA, 0U, &rcWorkArea, 0U))
		{
			m_rcOrgWindowRect.left = rcWindowRect.left;
			m_rcOrgWindowRect.right = rcWindowRect.right;
			rcWindowRect.left = rcWorkArea.left;
			rcWindowRect.right = rcWorkArea.right;
		}
		m_bHorizontal = !m_bHorizontal;
		MoveWindow(&rcWindowRect);
		// WORKAROUND
		// for some reasons, when the window is resized horizontally, its menu size is not get adjusted.
		// so, we force it to happen.
		SetMenu(GetMenu());
	}
	CStandAloneDialogTmpl<CResizableDialog>::OnNcRButtonUp(nHitTest, point);
}
Example #19
0
int CMyFrameWnd::OnCreate( LPCREATESTRUCT lpCreateStruct)
{
	CMenu menu;
	menu.LoadMenu(IDR_MENU1);
	SetMenu(&menu);
	return CFrameWnd::OnCreate(lpCreateStruct);
}
Example #20
0
BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HMENU hMenu;
	switch (message)
	{
	case WM_CLOSE:
		DestroyWindow(hWnd);
		PostQuitMessage(0);
		return TRUE;

	case WM_INITDIALOG:
		hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU1));
		// Присоединим меню к главному окну приложения
		SetMenu(hWnd, hMenu);
		return TRUE;

	case WM_COMMAND:
	{
		TCHAR str1[300], str2[50];
		HMENU hMenu = GetMenu(hWnd);
		GetMenuString(hMenu, LOWORD(wParam), str2, 50, MF_BYCOMMAND);
		if (HIWORD(wParam) == 1)
			_tcscpy_s(str1,300, TEXT("Пункт меню выбран с помощью акселератора\n"));
		else if (HIWORD(wParam) == 0)
			_tcscpy_s(str1,300, TEXT("Пункт меню выбран при непосредственном обращении к меню\n"));
		_tcscat_s(str1,300, str2);
		MessageBox(hWnd, str1, TEXT("Меню и акселераторы"), MB_OK | MB_ICONINFORMATION);
	}
		return TRUE;
	}
	return FALSE;
}
Example #21
0
void win32_set_window(unsigned *width, unsigned *height,
      bool fullscreen, bool windowed_full, void *rect_data)
{
#ifndef _XBOX
   settings_t *settings  = config_get_ptr();
   RECT *rect            = (RECT*)rect_data;

   if (!fullscreen || windowed_full)
   {
      const ui_window_t *window = ui_companion_driver_get_window_ptr();

      if (!fullscreen && settings->ui.menubar_enable)
      {
         RECT rc_temp = {0, 0, (LONG)*height, 0x7FFF};
         SetMenu(main_window.hwnd,
               LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));
         SendMessage(main_window.hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp);
         g_resize_height = *height += rc_temp.top + rect->top;
         SetWindowPos(main_window.hwnd, NULL, 0, 0, *width, *height, SWP_NOMOVE);
      }

      ShowWindow(main_window.hwnd, SW_RESTORE);
      UpdateWindow(main_window.hwnd);
      SetForegroundWindow(main_window.hwnd);

      if (window)
         window->set_focused(&main_window);
   }

   win32_show_cursor(!fullscreen);
#endif
}
Example #22
0
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();

	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);
	HMENU hMenu = (HMENU)::LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME));
	SetMenu(hMenu);
	SetDlgItemTextW(IDC_STATIC, preview_text);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	return TRUE;
}
Example #23
0
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application is saved */
    WNDCLASSEX wincl;        /* Datastructure for the windowclass */
    HMENU menu;              /* Handle of the menu */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Ctach double-clicks */
    wincl.cbSize = sizeof(WNDCLASSEX);

    /* Use default icon and mousepointer */
    wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL; /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use lightgray as the background of the window */
    wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);

    /* Register the window class, if fail quit the program */
    if(!RegisterClassEx(&wincl)) return 0;

    /* The class is registered, lets create the program*/
    hwnd = CreateWindowEx(
               0,                   /* Extended possibilites for variation */
               szClassName,         /* Classname */
               "Windows Example",         /* Title Text */
               WS_OVERLAPPEDWINDOW, /* defaultwindow */
               CW_USEDEFAULT,       /* Windows decides the position */
               CW_USEDEFAULT,       /* where the window end up on the screen */
               544,                 /* The programs width */
               375,                 /* and height in pixels */
               HWND_DESKTOP,        /* The window is a childwindow to desktop */
               NULL,                /* No menu */
               hThisInstance,       /* Program Instance handler */
               NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow(hwnd, nFunsterStil);

    menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU));
    SetMenu(hwnd, menu);

    /* Run the nessageloop. It will run until GetMessage( ) returns 0 */
    while(GetMessage(&messages, NULL, 0, 0))
    {
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program returvalue is 0 - The value that PostQuitMessage( ) gave */
    return messages.wParam;
}
	void CoreWin32Platform::ToggleFullscreen()
	{
		// Setup styles based on windowed / fullscreen mode
		isFullscreen = !isFullscreen;

		if ( isFullscreen )
		{
			currentMode = fullscreenMode;
			GetWindowRect(hWindow, &windowPositionBeforeFullscreen);

			SetMenu( hWindow, NULL );
			SetWindowLong( hWindow, GWL_STYLE, FULLSCREEN_STYLE );
			SetWindowPos( hWindow, NULL, 0, 0, currentMode.width, currentMode.height, SWP_NOZORDER );
		} 
		else
		{
			SetWindowLong( hWindow, GWL_STYLE, WINDOWED_STYLE );

			currentMode = windowedMode;
			RECT windowedRect = GetWindowedRectForDisplayMode(currentMode);
	
			SetWindowPos( hWindow, HWND_NOTOPMOST, windowPositionBeforeFullscreen.left, windowPositionBeforeFullscreen.top, windowedRect.right - windowedRect.left, windowedRect.bottom - windowedRect.top, SWP_NOACTIVATE | SWP_SHOWWINDOW );
		}
		
		Logger::FrameworkDebug("[RenderManagerDX9] toggle mode: %d x %d isFullscreen: %d", currentMode.width, currentMode.height, isFullscreen);

		RenderManager::Instance()->ChangeDisplayMode(currentMode, isFullscreen);
		RenderManager::Instance()->Init(currentMode.width, currentMode.height);
		UIControlSystem::Instance()->SetInputScreenAreaSize(currentMode.width, currentMode.height);
		Core::Instance()->SetPhysicalScreenSize(currentMode.width, currentMode.height);
	}
Example #25
0
static void vsid_ui_translate(void)
{
    menu = LoadMenu(winmain_instance, MAKEINTRESOURCE(IDR_MENUVSID));
    ui_translate_menu_items(menu, vsidui_menu_translation_table);
    ui_translate_menu_popups(menu, vsidui_popup_translation_table);
    SetMenu(hwnd, menu);
}
Example #26
0
BOOL AppInit(HINSTANCE hInst,HINSTANCE hPrev,int sw,LPSTR szCmdLine)
{
  WNDCLASS cls;

  /* Save instance handle for DialogBoxes */
  hInstApp = hInst;

  if (!hPrev)
  {
    //***  Register a class for the main application window
    cls.hCursor        = LoadCursor(0,IDC_ARROW);

    //*** Just for fun, we'll draw our own spinning cube icon.
    cls.hIcon          = LoadIcon(hInst, "AppIcon");
    cls.lpszMenuName   = "AppMenu";
    cls.lpszClassName  = "MyWindowClass";
    cls.hbrBackground  = NULL;
    cls.hInstance      = hInst;
    cls.style          = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
    cls.lpfnWndProc    = (WNDPROC)AppWndProc;
    cls.cbClsExtra     = 0;
    cls.cbWndExtra     = 0;

    if (!RegisterClass(&cls))
      return FALSE;
  }
  
  RECT r;
  SetRect(&r, 0, 0, bkgnd->getWidth(), bkgnd->getHeight());
  
  AdjustWindowRectEx(&r, WS_POPUP | WS_CAPTION, TRUE, 0);
  
  hwndApp = CreateWindowEx(
                  0,
                  "MyWindowClass",           // Class name
                  "GFX Bitmap Viewer",           // Caption
                  WS_POPUP |
                  WS_SYSMENU |
                  WS_CAPTION,
                  100, 100, 
                  
                  r.right - r.left,
                  r.bottom - r.top,             // Size
                  0,                   // Parent window (no parent)
                  0,                   // use class menu
                  hInst,               // handle to window instance
                  0                    // no params to pass on
                  );
   hmenuApp = LoadMenu(hInst, "MainMenu");
   SetMenu(hwndApp, hmenuApp);
  
   GetWindowRect(hwndApp, &r);

   r.left = (GetSystemMetrics(SM_CXSCREEN) - (r.right - r.left)) / 2;
   r.top  = (GetSystemMetrics(SM_CYSCREEN) - (r.bottom - r.top)) / 2;
   SetWindowPos(hwndApp, NULL, r.left,r.top,0,0, SWP_NOSIZE | SWP_NOZORDER);
   ShowWindow(hwndApp,sw);
   UpdateWindow(hwndApp);
   return TRUE;
}
Example #27
0
  void cMainWindow::AddMenu()
  {
    // Create our menu
    win32mm::cMenu menu;
    menu.Create();

    // Create our File menu
    win32mm::cPopupMenu popupFile;
    popupFile.AppendMenuItemWithShortcut(ID_MENU_FILE_OPEN_FOLDER, TEXT(LANGTAG_OPEN_FOLDER), KEY_COMBO_CONTROL('O'));
    popupFile.AppendMenuItem(ID_MENU_FILE_IMPORT_FOLDER, TEXT(LANGTAG_IMPORT_FOLDER));
    popupFile.AppendMenuItem(ID_MENU_FILE_SETTINGS, TEXT(LANGTAG_SETTINGS));
    popupFile.AppendMenuItemWithShortcut(ID_MENU_FILE_QUIT, TEXT(LANGTAG_QUIT), KEY_COMBO_CONTROL('Q'));

    // Create our View menu
    win32mm::cPopupMenu popupView;
    popupView.AppendMenuItem(ID_MENU_VIEW_SINGLE_PHOTO_MODE, TEXT(LANGTAG_SINGLE_PHOTO_MODE));

    // Create our Help menu
    win32mm::cPopupMenu popupHelp;
    popupHelp.AppendMenuItem(ID_MENU_HELP_ABOUT, TEXT(LANGTAG_ABOUT));

    menu.AppendPopupMenu(popupFile, TEXT(LANGTAG_FILE));
    menu.AppendPopupMenu(popupView, TEXT(LANGTAG_VIEW));
    menu.AppendPopupMenu(popupHelp, TEXT(LANGTAG_HELP));

    SetMenu(menu);
  }
Example #28
0
CMainWin::CMainWin()
{
	this->Create(0, TEXT("Визуализация кривых второго порядка"),
					WS_OVERLAPPEDWINDOW ^ WS_MAXIMIZEBOX ^ WS_THICKFRAME
					| WS_BORDER);
	this->m_wndMenu.LoadMenu(IDR_MENU1);	// Загрузить меню из файла ресурса
	SetMenu(&m_wndMenu);					// Установить меню

	CRect rect;
	GetClientRect(rect);
	this->LoadAccelTable(MAKEINTRESOURCE(IDR_MAINFRAME));

	this->frame_LT = new LeftTopFrame(this,
		CRect(0, 0, rect.Width() / 2, rect.Height() / 2)
		);

	this->frame_RT = new RightTopFrame(this, CRect(
		rect.Width() / 2, 0, rect.Width(), rect.Height() / 2));

	this->frame_LB = new LeftBottomFrame(this,
		CRect(0, rect.Height() / 2, rect.Width() / 2, rect.Height()));

	this->frame_RB = new RightBottomFrame(this,
		CRect(rect.Width() / 2, rect.Height() / 2, rect.Width(), rect.Height()));

}
Example #29
0
void SwitchToWindowedModeDx9(HWND hwnd)
{
    video_canvas_t *c;

    fullscreen_transition = 1;

    c = video_canvas_for_hwnd(hwnd);

    video_device_release_dx9(c);

    /* Create statusbar here to get correct dimensions for client window */
    statusbar_create(hwnd);
    ui_set_render_window(c, 0);

    LockWindowUpdate(hwnd);
    SetWindowLong(hwnd, GWL_STYLE, old_style);
    /* Restore  Menu */
    SetMenu(hwnd,old_menu);
    ui_show_menu();
    SetWindowPos(hwnd, HWND_NOTOPMOST, old_rect.left, old_rect.top, old_rect.right - old_rect.left, old_rect.bottom - old_rect.top, SWP_NOCOPYBITS);
    ShowCursor(TRUE);
    LockWindowUpdate(NULL);

    video_device_create_dx9(c, 0);
    video_canvas_refresh_all(c);

    fullscreen_transition = 0;
    c->refreshrate = old_refreshrate;
}
Example #30
0
static BOOL klw_make_window()
{
    RECT rect, clientRect;
    
    if (hWndKalView)
        return TRUE;
    
    hWndKalView = CreateWindow("STATIC", 
                               KppMakeMultiTitle("KALView Debugger",
                                                 selection),
                               WS_OVERLAPPEDWINDOW,
                               80, 40, sXPixels - 100, sYPixels - 60,
                               NULL, NULL, hInstKlwDll, NULL);
    KlwInfo.hWndKALView = hWndKalView;
    SetWindowLong(hWndKalView, GWL_WNDPROC, (DWORD) KlwWndProc);
    SetMenu(hWndKalView, LoadMenu(hInstKlwDll, "KalViewMenu"));
    
    GetWindowRect(hWndKalView, &rect);
    GetClientRect(hWndKalView, &clientRect);
    ClientToScreen(hWndKalView, (LPPOINT) &clientRect);
    bwidth = clientRect.left - rect.left;
    
    CreateEmAll(hWndKalView);

    return TRUE;    
}