External method - TileWindows

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

External method - TileWindows

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:57 pm

by Darrell Duniam >> Fri, 20 Jul 2007 1:48:51 GMT

Has anyone managed to get an external function to successfully call the TileWindows entry point of the user32 library please ? I can get it to tile windows on the Windows DeskTop, but I can't get it to tile windows within an MDI form. Here's the signature of my external function:

cnEcTileWindows(pHwnd:Integer; // If null, the desktop is assumed.
pHow:Integer; // Horizontal or vertical.
pRectangle:Integer; // Can be null.
pKids:Integer; // Can be null.
pKidsArray:Integer // Can be null.
):Integer is TileWindows in user32;
// Return value is the number of windows tiled - 0 means the call failed.

regards,
darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: External method - TileWindows

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:57 pm

by Torrie >> Fri, 20 Jul 2007 22:38:19 GMT

Hi

It looks like the parent window of the MDI children isn't the MDI form. There a tool called WinSpy I think that shows you all the windows etc.

I had some success with the following (using the API GetParent.) However, our application has a frame on the LHS of the MDI parent form and the resizing didn't take this into account so you would need to feed in the dimentions of the window (pRect parameter and you'll probably need to change this parameter to be a binary)

I would think that it would be reasonable to ask Jade to add methods to the form class to arrange the MDI children.

Torrie


vars
iForm : Integer;
oForm : Form;
iHwndParent : Integer;begin

foreach iForm in 1 to app.formsCount do
oForm := app.forms( iForm );
if oForm.mdiChild = Form.MdiChild_IsMdi
or (oForm.mdiChild = Form.MdiChild_UseAppDefault and app.defaultMdi )
then
iHwndParent := call getParent( oForm.hwnd );
if iHwndParent <> null then
write call tileWindows( iHwndParent, 1, 0, 0, 0 );
break;
endif;
endif;
endforeach;
end;


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 9 guests