Author |
Topic: Minimize or Maximize from within the program (Read 280 times) |
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Minimize or Maximize from within the program
« Thread started on: Sep 10th, 2017, 7:45pm » |
|
Hey there,
I'd like to know if there is a way to Minimize or Maximize the program's window from within the program itself.
I've made a program using a remote sending serial information.
I would like my remote to be able to Minimize or Maximize the program's window.
Is this feasible?
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Minimize or Maximize from within the program
« Reply #1 on: Sep 10th, 2017, 9:09pm » |
|
on Sep 10th, 2017, 7:45pm, flotulopex wrote:I'd like to know if there is a way to Minimize or Maximize the program's window from within the program itself. |
|
Which window? Programs typically have multiple windows.
If it's a GUI window (such as a graphics window or a text window) then of course it's just a case of calling the ShowWindow API function with the appropriate parameter: _SW_MINIMIZE or _SW_MAXIMIZE respectively. LBB is no different from LB 4 in this respect and you can use code such as that documented at the Liberty BASIC Programmer's Encyclopedia.
On the other hand if you are referring to the mainwin somewhat different considerations apply. Maximizing the mainwin is straightforward but minimizing it is most easily achieved using code which is LBB-specific.
So which window are you referring to?
Richard.
|
|
|
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Re: Minimize or Maximize from within the program
« Reply #2 on: Sep 18th, 2017, 6:40pm » |
|
Hi,
Sorry for my late reply - I was on travel.
Okay, my question is some kind of fuzzy.
My program's main window doesn't have the title bar appearing so I cannot click on the "minimize" button to get the Window's desktop. Nevertheless, I'd like to minimize the window like I would use the keys "Windows+Down".
Either I could create a button "Minimize" or, since my program is remotely controlled, I would use a received command to minimize the window. But what would the command look like?
Forget about the "maximize" question - this one is completely s****d
|
|
Logged
|
Roger
|
|
|
RobM
Junior Member
member is offline
Posts: 91
|
|
Re: Minimize or Maximize from within the program
« Reply #3 on: Sep 19th, 2017, 09:51am » |
|
on Sep 18th, 2017, 6:40pm, flotulopex wrote:I would use a received command to minimize the window. But what would the command look like? |
|
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx
Code:nCmdShow=_SW_MINIMIZE
calldll #user32, "ShowWindow",_
h as ulong,_
nCmdShow as long,_
result As boolean
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Minimize or Maximize from within the program
« Reply #4 on: Sep 19th, 2017, 11:27am » |
|
on Sep 18th, 2017, 6:40pm, flotulopex wrote:But what would the command look like? |
|
I linked to suitable code at LBPE in my reply.
Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Re: Minimize or Maximize from within the program
« Reply #5 on: Sep 20th, 2017, 06:40am » |
|
Thanks Richard,
I'll give it a try this evening.
I see, I have to get used to use those APIs....
|
|
Logged
|
Roger
|
|
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Re: Minimize or Maximize from within the program
« Reply #6 on: Sep 21st, 2017, 3:03pm » |
|
Thanks Richard,
As always, you provide the needed help ;)
So this is the code I added to my code.
Code:[MINIMIZE_WINDOW]
hMain = hwnd(#Main)
CallDLL #user32, "ShowWindow",_
hMain as uLong,_ 'handle of window
_SW_MINIMIZE As Long,_ 'message to minimize window
r As Long
WAIT
|
|
Logged
|
Roger
|
|
|
|