Re: Tile windows
Hi Sasha,
I couldn't really tell from your description whether you were trying to tile
in a frame or on the desktop. Here's a routine I wrote that moves my
application to half of the screen and Explorer to the other half. Maybe
some of this code will help you. In this case I used the height of the
application and the width of the screen. This was a drag and drop
application so I put in an toolbar button that effectively split the screen
between Explorer and my application (that didn't mean the user couldn't
readjust windows after the fact).
Tom
void CMyApp::OnExplorerAdjust()
{
StartExplorer(FALSE); // In case it's not there
CWnd *pWndExplorer;
if ((pWndExplorer = CWnd::FindWindow("ExploreWClass",NULL)) != NULL) {
// Make MyApp Window normal size
AfxGetMainWnd()->ShowWindow(SW_SHOWNORMAL);
CRect rect;
AfxGetMainWnd()->GetWindowRect(&rect);
UINT nHeight = rect.Height();
UINT nWidth = ::GetSystemMetrics(SM_CXSCREEN);
// First lets move MyApp
AfxGetMainWnd()->MoveWindow(0,0,nWidth/2,nHeight,TRUE);
AfxGetMainWnd()->SetForegroundWindow();
// Now Move the Explorer
pWndExplorer->ShowWindow(SW_SHOWNORMAL);
pWndExplorer->MoveWindow(nWidth/2,0,nWidth/2,nHeight,TRUE);
pWndExplorer->SetForegroundWindow();
}
else
AfxMessageBox("No Window's Explorer Found");
}
Tom
"Sasha" <Sasha@discussions.microsoft.com> wrote in message
news:93978333-D892-41F7-82AE-51B01428AEA8@microsoft.com...
I need to tile windows on desktop. I do not need to change their sizes.
CMDIFrameWnd class does not contain any tiling code, it tiles child
windows
using WM_MDITILE command that invokes built-in tiling mechanism for MDI
children.
"Tom Serface" wrote:
Are you tiling within a frame or on the whole desktop? Either way you'll
probably just have to move the windows around and resize them to the size
that makes them all fit.
You could look at the source code for the CMDIFrameWnd class in the MFC
source.
T.
"Sasha" <Sasha@discussions.microsoft.com> wrote in message
news:EAFC45C8-FE5F-4218-926B-849B34522D48@microsoft.com...
I need code that can take an array of window handles and tile windows.
There
can be any number of windows that need to be tiled. Window sizes are
the
same
and do not need to be modified, only position.
"Tom Serface" wrote:
I would start by getting the system metrics of the screen (size) then
just
position the windows using SetWindowPos().
Tom