void DX10App::Start()
{
	if(!mShowMouse)
	{
		WINDOWPLACEMENT wPos;
		GetWindowPlacement( hMainWnd, &wPos );
		SetCursorPos(wPos.rcNormalPosition.left + 100, wPos.rcNormalPosition.top + 100);
	}

	mSwapBuffers->begin();

	
	//gDevice->ClearDepthStencilView( mSwapBuffers->getRenderTargets()->DSV, D3D10_CLEAR_DEPTH|D3D10_CLEAR_STENCIL, 1.0f, 0);

	float blendFactor[] = {0.0f, 0.0f, 0.0f, 0.0f};
	gDevice->OMSetBlendState(0, blendFactor, 0xffffffff);
}
Example #2
0
void CMainFrame::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CMyCommApp * myApp = (CMyCommApp *)AfxGetApp();
	AfxGetApp()->WriteProfileString("Version","VER",myApp->m_AppVersion);

	WINDOWPLACEMENT   WndStatus;  
	GetWindowPlacement(&WndStatus);  
	AfxGetApp()->WriteProfileInt("Layout","FLAG",WndStatus.flags);  
	AfxGetApp()->WriteProfileInt("Layout","SHOWCMD",WndStatus.showCmd);  
	AfxGetApp()->WriteProfileInt("Layout","LEFT",WndStatus.rcNormalPosition.left);  
	AfxGetApp()->WriteProfileInt("Layout","RIGHT",WndStatus.rcNormalPosition.right);  
	AfxGetApp()->WriteProfileInt("Layout","TOP",WndStatus.rcNormalPosition.top);  
	AfxGetApp()->WriteProfileInt("Layout","BOTTOM",WndStatus.rcNormalPosition.bottom); 
	
	CFrameWnd::OnClose();
}
Example #3
0
LRESULT CALLBACK CWindow::stWinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    CWindow * pWnd = nullptr;

    if (uMsg == WM_NCCREATE)
    {
        // get the pointer to the window from lpCreateParams which was set in CreateWindow
        SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)((LPCREATESTRUCT(lParam))->lpCreateParams));
    }

    // get the pointer to the window
    pWnd = GetObjectFromWindow(hwnd);

    // if we have the pointer, go to the message handler of the window
    // else, use DefWindowProc
    if (pWnd)
    {
        switch (uMsg)
        {
        case WM_ACTIVATE:
            if ((wParam == WA_ACTIVE)&&(!pWnd->bWindowRestored)&&(!pWnd->sRegistryPath.empty()))
            {
                WINDOWPLACEMENT wpl = {0};
                DWORD size = sizeof(wpl);
                if (SHGetValue(HKEY_CURRENT_USER, pWnd->sRegistryPath.c_str(), pWnd->sRegistryValue.c_str(), REG_NONE, &wpl, &size) == ERROR_SUCCESS)
                    SetWindowPlacement(hwnd, &wpl);
                else
                    ShowWindow(hwnd, SW_SHOW);
                pWnd->bWindowRestored = true;
            }
            break;
        case WM_CLOSE:
            if (!pWnd->sRegistryPath.empty())
            {
                WINDOWPLACEMENT wpl = {0};
                wpl.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(hwnd, &wpl);
                SHSetValue(HKEY_CURRENT_USER, pWnd->sRegistryPath.c_str(), pWnd->sRegistryValue.c_str(), REG_NONE, &wpl, sizeof(wpl));
            }
            break;
        }
        return pWnd->WinMsgHandler(hwnd, uMsg, wParam, lParam);
    }
    else
        return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
