本文整理汇总了C++中SetWindowPlacement函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowPlacement函数的具体用法?C++ SetWindowPlacement怎么用?C++ SetWindowPlacement使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWindowPlacement函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PRGAPI
void CTeenSpiritDlg::LoadSettings()
{
AppSettings* params = PRGAPI()->GetAppSettings();
WINDOWPLACEMENT pl;
GetWindowPlacement(&pl);
int showCmd;
params->Read(SettingsCategory, _T("CMDSHOW"), showCmd, SW_SHOWNORMAL);
params->Read(SettingsCategory, _T("LEFT"), (int&) pl.rcNormalPosition.left, 40);
params->Read(SettingsCategory, _T("TOP"), (int&) pl.rcNormalPosition.top, 25);
params->Read(SettingsCategory, _T("RIGHT"), (int&) pl.rcNormalPosition.right, 900);
params->Read(SettingsCategory, _T("BOTTOM"), (int&) pl.rcNormalPosition.bottom, 650);
//pl.showCmd = SW_SHOWMINIMIZED;
pl.showCmd = showCmd;
ModifyStyle(WS_VISIBLE, 0);
if (showCmd == SW_SHOWMINIMIZED)
{
ModifyStyle(WS_VISIBLE, 0);
SetWindowPlacement(&pl);
PostMessage(WM_SYSCOMMAND, SC_MINIMIZE);
}
else if (showCmd == SW_SHOWMAXIMIZED)
{
SetWindowPlacement(&pl);
ModifyStyle(WS_CAPTION | WS_THICKFRAME, 0);
MaximizeWindow(pl.rcNormalPosition);
}
else
SetWindowPlacement(&pl);
}
示例2: Input
/******************************************************************************
Function Name : SetConfigurationData
Input(s) : BYTE* pSrcBuffer, UINT unBuffSize
Output : HRESULT
Functionality : Returns the configuration data
Member of : CTSExecutorChildFrame
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 07/04/2011
Modifications :
Code Tag : CS040
******************************************************************************/
HRESULT CTSExecutorChildFrame::SetConfigurationData(BYTE* pSrcBuffer, UINT unBuffSize)
{
if(unBuffSize != 0)
{
vInitialise();
WINDOWPLACEMENT wndPlacement;
COPY_DATA_2(&wndPlacement, pSrcBuffer,sizeof(WINDOWPLACEMENT));
SetWindowPlacement(&wndPlacement);
INT nCxCur, nCxMin;
COPY_DATA_2(&nCxCur, pSrcBuffer, sizeof(INT));
COPY_DATA_2(&nCxMin, pSrcBuffer, sizeof(INT));
m_omSplitterWnd.SetColumnInfo(0, nCxCur, nCxMin);
m_omSplitterWnd.RecalcLayout();
unBuffSize = unBuffSize - sizeof(WINDOWPLACEMENT) - (2*sizeof(INT));
m_ouTSExecutor.SetConfigurationData(pSrcBuffer, unBuffSize);
m_odTreeView->GetTreeCtrl().SetCheck(m_hParentTreeItem, m_ouTSExecutor.m_bTestSuiteStatus);
//Parse The Tree Control;
INT nCount;
m_ouTSExecutor.GetTestSetupCount(nCount);
for(int i = 0; i < nCount; i++)
{
bParseTestSetup(i);
}
}
//New File or when Initialising
else
{
vInitialise();
SetWindowPlacement(&m_sTSDefPlacement);
}
return S_OK;
}
示例3: RestoreWindowPlacements
void RestoreWindowPlacements()
{
for(auto it = WindowPlacements.begin(); it != WindowPlacements.end(); ++it)
{
WINDOWPLACEMENT& placement = it->second;
// The only thing that change when a monitor is connected or disconnected is the
// window's "normal position". Everything else remain the same (Z order,
// maximized/minimized status, focus, etc)"
// Since the maximized status cannot be catched with SetWinEventHook we have
// to extract the placement again
WINDOWPLACEMENT current;
GetProperWindowPlacement(it->first, ¤t);
// No need to restore it if it's already in its correct position
if(!memcmp(¤t, &placement, sizeof(current)))
continue;
if(GetWindowTextLength(it->first))
{
Log("%S\n", WndText(it->first));
Log("\tRestore %s to %s\n", current.showCmd == SW_SHOWMINIMIZED ? "minimized" : (current.showCmd == SW_SHOWMAXIMIZED ? "maximized" : ""), PlacementText(placement));
}
if(current.showCmd == SW_SHOWMINIMIZED)
{
// Restore its minimized position
placement.showCmd = SW_SHOWMINNOACTIVE;
placement.flags |= WPF_ASYNCWINDOWPLACEMENT;
SetWindowPlacement(it->first, &placement);
}
else if(current.showCmd == SW_SHOWMAXIMIZED)
{
// The window was maximized
// In order to restore the window on the correct display we have to move it to its normal position first, and then maximize it.
// If we only maximize it (without moving it first) it will be maximized on the display it's currently on.
// Before we maximize it we have to show it in its normal state. Otherwise it will retain its size on the new monitor which
// will be incorrect if the new monitor has a different resolution
// Restore
ShowWindowAsync(it->first, SW_SHOWNOACTIVATE);
// Move
placement.showCmd = SW_SHOWNOACTIVATE;
placement.flags |= WPF_ASYNCWINDOWPLACEMENT;
SetWindowPlacement(it->first, &placement);
// Maximize
ShowWindowAsync(it->first, SW_SHOWMAXIMIZED);
}
else
{
// Restore its normal position
placement.showCmd = SW_SHOWNOACTIVATE;
placement.flags |= WPF_ASYNCWINDOWPLACEMENT;
SetWindowPlacement(it->first, &placement);
}
}
}
示例4: AfxGetApp
void CMainFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_firstShow)
{
CString myver;
CMyCommApp * myApp = (CMyCommApp *)AfxGetApp();
myver = AfxGetApp()->GetProfileString("Version","VER",myApp->m_AppVersion);
if(atof(myver)>=atof(myApp->m_AppVersion))
{
WINDOWPLACEMENT WndStatus;
CRect rect;
rect.left = AfxGetApp()->GetProfileInt("Layout","LEFT",100);
rect.top = AfxGetApp()->GetProfileInt("Layout","TOP",100);
rect.right = AfxGetApp()->GetProfileInt("Layout","RIGHT",800);
rect.bottom = AfxGetApp()->GetProfileInt("Layout","BOTTOM",600);
WndStatus.rcNormalPosition = rect;
WndStatus.flags= AfxGetApp()->GetProfileInt("Layout","FLAG",0);
nCmdShow = AfxGetApp()->GetProfileInt("Layout","SHOWCMD",SW_SHOW);
WndStatus.showCmd = nCmdShow;
WndStatus.ptMinPosition = CPoint(0,0);
SetWindowPlacement(&WndStatus);
}
else{
WINDOWPLACEMENT WndStatus;
CRect rect;
rect.left = 100;
rect.top = 100;
rect.right = 800;
rect.bottom = 600;
WndStatus.rcNormalPosition = rect;
WndStatus.flags= 0 ;
WndStatus.showCmd = SW_SHOW;
WndStatus.ptMinPosition = CPoint(0,0);
SetWindowPlacement(&WndStatus);
}
//check version
hThread=CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE)ThreadCheckVersion,
NULL,
0,
&ThreadID);
m_firstShow = TRUE;
}
CFrameWnd::ActivateFrame(nCmdShow);
}
示例5: DoMove
void DoMove(int direction)
{
// Get Desktop area
RECT rc;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
// Get Active Window
HWND hwnd = GetForegroundWindow();
if (hwnd == NULL) {
return;
}
// Get maximized state of window
WINDOWPLACEMENT wnd;
wnd.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd, &wnd);
// Move it left of right
int half_width = rc.right/2;
switch(direction) {
case VK_LEFT:
if (wnd.showCmd == SW_SHOWMAXIMIZED) { // If window is maximized, restore it
wnd.showCmd = SW_RESTORE;
wnd.flags = WPF_ASYNCWINDOWPLACEMENT;
wnd.rcNormalPosition.left = rc.left;
wnd.rcNormalPosition.right = half_width;
wnd.rcNormalPosition.top = rc.top;
wnd.rcNormalPosition.bottom = rc.bottom;
SetWindowPlacement(hwnd, &wnd);
}
else {
MoveWindow(hwnd, rc.left, rc.top, half_width, rc.bottom, TRUE);
}
break;
case VK_RIGHT:
if (wnd.showCmd == SW_SHOWMAXIMIZED) { // If window is maximized, restore it
wnd.showCmd = SW_RESTORE;
wnd.flags = WPF_ASYNCWINDOWPLACEMENT;
wnd.rcNormalPosition.left = half_width;
wnd.rcNormalPosition.right = half_width;
wnd.rcNormalPosition.top = rc.top;
wnd.rcNormalPosition.bottom = rc.bottom;
SetWindowPlacement(hwnd, &wnd);
}
else {
MoveWindow(hwnd, half_width, rc.top, half_width, rc.bottom, TRUE);
}
break;
case VK_UP:
ShowWindowAsync(hwnd, SW_MAXIMIZE);
break;
case VK_DOWN:
ShowWindowAsync(hwnd, SW_MINIMIZE);
break;
}
}
示例6: GetWindowLong
void ZLWin32ApplicationWindow::setFullscreen(bool fullscreen) {
if (fullscreen == myFullScreen) {
return;
}
myFullScreen = fullscreen;
int style = GetWindowLong(myMainWindow, GWL_STYLE);
static WINDOWPLACEMENT mainPlacement;
static WINDOWPLACEMENT toolbarPlacement;
if (myFullScreen) {
GetWindowPlacement(myMainWindow, &mainPlacement);
GetWindowPlacement(myRebar, &toolbarPlacement);
SetWindowLong(myMainWindow, GWL_STYLE, style & ~WS_CAPTION);
int cx;
int cy;
HDC displayDC = GetDC(0);
if (displayDC != 0) {
cx = GetDeviceCaps(displayDC, HORZRES);
cy = GetDeviceCaps(displayDC, VERTRES);
ReleaseDC(0, displayDC);
} else {
cx = GetSystemMetrics(SM_CXSCREEN);
cy = GetSystemMetrics(SM_CYSCREEN);
}
SetWindowPos(myMainWindow, HWND_TOP, 0, 0, cx, cy, SWP_SHOWWINDOW);
ShowWindow(myMainWindow, SW_SHOWMAXIMIZED);
ShowWindow(myRebar, SW_HIDE);
createFloatingToolbar();
if (myDockWindow != 0) {
ShowWindow(myDockWindow, SW_SHOWDEFAULT);
updateFullscreenToolbarSize();
}
} else {
SetWindowLong(myMainWindow, GWL_STYLE, style | WS_CAPTION);
ShowWindow(myRebar, SW_SHOWNORMAL);
ShowWindow(myMainWindow, SW_SHOWNORMAL);
SetWindowPlacement(myMainWindow, &mainPlacement);
SetWindowPlacement(myRebar, &toolbarPlacement);
RECT mainRect;
GetClientRect(myMainWindow, &mainRect);
RECT rebarRect;
GetWindowRect(myRebar, &rebarRect);
MoveWindow(myRebar, 0, 0, mainRect.right - mainRect.left, rebarRect.bottom - rebarRect.top, true);
destroyFloatingToolbar();
}
refresh();
}
示例7: GetWindowPlacement
void CMainFrame::ViewFullScreen(COnStationView *pView)
{
if (!m_bFullScreen)
{
GetWindowPlacement(&m_wplNormal);
if (!(m_wplNormal.flags&SW_SHOWMAXIMIZED))
{
ShowWindow(SW_SHOWMAXIMIZED);
}
m_dataView.ShowWindow(SW_HIDE);
int iMaxX=GetSystemMetrics(SM_CXSCREEN);
int iMaxY=GetSystemMetrics(SM_CYSCREEN);
int iTitleBarFudge=GetSystemMetrics(SM_CYMENU)+GetSystemMetrics(SM_CYCAPTION);
int iBorder=GetSystemMetrics(SM_CYFRAME);
MoveWindow(-iBorder,-iTitleBarFudge-5,iMaxX+iBorder*2+3,iMaxY+iTitleBarFudge+60,TRUE);
m_wndToolBar.ShowWindow(SW_HIDE);
m_wndStatusBar.ShowWindow(SW_HIDE);
m_wndRuler.ShowWindow(SW_HIDE);
ShowControlBar(&m_wndToolBarFullScreen,TRUE,TRUE);
RecalcLayout();
if (pView!=NULL)
{
pView->GetParent()->ShowWindow(SW_SHOWMAXIMIZED);
}
}
else
{
CAppSettings *Set=theApp.GetSettings();
m_dataView.ShowWindow(SW_SHOW);
m_wndStatusBar.ShowWindow(Set->m_bStatusBar);
m_wndToolBar.ShowWindow(Set->m_bToolBar);
ShowControlBar(&m_wndToolBarFullScreen,FALSE,TRUE);
m_wndRuler.ShowWindow(Set->m_bRuler?SW_SHOW:SW_HIDE);
//The following code fixes a problem where some stuff
//didn't redraw properly coming out of full screen mode
//if we were maximized. In particular, the status bar
//would show up off the bottom of the screen.
if (m_wplNormal.flags&SW_SHOWMAXIMIZED)
{
ShowWindow(SW_SHOWNORMAL);
RecalcLayout();
SetWindowPlacement(&m_wplNormal);
}
SetWindowPlacement(&m_wplNormal);
RecalcLayout();
}
m_bFullScreen=!m_bFullScreen;
}
示例8: SetWindowPos
BOOL CSplashScreen::OnInitDialog()
{
#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);
return TRUE;
}
示例9: GetClientRect
/*************
* DESCRIPTION: load window placement set window
* INPUT: system
* OUTPUT: -
*************/
void CMainFrame::InitialShowWindow(UINT nCmdShow)
{
WINDOWPLACEMENT wp;
CSize sizeSplitter;
CRect rect;
((CCamView*)m_wndSplitterH.GetPane(0, 0))->bLockOnSizeRedraw = FALSE;
if (!ReadWindowPlacement(&wp, &sizeSplitter))
{
GetClientRect(rect);
sizeSplitter.cx = rect.right - 100;
sizeSplitter.cy = rect.bottom - 130;
}
else
{
SetWindowPlacement(&wp);
GetClientRect(rect);
}
wp.showCmd = nCmdShow;
m_wndSplitterH.SetColumnInfo(0, sizeSplitter.cx, 0);
m_wndSplitterV.SetRowInfo(0, sizeSplitter.cy, 0);
// do the recalc now, otherwise the Splitter-windows would "forget" it
m_wndSplitterV.RecalcLayout();
m_wndSplitterH.RecalcLayout();
sizeOld.cx = rect.Width();
sizeOld.cy = rect.Height();
ShowWindow(wp.showCmd);
}
示例10: _T
//--------------------------------------------------------------------------------------------------------------//
void CFrmMain::WindowPlacementLoad()
{
WINDOWPLACEMENT wndpl;
CXMLParamsHelper XMLParams;
XMLParams.LoadXMLParams();
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("MaxPositionX"), &wndpl.ptMaxPosition.x, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("MaxPositionY"), &wndpl.ptMaxPosition.y, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("MinPositionX"), &wndpl.ptMinPosition.x, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("MinPositionY"), &wndpl.ptMinPosition.y, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("NormalPositionLeft"), &wndpl.rcNormalPosition.left, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("NormalPositionTop"), &wndpl.rcNormalPosition.top, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("NormalPositionRight"), &wndpl.rcNormalPosition.right, 0xffff);
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("NormalPositionBottom"), &wndpl.rcNormalPosition.bottom, 0xffff);
long nVal = 0xffff;
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("Flags"), &nVal, 0xffff);
wndpl.flags = nVal;
XMLParams.GetXMLLong(SETTINGS_WINDOW_PLACEMENT_KEY, _T("ShowCmd"), &nVal, 0xffff);
wndpl.showCmd = nVal;
if(0xffff == wndpl.rcNormalPosition.left
|| 0xffff == wndpl.rcNormalPosition.top || 0xffff == wndpl.rcNormalPosition.right
|| 0xffff == wndpl.rcNormalPosition.bottom || 0xffff == wndpl.showCmd)
{
return;
}
SetWindowPlacement(&wndpl);
}
示例11: sizeof
// Initialization helper --
// Loads the Restores data and positions the window in its previously saved state
void cef_main_window::RestoreWindowPlacement(int showCmd)
{
if (showCmd == SW_MAXIMIZE)
{
WINDOWPLACEMENT wp;
::ZeroMemory(&wp, sizeof (wp));
wp.length = sizeof(WINDOWPLACEMENT);
wp.flags = 0;
wp.showCmd = SW_MAXIMIZE;
wp.ptMinPosition.x = -1;
wp.ptMinPosition.y = -1;
wp.ptMaxPosition.x = -1;
wp.ptMaxPosition.y = -1;
wp.rcNormalPosition.left = CW_USEDEFAULT;
wp.rcNormalPosition.top = CW_USEDEFAULT;
wp.rcNormalPosition.right = CW_USEDEFAULT;
wp.rcNormalPosition.bottom = CW_USEDEFAULT;
GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreLeft, NULL, (int&)wp.rcNormalPosition.left);
GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreTop, NULL, (int&)wp.rcNormalPosition.top);
GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreRight, NULL, (int&)wp.rcNormalPosition.right);
GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreBottom, NULL, (int&)wp.rcNormalPosition.bottom);
// This returns FALSE on failure but not sure what we could do in that case
SetWindowPlacement(&wp);
}
ShowWindow(showCmd);
}
示例12: simulateFullScreen
//void winMsgRelease()
//{
// if(customWinProc == daemonProc)
// {
// Shell_NotifyIcon(NIM_DELETE, &nid); //资源释放
// }
//}
void simulateFullScreen(HWND hwnd)
{
//方案1
int ScreenX = GetSystemMetrics(SM_CXSCREEN); //获得全屏的宽
int ScreenY = GetSystemMetrics(SM_CYSCREEN); //获得全屏的高
int DialogX = GetSystemMetrics(SM_CXDLGFRAME) - 3; //获得你的窗口左边空白边框的宽度 //-3这个值,不同的系统会不同
int DialogY = GetSystemMetrics(SM_CYDLGFRAME) + GetSystemMetrics(SM_CYCAPTION); //获得你的窗口
WINDOWPLACEMENT newment;
newment.length = sizeof(WINDOWPLACEMENT);
newment.flags = WPF_RESTORETOMAXIMIZED;
newment.showCmd = SW_SHOWMAXIMIZED;
newment.ptMaxPosition.x = 0;
newment.ptMaxPosition.y = 0;
newment.ptMinPosition.x = 0;
newment.ptMinPosition.y = 0;
newment.rcNormalPosition.left = -DialogX; //(0,0)点重合
newment.rcNormalPosition.top = -DialogY;
newment.rcNormalPosition.bottom = ScreenX - DialogY; //尺寸一致
newment.rcNormalPosition.right = ScreenY - DialogX;
SetWindowPlacement(hwnd, &newment);
//方案2
// SetWindowLongPtr(hwnd, GWL_STYLE,
// WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE);
// //MoveWindow(hwnd, 0, 0, windowWidth, windowHeight, TRUE);
// setWindowPos(0,0);
}
示例13: PropSheetProc
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) {
if (msg == PSCB_PRECREATE) {
DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam;
pDlgTemplate->style |= WS_THICKFRAME;
}
else if (msg == PSCB_INITIALIZED) {
g_cfgwnd = hwnd;
SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0);
UpdateStrings();
// Set new icon specifically for the taskbar and Alt+Tab, without changing window icon
HICON taskbar_icon = LoadImage(g_hinst, L"taskbar_icon", IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
SendMessage(g_cfgwnd, WM_SETICON, ICON_BIG, (LPARAM)taskbar_icon);
// OK button replaces Cancel button
SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0);
HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL);
HWND ok = GetDlgItem(g_cfgwnd, IDOK);
Button_Enable(cancel, TRUE); // Re-enable to enable escape key
WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
GetWindowPlacement(cancel, &wndpl);
SetWindowPlacement(ok, &wndpl);
ShowWindow(cancel, SW_HIDE);
HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY);
Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English)
}
}
示例14: VDUIRestoreWindowPlacementW32
void VDUIRestoreWindowPlacementW32(HWND hwnd, const char *name, int nCmdShow) {
if (!IsZoomed(hwnd) && !IsIconic(hwnd)) {
VDRegistryAppKey key("Window Placement");
VDUISavedWindowPlacement sp = {0};
// Earlier versions only saved a RECT.
int len = key.getBinaryLength(name);
if (len > (int)sizeof(VDUISavedWindowPlacement))
len = sizeof(VDUISavedWindowPlacement);
if (len >= offsetof(VDUISavedWindowPlacement, mbMaximized) && key.getBinary(name, (char *)&sp, len)) {
WINDOWPLACEMENT wp = {sizeof(WINDOWPLACEMENT)};
if (GetWindowPlacement(hwnd, &wp)) {
wp.length = sizeof(WINDOWPLACEMENT);
wp.flags = 0;
wp.showCmd = nCmdShow;
wp.rcNormalPosition.left = sp.mLeft;
wp.rcNormalPosition.top = sp.mTop;
wp.rcNormalPosition.right = sp.mRight;
wp.rcNormalPosition.bottom = sp.mBottom;
if ((wp.showCmd == SW_SHOW || wp.showCmd == SW_SHOWNORMAL || wp.showCmd == SW_SHOWDEFAULT) && sp.mbMaximized)
wp.showCmd = SW_SHOWMAXIMIZED;
SetWindowPlacement(hwnd, &wp);
}
}
}
}
示例15: GetWindowPlacement
void CMainFrame::OnMenuFullscreen()
{
// TODO: Add your command handler code here
if(!m_bFullScreen){
GetWindowPlacement(&m_OldWndPlacement);
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
ClientToScreen(&ClientRect);
//获取屏幕的分辨率
int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
int nFullHeight=GetSystemMetrics(SM_CYSCREEN);
//将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的客户区位置间的差值, 就得到全屏显示的窗口位置
m_FullScreenRect.left=WindowRect.left-ClientRect.left;
m_FullScreenRect.top=WindowRect.top-ClientRect.top;
m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight;
m_bFullScreen=TRUE; //设置全屏显示标志为 TRUE
//进入全屏显示状态
WINDOWPLACEMENT wndpl;
wndpl.length=sizeof(WINDOWPLACEMENT);
wndpl.flags=0;
wndpl.showCmd=SW_SHOWNORMAL;
wndpl.rcNormalPosition=m_FullScreenRect;
SetWindowPlacement(&wndpl);
}
}