forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


API Call to Minimize a Window?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Mon Oct 25, 2004 9:40 pm    Post subject: API Call to Minimize a Window? Reply with quote

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
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Oct 25, 2004 9:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Mon Oct 25, 2004 11:11 pm    Post subject: Reply with quote

Thanks Sheep! I'll give it a whirl... Cool
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Oct 25, 2004 11:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Oct 26, 2004 1:07 am    Post subject: Reply with quote

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
View user's profile Send private message
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Tue Oct 26, 2004 1:23 am    Post subject: Reply with quote

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. Cool

Cheers,

- Boo


Last edited by Boo on Tue Oct 26, 2004 11:46 am; edited 2 times in total
Back to top
View user's profile Send private message
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Tue Oct 26, 2004 1:36 am    Post subject: Reply with quote

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
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Tue Nov 30, 2004 10:45 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Tue Nov 30, 2004 5:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group