Example #4
0
void force_normal(HWND hwnd)
{
    static int recurse = 0;

    WINDOWPLACEMENT wp;

    if (recurse)
	return;
    recurse = 1;

    wp.length = sizeof(wp);
    if (GetWindowPlacement(hwnd, &wp) && wp.showCmd == SW_SHOWMAXIMIZED) {
	wp.showCmd = SW_SHOWNORMAL;
	SetWindowPlacement(hwnd, &wp);
    }
    recurse = 0;
}
Example #5
0
/*
** Dialog procedure for the Manage dialog.
**
*/
INT_PTR CALLBACK CDialogManage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (!c_Dialog)
	{
		if (uMsg == WM_INITDIALOG)
		{
			c_Dialog = new CDialogManage(hWnd);
			return c_Dialog->OnInitDialog(wParam, lParam);
		}
	}
	else
	{
		switch (uMsg)
		{
		case WM_ACTIVATE:
			return c_Dialog->OnActivate(wParam, lParam);

		case WM_COMMAND:
			return c_Dialog->OnCommand(wParam, lParam);

		case WM_NOTIFY:
			return c_Dialog->OnNotify(wParam, lParam);

		case WM_CLOSE:
			PostMessage(hWnd, WM_DELAYED_CLOSE, 0, 0);
			return TRUE;

		case WM_DESTROY:
			delete c_Dialog;
			c_Dialog = NULL;
			return FALSE;

		case WM_DELAYED_CLOSE:
			GetWindowPlacement(hWnd, &c_WindowPlacement);
			if (c_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
			{
				c_WindowPlacement.showCmd = SW_SHOWNORMAL;
			}
			DestroyWindow(hWnd);
			return TRUE;
		}
	}

	return FALSE;
}
Example #6
0
void RedrawTitleBar( HWND hWnd, bool active )
{
	if ( !pShared )
		return;

	WaitForSingleObject( CommMutex, INFINITE );
	if ( pShared->TitleBar[0] == 0 )
	{
		ReleaseMutex( CommMutex );
		return;
	}

	int len = (int)strlen( pShared->TitleBar );
	if ( len >= 1024 )
		len = 1023;

	WINDOWPLACEMENT place;
	RECT rect;
	HDC hDC = GetWindowDC( hWnd );//WINDOW dc allows us to draw on the non client area
	
	GetWindowPlacement( hWnd, &place );
	GetWindowRect( hWnd, &rect );

	// Change the coords (believe me, okay?)
	rect.top = GetSystemMetrics(SM_CYFRAME);
	rect.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);

	rect.right = ( rect.right - rect.left ) - ( 4*GetSystemMetrics(SM_CXSIZE) + GetSystemMetrics(SM_CXFRAME) );
	rect.left = GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXSMICON) + 5;

	if ( hThemes )
	{
		HTHEME hTheme = zOpenThemeData( hWnd, L"WINDOW" );
		DrawColorTitleBar( hTheme, hWnd, hDC, active, place.showCmd == SW_MAXIMIZE, pShared->TitleBar, len, rect );
		zCloseThemeData( hTheme );
	}
	else
	{
		rect.left += GetSystemMetrics(SM_CXFRAME);
		DrawColorTitleBar( NULL, hWnd, hDC, active, place.showCmd == SW_MAXIMIZE, pShared->TitleBar, len, rect );
	}

	ReleaseDC( hWnd, hDC );
	ReleaseMutex( CommMutex );
}
Example #7
0
void Window::SaveWindowState()
{
    WINDOWPLACEMENT wp;
    wp.length=sizeof(WINDOWPLACEMENT);
    GetWindowPlacement(hWnd,&wp);

    if (Flags & W_SAVESTATE)
    {
        char *temp="Normal";
        BOOL RestToMax=wp.flags & WPF_RESTORETOMAXIMIZED;
        if (wp.showCmd==SW_SHOWMAXIMIZED ||
                ( wp.showCmd==SW_SHOWMINIMIZED && !(Flags & W_SAVEMIN) && RestToMax ) ) temp="Maximized";
        else if ( (Flags & W_SAVEMIN) && (wp.showCmd==SW_SHOWMINIMIZED)) temp= RestToMax ? "MinFromMax" : "Minimized";
        else if ( wp.showCmd==SW_HIDE) temp="Hidden";
        WriteIniString(Name,"State",temp);
    }
    WriteIniString(Name,"Window",	String()<< (int) wp.rcNormalPosition.left << ',' << (int) wp.rcNormalPosition.top << ',' << (int) wp.rcNormalPosition.right  << ',' << (int) wp.rcNormalPosition.bottom);
}
Example #8
0
static INT_PTR SaveWindowPosition(WPARAM, LPARAM lParam)
{
	SAVEWINDOWPOS *swp = (SAVEWINDOWPOS*)lParam;
	WINDOWPLACEMENT wp;
	char szSettingName[64];

	wp.length = sizeof(wp);
	GetWindowPlacement(swp->hwnd, &wp);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.left);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.top);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.right-wp.rcNormalPosition.left);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top);
	return 0;
}
BOOL CDlgScraperOutput::DestroyWindow()
{
	WINDOWPLACEMENT		wp;
	CMainFrame			*pMyMainWnd  = (CMainFrame *) (theApp.m_pMainWnd);

	// Save settings to registry
	GetWindowPlacement(&wp);
	prefs.set_scraper_x(wp.rcNormalPosition.left);
	prefs.set_scraper_y(wp.rcNormalPosition.top);
	prefs.set_scraper_dx(wp.rcNormalPosition.right - wp.rcNormalPosition.left);
	prefs.set_scraper_dy(wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
	prefs.set_scraper_zoom(m_Zoom.GetCurSel());

	// Uncheck scraper output button on main toolbar
	pMyMainWnd->m_MainToolBar.GetToolBarCtrl().CheckButton(ID_MAIN_TOOLBAR_SCRAPER_OUTPUT, false);

	return CDialog::DestroyWindow();
}
Example #10
0
void CAllToolSetupSheet::OnPaint() 
{
	WINDOWPLACEMENT wp;
	RECT rect;

	wp.length = sizeof(WINDOWPLACEMENT);  //not sure if this is still required, but what the hey 
	GetWindowPlacement(&wp);

	if (InitDialogComplete && wp.showCmd!=SW_SHOWMAXIMIZED && wp.showCmd!=SW_SHOWMINIMIZED)  // save the dialog window position
	{
        GetWindowRect(&rect);
		LastMoveX = rect.left;
		LastMoveY = rect.top;
		LastSizeX = rect.right - rect.left;
		LastSizeY = rect.bottom - rect.top;
	}
	CMySheet::OnPaint();
}
Example #11
0
File: misc.c Project: kholia/wine
/***********************************************************************
 *		MonitorFromWindow (USER32.@)
 */
HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
{
    RECT rect;
    WINDOWPLACEMENT wp;

    TRACE("(%p, 0x%08x)\n", hWnd, dwFlags);

    if (IsIconic(hWnd) && GetWindowPlacement(hWnd, &wp))
        return MonitorFromRect( &wp.rcNormalPosition, dwFlags );

    if (GetWindowRect( hWnd, &rect ))
        return MonitorFromRect( &rect, dwFlags );

    if (!(dwFlags & (MONITOR_DEFAULTTOPRIMARY|MONITOR_DEFAULTTONEAREST))) return 0;
    /* retrieve the primary */
    SetRect( &rect, 0, 0, 1, 1 );
    return MonitorFromRect( &rect, dwFlags );
}
Example #12
0
BOOL CWnd::SavePosition(HKEY hRootKey,LPCSTR lpKey,LPCSTR lpSubKey) const
{
	CRegKey RegKey;
	if (lpKey==NULL)
		RegKey.m_hKey=hRootKey;
	else if (RegKey.OpenKey(hRootKey,lpKey,CRegKey::createNew|CRegKey::samAll)!=ERROR_SUCCESS)
		return FALSE;
	
	WINDOWPLACEMENT wp;
	wp.length=sizeof(WINDOWPLACEMENT);
	GetWindowPlacement(&wp);
	
	BOOL bRet=RegKey.SetValue(lpSubKey,LPSTR(&wp),sizeof(WINDOWPLACEMENT),REG_BINARY)==ERROR_SUCCESS;

	if (lpKey==NULL)
		RegKey.m_hKey=NULL;
	return bRet;
}
Example #13
0
int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
	TWindowData *dat = (TWindowData*) GetWindowLongPtr(hwndChild, GWLP_USERDATA);	// needed to obtain the hContact for the message window
	if (!dat || !pContainer)
		return FALSE;

	NMHDR nmhdr = { 0 };
	nmhdr.code = TCN_SELCHANGE;
	if (TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS)) > 1 && !(pContainer->dwFlags & CNT_DEFERREDTABSELECT)) {
		TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), hwndChild));
		SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr);	// just select the tab and let WM_NOTIFY do the rest
	}
	if (dat->bType == SESSIONTYPE_IM)
		SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
	if (IsIconic(pContainer->hwnd)) {
		SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
		SetForegroundWindow(pContainer->hwnd);
	}
	//MaD - hide on close feature
	if (!IsWindowVisible(pContainer->hwnd)) {
		WINDOWPLACEMENT wp={0};
		wp.length = sizeof(wp);
		GetWindowPlacement(pContainer->hwnd, &wp);

		/*
		 * all tabs must re-check the layout on activation because adding a tab while
		 * the container was hidden can make this necessary
		 */
		BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0);
		if (wp.showCmd == SW_SHOWMAXIMIZED)
			ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
		else {
			ShowWindow(pContainer->hwnd, SW_SHOWNA);
			SetForegroundWindow(pContainer->hwnd);
		}
		SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);			// make sure the active tab resizes its layout properly
	}
	//MaD_
	else if (GetForegroundWindow() != pContainer->hwnd)
		SetForegroundWindow(pContainer->hwnd);
	if (dat->bType == SESSIONTYPE_IM)
		SetFocus(GetDlgItem(hwndChild, IDC_MESSAGE));
	return TRUE;
}
bool CTSExecutorChildFrame::GetConfigurationData(xmlNodePtr& pxmlNodePtr)
{
    WINDOWPLACEMENT wndPlacement;
    GetWindowPlacement(&wndPlacement);

    const char* omcVarChar ;
    pxmlNodePtr = xmlNewNode(nullptr, BAD_CAST DEF_TS_EXECUTOR);
    m_ouTSExecutor.GetConfigurationData(pxmlNodePtr);

    //Window position


    xmlNodePtr pNodeWndPos = xmlNewNode(nullptr, BAD_CAST DEF_WND_POS);
    xmlAddChild(pxmlNodePtr, pNodeWndPos);

    if(IsWindowVisible() == FALSE)
    {
        wndPlacement.showCmd = SW_HIDE;
    }

    xmlUtils::CreateXMLNodeFrmWindowsPlacement(pNodeWndPos,wndPlacement);

    //splitter position-------------------------
    INT nCxCur, nCxMin;
    m_omSplitterWnd.GetColumnInfo(0, nCxCur, nCxMin);

    xmlNodePtr pNodeSplitterWnd = xmlNewNode(nullptr, BAD_CAST DEF_SPLITTER_WINDOW);
    xmlAddChild(pxmlNodePtr, pNodeSplitterWnd);

    //<CxIdeal />
    CString  csCxIdeal;
    csCxIdeal.Format("%d", nCxCur );
    omcVarChar = csCxIdeal;
    xmlNodePtr pCxIdeal = xmlNewChild(pNodeSplitterWnd, nullptr, BAD_CAST DEF_CX_IDEAL, BAD_CAST omcVarChar);
    xmlAddChild(pNodeSplitterWnd, pCxIdeal);

    // <CxMin />
    CString  csCxMin;
    csCxMin.Format("%d",nCxMin );
    omcVarChar = csCxMin;
    xmlNodePtr pcsCxMin = xmlNewChild(pNodeSplitterWnd, nullptr, BAD_CAST DEF_CX_MIN, BAD_CAST omcVarChar);
    xmlAddChild(pNodeSplitterWnd, pcsCxMin);
    return true;
}
Example #15
0
//-------------------------------------------------------------------------
void SavePreferences(void)
{
    int i;
    char name[256];
    WINDOWPLACEMENT wp;
    FILE *out;
    GetUserDataPath(name);
    strcat(name, PREFFILE);
    out = fopen(name, "w");
    if (!out)
        return;
    fprintf(out, "<UIPREFS>\n");
    fprintf(out, "\t<VERSION ID=\"%d\"/>\n", PREFVERS);
    wp.length = sizeof(wp);
    GetWindowPlacement(hwndFrame, &wp);
    fprintf(out, "\t<PLACEMENT VALUE=\"%d %d %d %d %d %d %d %d %d %d\"/>\n",
        wp.flags, wp.showCmd, wp.ptMinPosition.x, wp.ptMinPosition.y,
        wp.ptMaxPosition.x, wp.ptMaxPosition.y, wp.rcNormalPosition.left,
        wp.rcNormalPosition.top, wp.rcNormalPosition.right,
        wp.rcNormalPosition.bottom);
    fprintf(out, "\t<CUSTOMCOLORS>\n\t\t");
    for (i = 0; i < 16; i++)
    {
        fprintf(out, "%d ", custColors[i]);
        if (i == 7)
            fprintf(out, "\n\t\t");
    }
    fprintf(out, "\n\t</CUSTOMCOLORS>\n");
    fprintf(out, "\t<MEMWND WORDSIZE=\"%d\"/>\n", memoryWordSize);
    fprintf(out, "\t<FIND FMODE=\"%d\" RMODE=\"%d\" FIFFINDMODE=\"%d\" FIFREPLACEMODE=\"%d\">\n", findmode, replacemode, fiffindmode, fifreplacemode);
    for (i=0; i < F_M_MAX; i++)
    {
        fprintf(out, "\t\t<MODE INDEX=\"%d\" FIND=\"%d\" REPLACE=\"%d\"/>\n", i, findflags[i], replaceflags[i]);
    }			
    fprintf(out, "\t</FIND>\n");
    fprintf(out, "\t<PROPERTIES>\n");
    SaveProps(out, generalProject.profiles->debugSettings, 2);
    fprintf(out, "\t</PROPERTIES>\n");
    fprintf(out, "\t<RULES>\n");
    SaveBuildRules(out);
    fprintf(out, "\t</RULES>\n");
    fprintf(out, "</UIPREFS>\n");
    fclose(out);
}
Example #16
0
BOOL CSplashScreen::OnInitDialog()
{

	if (!m_image->IsValid())
		return FALSE;

#ifdef _DEBUG	//ADDED by fengwen on 2006/11/22 : 调试时不让SplashWnd永远置前,妨碍调试。
	SetWindowPos(&wndNoTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
#endif

	HDC hScrDC;						// 屏幕设备描述表
	hScrDC = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
	
	int xScrn, yScrn;				// 屏幕分辨率

	xScrn = GetDeviceCaps(hScrDC, HORZRES);
	yScrn = GetDeviceCaps(hScrDC, VERTRES);

	CDialog::OnInitDialog();
	
	//InitWindowStyles(this);

	WINDOWPLACEMENT wp;
	GetWindowPlacement(&wp);
	wp.rcNormalPosition.left = 0;
	wp.rcNormalPosition.top = 0;
	wp.rcNormalPosition.right = xScrn;
	wp.rcNormalPosition.bottom = yScrn;

	SetWindowPlacement(&wp);


	int x, y;
	x = ( xScrn - m_image->GetWidth() ) / 2;
	y = ( yScrn - m_image->GetHeight() ) / 2;

	m_rtImg.SetRect(x, y, xScrn - x, yScrn - y);
	m_rtVersion.SetRect(m_rtImg.left + 198, m_rtImg.top + 293, m_rtImg.left + 253, m_rtImg.top + 311);
	m_rtText.SetRect(m_rtImg.left + 37, m_rtImg.top + 308, m_rtImg.left + 241, m_rtImg.top + 322);


	return TRUE;
}
Example #17
0
// CDlgControl 消息处理程序
void CDlgControl::FullScreen ( )
{
	RECT			rectDesktop;
    WINDOWPLACEMENT	wpNew;

	GetWindowPlacement ( &wpNew );

	//Adjust RECT to new size of window
	::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop );
	::AdjustWindowRectEx( &rectDesktop, GetStyle(), TRUE, GetExStyle() );

	// Remember this for OnGetMinMaxInfo()
	//m_FullScreenWindowRect = rectDesktop;

	wpNew.showCmd			= SW_SHOWNORMAL;
	wpNew.rcNormalPosition	= rectDesktop;

	//don't allow the toolbar to dock
	SetWindowPlacement ( &wpNew );

	//SetWindowPos ( NULL, rectDesktop.left, rectDesktop.top,  rectDesktop.right, rectDesktop.bottom, SWP_NOREPOSITION );

	// 重新排列界面元素
	m_iLeft		= 0;
	m_iTop		= 22;
	//m_iTop		= 70;
	m_iRight	= rectDesktop.right-rectDesktop.left;
	m_iBottom	= rectDesktop.bottom-rectDesktop.top-150;
	m_tabCtrl.SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION );

	if ( m_pDlgClient )
		m_pDlgClient->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION );

	if ( m_pDlgPrePrinting )
		m_pDlgPrePrinting->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION );

	if ( m_pDlgOperator )
		m_pDlgOperator->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION );

	GetDlgItem ( IDOK )->SetWindowPos ( NULL, (m_iRight - m_iLeft) / 2 + m_iLeft + 100, m_iBottom + 50, 0, 0, SWP_NOSIZE );

	ActivatePage( m_iCurrentItem )	;
}
Example #18
0
void CMainFrame::OnDestroy() 
{
    
    WINDOWPLACEMENT wp;
	memset (&wp, 0 , sizeof(wp));
	wp.length = sizeof(wp);
	GetWindowPlacement(&wp);
	if ( wp.showCmd == SW_SHOWMINIMIZED ) 
		wp.showCmd = SW_SHOW;
    ::WritePrivateProfileBinary("View" , "WindowPlacement" ,(LPBYTE)&wp, sizeof(wp), szGLOBAL_PROFILE);

	CWinApp* pApp = AfxGetApp();
    const char* pProfSave= pApp->m_pszProfileName;
	pApp->m_pszProfileName = szGLOBAL_PROFILE;
	SaveBarState("View");
	pApp->m_pszProfileName = pProfSave;
	
    if ( m_wndSplitter.GetRowCount() > 1 ) {
        m_wndSplitter.SavePosition();
    }

    SaveBarState("JMC");
//vls-begin// multiple output
//    m_coolBar.Save();
    for (int i = 0; i < MAX_OUTPUT; i++)
        m_coolBar[i].Save();
//vls-end//

    // save history 
    CFile histFile;
//vls-begin// base dir
//    if ( histFile.Open("history.dat", CFile::modeCreate | CFile::modeWrite ) ) {
    CString strFile(szBASE_DIR);
    strFile += "\\history.dat";
    if ( histFile.Open(strFile, CFile::modeCreate | CFile::modeWrite ) ) {
//vls-end//
        CArchive ar(&histFile, CArchive::store);
        m_editBar.GetHistory().Serialize (ar);
    }

    pMainWnd = NULL;
    CFrameWnd::OnDestroy();
}
Example #19
0
void CTeenSpiritDlg::SaveSettings()
{
	PrgAPI* pAPI = PRGAPI();
	AppSettings* params = pAPI->GetAppSettings();
	WINDOWPLACEMENT pl;
	GetWindowPlacement(&pl);
	params->Write(SettingsCategory, _T("CMDSHOW"), (int&) pl.showCmd);
	params->Write(SettingsCategory, _T("LEFT"), (int&) pl.rcNormalPosition.left);
	params->Write(SettingsCategory, _T("TOP"), (int&) pl.rcNormalPosition.top);
	params->Write(SettingsCategory, _T("RIGHT"), (int&) pl.rcNormalPosition.right);
	params->Write(SettingsCategory, _T("BOTTOM"), (int&) pl.rcNormalPosition.bottom);
	m_PaneController.SaveSettings();
	BOOL bIsPlayerVisible = FALSE;
	CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
	if (pMPDlg != NULL)
		bIsPlayerVisible = pMPDlg->IsWindowVisible();
	pAPI->SetOption(OPT_MINIPLR_ShowAtStartup, bIsPlayerVisible);

}
Example #20
0
void VDUIRestoreWindowPlacementW32(HWND hwnd, const char *name) {
	if (!IsZoomed(hwnd) && !IsIconic(hwnd)) {
		VDRegistryAppKey key("Window Placement");
		RECT r;

		if (key.getBinaryLength(name) == sizeof(r) && key.getBinary(name, (char *)&r, sizeof r)) {
			WINDOWPLACEMENT wp = {sizeof(WINDOWPLACEMENT)};

			if (GetWindowPlacement(hwnd, &wp)) {
				wp.length			= sizeof(WINDOWPLACEMENT);
				wp.flags			= 0;
				wp.showCmd			= SW_SHOWNORMAL;
				wp.rcNormalPosition	= r;

				SetWindowPlacement(hwnd, &wp);
			}
		}
	}
}
Example #21
0
void MakeFullscreen()
{
	HWND hWnd = NULL;
	
	// find the PowerDVD window
	hWnd = FindWindow(NULL, L"PowerDVD");

	if (hWnd != NULL)
	{
		WINDOWPLACEMENT placement;
		placement.length = sizeof(placement);

		// get the window's position and size
		GetWindowPlacement(hWnd, &placement);

		// enumerate all child windows of the PowerDVD window
		EnumChildWindows(hWnd, EnumChildProc, (LPARAM)&placement.rcNormalPosition);
	}
}
/*******************************************************************************
  Function Name  : vSaveWinStatus
  Input(s)       : -
  Output         : -
  Functionality  : This function will get window postion and will save it in to
                   the configuration module if it is different from the
                   previously saved value
  Member of      : CMDIChildBase
  Author(s)      : Raja N
  Date Created   : 18.4.2005
  Modifications  : 
*******************************************************************************/
void CMDIChildBase::vSaveWinStatus()
{
    // Use temp structure for comparission
    WINDOWPLACEMENT sCurrentPlacement;
    // Get current window postion
    GetWindowPlacement(&sCurrentPlacement);
    // Set the flag
    sCurrentPlacement.flags |= WPF_SETMINPOSITION;
    // Check for difference
    if( memcmp( &sCurrentPlacement,
                &m_sWindowPlacement,
                sizeof(WINDOWPLACEMENT)) != 0 )
    {
        // Update memeber value
        m_sWindowPlacement = sCurrentPlacement;
        // Set flag to restore minimised postion also
        m_sWindowPlacement.flags |= WPF_SETMINPOSITION;
    }
}
Example #23
0
BOOL CMainFrame::DestroyWindow() {
	StopThreads();
  PMainframe()->KillTimers();
	// Save window position
  WINDOWPLACEMENT wp;
	GetWindowPlacement(&wp); 		
	Preferences()->SetValue(k_prefs_main_x, wp.rcNormalPosition.left); 		
 	Preferences()->SetValue(k_prefs_main_y, wp.rcNormalPosition.top);
  write_log(Preferences()->debug_gui(), "[GUI] Going to delete the GUI\n");
  write_log(Preferences()->debug_gui(), "[GUI] this = [%i]\n", this);
  // All OK here
  assert(AfxCheckMemory());
  // http://www.maxinmontreal.com/forums/viewtopic.php?f=111&t=20459
  // probably caused by incorrect order of deletion,
  // caused by incorrect position of StopThreads and KillTimers.
  bool success = CFrameWnd::DestroyWindow(); 
  write_log(Preferences()->debug_gui(), "[GUI] Window deleted\n");
  return success;
}
Example #24
0
void WeightTableWindow::BlackBorder(HDC hdc, HWND hWnd)
	{
	SelectObject(hdc,pTextPen);
	WINDOWPLACEMENT winPos;
 	GetWindowPlacement(hWnd , &winPos);
	
	winPos.rcNormalPosition.right -= (winPos.rcNormalPosition.left+1);
	winPos.rcNormalPosition.bottom -= (winPos.rcNormalPosition.top+1);

	winPos.rcNormalPosition.left = 0;
	winPos.rcNormalPosition.top = 0;

	MoveToEx(hdc, winPos.rcNormalPosition.left,winPos.rcNormalPosition.top , NULL);
	LineTo(hdc,winPos.rcNormalPosition.right,winPos.rcNormalPosition.top );
	LineTo(hdc,winPos.rcNormalPosition.right,winPos.rcNormalPosition.bottom );
	LineTo(hdc,winPos.rcNormalPosition.left,winPos.rcNormalPosition.bottom );
	LineTo(hdc,winPos.rcNormalPosition.left,winPos.rcNormalPosition.top );

	}
