Question Locked

Arrange windows using VB6 - External Application

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm programming an external app using VB6. The window menu of this app
contains only two options - Cascade & TileVerical (there is no tile
horizantal). This functionality is not exposed in the API of the app.
What I can get is the hWnd of the application window.

What I want to do is to arrange the multiple documents windows in that
application - TileVertical / Cascade.

I believe I will have to us WinAPI.

I have searched for appropriate WINapi functions to perform this task.
And I'm getting more and more confused. Especially I don't understand
the parameters.

Can somebody guide me and tell me the WinAPI functions I should use,
and what values of parameters should I pass to those functions.

Just to remind you, I have only hWnd of the main window of my external
application.

By the way, is there any resource that explains what the WinAPI
function parameters mean?

5 replies

by slayer_

if so, take the width of the MDI frame, and divide by the number of open windows to get th ewidth of each window. then set the lefts accordingly.

As for what the params mean, Google does a good job, just paste the winapi command name into google and append to it MSDN. This will help you search the MSDN page, which without google, requires large doses of Acid to understand the page.

Some of the winAPI commands require constants and structures.
This is a great program for this purpose
http://www.activevb.de/rubriken/apiviewer/index-apiviewereng.html

by slayer_

If thats the case, that is much harder. I don't think you would be able to add to the right click menus without a resource editor.

however, if your goal is to just have an outside application do it, you will need to make use of FindWindow and FindWindowEx along with a command that i current forget the name of, that will return the rectangle of the window. I am unsure how to move or set the size of the windows through API. I have never done it, but I am guessing you would have to use SendMessage for it to work.

by sankulpune

Thanks for the reply.

What I am looking for is something like this:

set externalappWindowsObject = getWindowsObject(fromKnown-hWnd)

externalappWindowsObject.ChildWindows.TileVertical

and

externalappWindowsObject.ChildWindows.Cascade

by slayer_

Private Const MDITILE_HORIZONTAL As Long = &H1
Private Const MDITILE_SKIPDISABLED As Long = &H2
Private Const MDITILE_ZORDER As Long = &H4
Private Const MDITILE_VERTICAL As Long = &H0
Private Const WM_MDICASCADE As Long = &H227
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Long

Call SendMessage(hwnd,WM_MDICascade,wParm,lParam)

Read here for what to pass wParam
http://msdn.microsoft.com/en-us/library/ms644912(VS.85).aspx

This discussion is closed to new replies.