Highlighted
Absent Member.
Absent Member.
420 views

[archive] Maximize a window in another application?

[Migrated content. Thread originally posted on 26 November 2009]

Ooh, this one's a peach... 😄

I have a Windows application written in another (obviously inferior) language. It writes a file which I believe contains its Window Handle, then minimizes its window and sits ticking away in the background.

Is there a way for my Acu application to cause this window to be maximized and gain focus?
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Maximize a window in another application?

If you really have the window handle, you could try using the ShowWindow API call, I have never used it, but it might give you a starting point.

77  WND-SYS-HANDLE           PIC 9(9) COMP-5.

SET ENVIRONMENT "DLL-CONVENTION" TO 1. 
CALL "USER32.DLL".
CALL "ShowWindow" USING
       BY VALUE WND-SYS-HANDLE
       BY VALUE 3   | See values below
END-CALL.
CANCEL "USER32.DLL".

***************
* SW_HIDE = 0
* SW_MAXIMIZE = 3
* SW_MINIMIZE = 6
* SW_RESTORE = 9
* SW_SHOW = 5
* SW_SHOWDEFAULT = 10
* SW_SHOWMAXIMIZED = 3
* SW_SHOWMINIMIZED = 2
* SW_SHOWMINNOACTIVE = 7
* SW_SHOWNA = 8
* SW_SHOWNOACTIVATE = 4
* SW_SHOWNORMAL = 1
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Maximize a window in another application?

Mikalodeon, that works beautifully! Many thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Maximize a window in another application?

Glad to hear it, microsofts msdn is your friend. 🙂
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Maximize a window in another application?

Just for completeness, I had a note from the guy who's working on this:

FYI, slight change, as this was only working when the other application was the previous window.

Added an extra call first :

CALL "SetForegroundWindow" using
BY VALUE WND-SYS-HANDLE
END-CALL

This brings the other application window to the front first and then I maximise. It is a function from
the same dll.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.