Example #25
0
//잔상 이슈 해결 종속적
void E_Desktop::setAllNormalExcludeRemoveDirty(list<char*> exclude)
{
	char pname[255] = { 0, };
	for (list<E_Window*>::iterator itr = windowList.begin(); itr != windowList.end(); itr++)
	{
		char* subpname = NULL;
		//비주얼 스튜디오 제외
		if (!(*itr)->isAeroPossible()){
			GetWindowTextA((*itr)->getWindow(), pname, 255);
			for (list<char*>::iterator iter = exclude.begin(); iter != exclude.end(); iter++) {
				subpname = strstr(pname, (*iter));
				if (subpname != NULL)
					break;
			}
			TRACE_WIN32A("[setAllNormalExcludeRemoveDirty] %s", pname);

			if (subpname == NULL){	//Visual Studio 제외
				TRACE_WIN32A("[setAllNormalExcludeRemoveDirty] %s setNormal",pname );
				(*itr)->setNormal();

				//잔상 이슈 해결
				LONG_PTR tt = GetWindowLongPtr((*itr)->getWindow(), GWL_STYLE);
				if (tt & DS_3DLOOK)
				{
					//현재위치 저장
					RECT rect;
					GetWindowRect((*itr)->getWindow(), &rect);
					WINDOWPLACEMENT placement;
					GetWindowPlacement((*itr)->getWindow(), &placement);
					placement.rcNormalPosition = rect;
					placement.showCmd = SW_MINIMIZE;	//최소화로 예상하고 해결
					(*itr)->saveRect(placement);

					MoveWindow((*itr)->getWindow(), E_EnvironmentManager::getSingleton()->getWidth(), E_EnvironmentManager::getSingleton()->getHeight(), rect.right - rect.left, rect.bottom - rect.top, FALSE);
				}

				//break;
			}

		}
	}
}
Example #26
0
int GetWindowState(SDL_Window* window)
{
	int state = 0;
#ifndef HEADLESS
	WINDOWPLACEMENT wp;
	wp.length = sizeof(WINDOWPLACEMENT);

	struct SDL_SysWMinfo info;
	SDL_VERSION(&info.version);
	SDL_GetWindowWMInfo(window, &info);

	if (GetWindowPlacement(info.info.win.window, &wp)) {
		if (wp.showCmd == SW_SHOWMAXIMIZED)
			state = SDL_WINDOW_MAXIMIZED;
		if (wp.showCmd == SW_SHOWMINIMIZED)
			state = SDL_WINDOW_MINIMIZED;
	}
#endif
	return state;
}
Example #27
0
MIR_CORE_DLL(int) Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix)
{
	WINDOWPLACEMENT wp;
	wp.length = sizeof(wp);
	GetWindowPlacement(hwnd, &wp);

	char szSettingName[64];
	mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix);
	db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.left);

	mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix);
	db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.top);

	mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix);
	db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.right-wp.rcNormalPosition.left);

	mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix);
	db_set_dw(hContact, szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top);
	return 0;
}
Example #28
0
Geometry pWindow::geometry() {
  Geometry margin = frameMargin();

  RECT rc;
  if(IsIconic(hwnd)) {
    //GetWindowRect returns -32000(x),-32000(y) when window is minimized
    WINDOWPLACEMENT wp;
    GetWindowPlacement(hwnd, &wp);
    rc = wp.rcNormalPosition;
  } else {
    GetWindowRect(hwnd, &rc);
  }

  signed x = rc.left + margin.x;
  signed y = rc.top + margin.y;
  unsigned width = (rc.right - rc.left) - margin.width;
  unsigned height = (rc.bottom - rc.top) - margin.height;

  return { x, y, width, height };
}
Example #29
0
/*************
 * DESCRIPTION:	save the position of the window
 * INPUT:			-
 * OUTPUT:			-
 *************/
