It is currently Sun Dec 16, 2018 5:24 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to maximize a child window of a non-PB program?
PostPosted: Wed Dec 05, 2018 10:42 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Mar 04, 2014 4:15 pm
Posts: 107
Location: Netherlands
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:
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/windows/desktop/api/winuser/nf-winuser-findwindowexa

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!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to maximize a child window of a non-PB program?
PostPosted: Thu Dec 06, 2018 9:57 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 710
Location: Berlin and Ibiza
You can maximize a foreign window with ShowWindow_(). Example with Notepad program:
Code:
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_().

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: How to maximize a child window of a non-PB program?
PostPosted: Thu Dec 06, 2018 2:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Mar 04, 2014 4:15 pm
Posts: 107
Location: Netherlands
Thanks that works, now i try to get the child window up, iam trying something like this:

Code:
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/windows/desktop/api/winuser/nf-winuser-findwindowexa

but thats not working, why?


Top
 Profile  
Reply with quote  
 Post subject: Re: How to maximize a child window of a non-PB program?
PostPosted: Thu Dec 06, 2018 3:07 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 710
Location: Berlin and Ibiza
FindWindowEx_() (search for child window) only works with FindWindow_() (search for main window).
Example:
Code:
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")

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye