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 


Minimize to tray (2 apps same class)

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Mon Feb 23, 2004 8:47 pm    Post subject: Minimize to tray (2 apps same class) Reply with quote

Here is a trickey one.

I have a client that want to minimize an application to the system tray, easy enough, but he has 2 instances of the same app running (exe file name is different also) and wants to minimize them independantly (and any child windows each may have open). I can make an app that will minimize all to the tray, but one at a time is a pain. Anyone have an idea how to do this?

Thanks

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Mon Feb 23, 2004 8:58 pm    Post subject: Reply with quote

How about using the Window Handle Id instead?
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Mon Feb 23, 2004 9:03 pm    Post subject: Reply with quote

Yeah, I thought of that, but, how do I know which handle goes to which app as well as any child windows of that app?
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Tue Feb 24, 2004 6:01 am    Post subject: Reply with quote

Hi Liquidcode

It looks like your question zeros down to:
How to get the file and path name of a given running exe
which is not yours ?

In Win 98/ME it's fairly simple.

Code:
LOADLIB USER32
REM Replace "Untitled - Notepad" with the window name of your interest
%H = @STRDEL(@WINEXISTS(Untitled - Notepad),1,1)
IF %H
%N = 0
%N = @FILL(801)
%L = @LEN(%N)
%K = @LIB(USER32,GetWindowModuleFileNameA,int:,%H,@ADDR("%N"),%L)
%N = @TRIM(%N)
END
FREELIB USER32
REM Path to your executable file!
INFO %N!


However, in Windows NT 4.0 and Windows 2000, since module handles are no longer shared by all processes as they were on Windows 95 and 98, these APIs do not return information about windows and modules in other processes.
So you need to use psapi.dll and you need to give it a
pointer to a integer array in one of the functions.
Pointing to a array never ever worked for me in VDS.
Another option is to inject your code into the target
process and execute it from there.
Either way you need a dll to do it.

There may be other cheap tricks like asking the
user to start(shellexecute) his app from your exe
and getting it's hwnd for example to differentiate them.

Now as far as getting the window id/child windows U can use vds
functions itself if not API and that's pretty easy for
you I guess.

Hope this helps.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Tue Feb 24, 2004 6:31 am    Post subject: Reply with quote

Embarassed

This can be easily done with the commands in VDS 5:

LIST TASKLIST,<list>,<flags>
LIST MODULES,<list>,<task>

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 24, 2004 6:39 am    Post subject: Reply with quote

Hey Chris,

If these apps have the same window title, I'm kinda
wondering how the user is expected to know which
instance to choose on your minimize program... Confused

If he starts your program first, you can use it as a
front-end to start all app instances and get the handles
(per CodeScript's "cheap trick" suggestion). Actually
this would prolly be easiest and take the least overhead.
Most likely the user wouldn't mind it either.

OR... you could run a constant VDS WINLIST loop to check
for the window title, and store the handle if it doesn't match
an instance already running.

In any case you still need a way for the user to differentiate
between instances...

So... I'd prolly use @sendmsg() WM_SETTEXT and rename
the window title (add a number maybe?) as you determine
each handle. This way they would have individual titles and
the user would know which one he is sending to the tray.

Just a thought. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Tue Feb 24, 2004 12:02 pm    Post subject: Reply with quote

Thanks guys for all the help. I'll have to use some of thoes ideas. The program that is running is a little trickey. I'm sure I'll figure something out using the ideas here.

Thanks again!

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Feb 24, 2004 9:47 pm    Post subject: Reply with quote

Mac wrote:
So... I'd prolly use @sendmsg() WM_SETTEXT and rename
the window title (add a number maybe?) as you determine
each handle.


You can also use WINDOW SETTEXT,window,title Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 25, 2004 12:25 am    Post subject: Reply with quote

LOL, duh... I checked an app that uses the title bar as a
"status" bar when I posted that - no clue why I had used
@sendmsg() instead of WINDOW SETTEXT... Embarassed

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Wed Feb 25, 2004 1:45 am    Post subject: Reply with quote

I think WINDOW SETTEXT internally uses WM_SETTEXT ultimately (it has to) So Mac is one step ahead. May be he is programming a lot with "C"

LiquidCode wrote:
(exe file name is different also)

So I thought he may be providing a taskicon app to minimize thse two apps in question. So in the Taskicon menu if he provides the name of the exe of the app to minimize then I think it's fairly intuitive to the user.
Of course I assume that this is needed for different instances of a specific application and not for all open windows of any app in general.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
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