Page 1 of 1

How to maximize a child window of a non-PB program?

Posted: Wed Dec 05, 2018 10:42 pm
by T4r4ntul4
Hi all,

The program i try to maximize is not from PB, its a program that already started on windows when i execute my software.

How to maximize a child window of that program?

I can however maximize all windows with:

Code: Select all

SendMessage_(FindWindow_("Shell_TrayWnd",""), #WM_COMMAND, #MIN_ALL_UNDO, 0)
Problem is that the child window doesnt maximize with the above command.

I think i need this:
https://docs.microsoft.com/en-us/window ... dwindowexa

I have read somewhere that you need to search or loop through the child windows, but i dont know how to translate that to PB.

Any help is very appreciated!

Re: How to maximize a child window of a non-PB program?

Posted: Thu Dec 06, 2018 9:57 am
by RSBasic
You can maximize a foreign window with ShowWindow_(). Example with Notepad program:

Code: Select all

EnableExplicit

Define Handle

RunProgram("notepad.exe")
Delay(2000)
Handle = FindWindow_("notepad", #Null)
If Handle
  ShowWindow_(Handle, #SW_MAXIMIZE)
EndIf
You can determine the foreign window with FindWindow_(). Either search for the window title or the class name.
To get the class name, use these tools:
http://www.rsbasic.de/temp/WinSpy.exe
or
http://www.rsbasic.de/temp/ShoWin.exe

You can also get the handle with EnumWindows_().

Re: How to maximize a child window of a non-PB program?

Posted: Thu Dec 06, 2018 2:05 pm
by T4r4ntul4
Thanks that works, now i try to get the child window up, iam trying something like this:

Code: Select all

EnableExplicit

Define Handle

Delay(1000)
Handle = FindWindowEx_("ApplicationFrameWindow", 0, "MAKEINTATOM(0x8000)", "")


If Handle
  ShowWindow_(Handle, #SW_MAXIMIZE) ;  #SW_MINIMIZE ; #SW_MAXIMIZE
EndIf
as stated here: https://docs.microsoft.com/en-us/window ... dwindowexa

but thats not working, why?

Re: How to maximize a child window of a non-PB program?

Posted: Thu Dec 06, 2018 3:07 pm
by RSBasic
FindWindowEx_() (search for child window) only works with FindWindow_() (search for main window).
Example:

Code: Select all

EnableExplicit

Define Handle

RunProgram("notepad.exe")
Delay(2000)

Handle = FindWindow_("notepad", 0)
Handle = FindWindowEx_(Handle, 0, "Edit", 0)

SendMessage_(Handle, #WM_SETTEXT, 0, "Hallo T4r4ntul4")