| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Mon Feb 23, 2004 8:47 pm Post subject: Minimize to tray (2 apps same class) |
|
|
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 |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Mon Feb 23, 2004 8:58 pm Post subject: |
|
|
| How about using the Window Handle Id instead? |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Mon Feb 23, 2004 9:03 pm Post subject: |
|
|
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 |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Feb 24, 2004 6:01 am Post subject: |
|
|
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
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Feb 24, 2004 6:31 am Post subject: |
|
|
This can be easily done with the commands in VDS 5:
LIST TASKLIST,<list>,<flags>
LIST MODULES,<list>,<task> _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Feb 24, 2004 6:39 am Post subject: |
|
|
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...
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.
Cheers, Mac  _________________ 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 |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Feb 24, 2004 12:02 pm Post subject: |
|
|
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 |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Feb 24, 2004 9:47 pm Post subject: |
|
|
| 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  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 25, 2004 12:25 am Post subject: |
|
|
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...
Cheers, Mac  _________________ 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 |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Feb 25, 2004 1:45 am Post subject: |
|
|
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
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|