| View previous topic :: View next topic |
| Author |
Message |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Mon Oct 25, 2004 9:40 pm Post subject: API Call to Minimize a Window? |
|
|
Howdy All,
Would anyone out there happen to know a way to use the API to minimize a window? Same as clicking on the minimize button on a window. (For certain reasons, I do not want to use the Window Iconize command, nor do I want to use the Window Click command.)
Thanks,
- Boo |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Oct 25, 2004 9:52 pm Post subject: |
|
|
This should work:
| Code: |
%%SW_MINIMIZE = 6
%%hwnd = <window handle here>
LOADLIB user32.dll
%P = @LIB(user32,ShowWindow,INT:,INT:%%hwnd,INT:%%SW_MINIMIZE)
FREELIB user32.dll
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Mon Oct 25, 2004 11:11 pm Post subject: |
|
|
Thanks Sheep! I'll give it a whirl...  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Oct 25, 2004 11:13 pm Post subject: |
|
|
SnarlingSheep wrote:
| Quote: |
| Code: |
%%SW_MINIMIZE = 6
%%hwnd = <window handle here>
LOADLIB user32.dll
%P = @LIB(user32,ShowWindow,INT:,INT:%%hwnd,INT:%%SW_MINIMIZE)
FREELIB user32.dll
|
|
If I'm not mistaken, that is the same thing as pressing the minimize button
or using | Code: | | window iconize,%%hwnd |
Happy coding... _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Oct 26, 2004 1:07 am Post subject: |
|
|
Here's a list of api's with code examples that I have.
http://garrett.vdsworld.com/vds5api.html _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Oct 26, 2004 1:23 am Post subject: |
|
|
Thanks guys.
By the way... Sheep's example can be used as a solution to the memory usage issues mentioned in the following posts:
http://www.vdsworld.com/forum/viewtopic.php?p=22716&highlight=#22716
http://www.vdsworld.com/forum/viewtopic.php?t=1253
I tried using the code within one of my apps., and it works fine (unlike the Window Iconize command within VDS).
I can now minimize my program (without having to click on the minimize button) and drop it from 10,000 K to approximately 2,000 K by simply running this code! Yippeee!
Thanks again, Sheep.
Cheers,
- Boo
Last edited by Boo on Tue Oct 26, 2004 11:46 am; edited 2 times in total |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Oct 26, 2004 1:36 am Post subject: |
|
|
Hi Again,
After minimizing an application using API, you can then use the Window Hide Command to hide the application from showing in the taskbar (see code below). Also, for any newbies out there, the following code shows how to determine the %%hwnd variable:
| Code: |
title A Program
DIALOG CREATE,My Program,38,115,785,558,CLASS myapp
%%hwnd = @strdel(@winexists(#myapp),1,1)
%P = @LIB(user32,ShowWindow,INT:,INT:%%hwnd,INT:6)
window hide,"My Program"
goto evloop |
Cheers,
- Boo |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Nov 30, 2004 10:45 am Post subject: |
|
|
Many people using the new Delphi 2005 IDE are running into memory usage issues. Even after upgrading my computer to 512MB I still get Windows bleating about virtual memory becoming too low. The advice from Borland peeps is to minimize the IDE occasionally. Sounds familiar.
The word from the clever people is that this behaviour is an inherent problem with the Delphi memory manager. Apparently when memory becomes fragmented it is unable to reuse it, so instead it asks for more from Windows. VDS is inheriting this problem from Delphi. Some people are expressing the hope that Borland will now have to address this longstanding problem so as to solve these issues with the D2005 IDE, but personally I will be surprised if they do so before the next major upgrade to Delphi, which will therefore not be in the timescale to have any effect on VDS 6. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Nov 30, 2004 5:02 pm Post subject: |
|
|
Hi Jules,
Have you tried the code reflected in the posts above? Seems to be a workable solution for now...
Cheers,
- Boo |
|
| Back to top |
|
 |
|