void CMainFrame::OnClose()
{
	WINDOWPLACEMENT wp;
	int cx, cy, n;

	wp.length = sizeof wp;
	if (GetWindowPlacement(&wp))
	{
		wp.flags = 0;
		if (IsZoomed())
			wp.flags |= WPF_RESTORETOMAXIMIZED;

		m_wndSplitterH.GetColumnInfo(0, cx, n);
		m_wndSplitterV.GetRowInfo(0, cy, n);
		// and write it to the .INI file
		WriteWindowPlacement(&wp, &CSize(cx, cy));
	}

	CFrameWnd::OnClose();
}
Example #30
0
void winfullscreen(pdfapp_t *app, int state)
{
	static WINDOWPLACEMENT savedplace;
	static int isfullscreen = 0;
	if (state && !isfullscreen)
	{
		GetWindowPlacement(hwndframe, &savedplace);
		SetWindowLong(hwndframe, GWL_STYLE, WS_POPUP | WS_VISIBLE);
		SetWindowPos(hwndframe, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
		ShowWindow(hwndframe, SW_SHOWMAXIMIZED);
		isfullscreen = 1;
	}
	if (!state && isfullscreen)
	{
		SetWindowLong(hwndframe, GWL_STYLE, WS_OVERLAPPEDWINDOW);
		SetWindowPos(hwndframe, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
		SetWindowPlacement(hwndframe, &savedplace);
		isfullscreen = 0;
	}
}