[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

3/21/2012 12:33:00 AM

I have an app that is on the desktop multiple times.
Rather than having multiple items on the bar or not putting anything on
the Taskbar, I would like to have ONE tray icon that "controls" all of
the (same) apps. Basically it would be nice to be able to Hide/Show
each app individually but hiding/showing them all would be OK.
Not familiar with terminology so Googling did not help me.
Is there a way to get multiple desktop apps to interact with one tray
icon? Is there some terminology that will help me search?
I am thinking that it will probably take another unique app to do the
tray icon that would then communicate with the other sameo apps but if
that is the only way, then how would the sameo apps communicate back to
get the tray icon menu items to change e.g. checkmark on show/hide or
whatever.



--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


22 Answers

Larry Serflaten

3/21/2012 11:50:00 AM

0

BeeJ wrote:
> I have an app that is on the desktop multiple times.
> Rather than having multiple items on the bar or not putting anything on
> the Taskbar, I would like to have ONE tray icon that "controls" all of
> the (same) apps.

I just wonder if you know what a Mutiple Document Interface is, and if that would better suit your needs...

Why is that one app on the desktop multiple times? Could all those copies be contained in one (MDI) application???

LFS

BeeJ

3/21/2012 3:08:00 PM

0

Thanks for your reply.
Each sameo app is truly independent of the other sameo app once the user
configures each of them and the user will want to position each of the sameo
apps in a different location on the screen.
And yes I do know what an MDI is and have built one or two way in the past.
From the user perspective, the SDI is the only way to go.

"Larry Serflaten" wrote in message
news:8682994.1219.1332330594318.JavaMail.geo-discussion-forums@ynbq18...

BeeJ wrote:
> I have an app that is on the desktop multiple times.
> Rather than having multiple items on the bar or not putting anything on
> the Taskbar, I would like to have ONE tray icon that "controls" all of
> the (same) apps.

I just wonder if you know what a Mutiple Document Interface is, and if that
would better suit your needs...

Why is that one app on the desktop multiple times? Could all those copies
be contained in one (MDI) application???

LFS

GS

3/21/2012 4:06:00 PM

0

BeeJ has brought this to us :
> Thanks for your reply.
> Each sameo app is truly independent of the other sameo app once the user
> configures each of them and the user will want to position each of the sameo
> apps in a different location on the screen.
> And yes I do know what an MDI is and have built one or two way in the past.
> From the user perspective, the SDI is the only way to go.
>
> "Larry Serflaten" wrote in message
> news:8682994.1219.1332330594318.JavaMail.geo-discussion-forums@ynbq18...
>
> BeeJ wrote:
>> I have an app that is on the desktop multiple times.
>> Rather than having multiple items on the bar or not putting anything on
>> the Taskbar, I would like to have ONE tray icon that "controls" all of
>> the (same) apps.
>
> I just wonder if you know what a Mutiple Document Interface is, and if that
> would better suit your needs...
>
> Why is that one app on the desktop multiple times? Could all those copies be
> contained in one (MDI) application???
>
> LFS

I have an app that gets similar usage by users, but there's only one
icon on the Desktop. Users can open multiple instances and arrange
however they like...

--
Garry

Free usenet access at http://www.eternal-sep...
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Mike Williams

3/21/2012 7:57:00 PM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:jkb7k8$lgn$1@speranza.aioe.org...
> I have an app that is on the desktop multiple times. Rather
> than having multiple items on the bar or not putting anything
> on the Taskbar, I would like to have ONE tray icon that
> "controls" all of the (same) apps. Basically it would be nice
> to be able to Hide/Show each app individually but
> hiding/showing them all would be OK. Not familiar with
> terminology so Googling did not help me. Is there a way to
> get multiple desktop apps to interact with one tray icon?

Looking at your original post and also at your response to Larry it would
seem that these multiple instances of your app really do need to be truly
independent of each other and run as standalone apps in their own thread in
their own right, which rules out MDI. If that is the case, and if you want
your tray icon to be able to exercise control over all running instances of
your main app (the kind of control you have mentioned plus many more
requirements you will later think of (knowing you!), then it might be best
to have one single 'control app' and have all instances of your main app
communicate with it. I think for this kind of thing you're supposed to use
something called DDE for that (if it is doable in VB6?). I've just Googled
around and come across the following MSDN page that discusses it:

http://msdn.microsoft.com/en-us/library/windows/deskto...(v=vs.85).aspx

Peronally I can't make head nor tail of the stuff myself, but maybe you will
have the patience to read it for longer than I did before I gave up (about
thirty seconds!). If you can't get your head around that stuff (as I can't
myself at the moment!) then there is one way I can think of doing what you
need using more or less standard VB stuff. It's a very 'Heath Robinson'
affair, but then knowing your propensity for delving into unusual and
sometimes bizarre ways of doing things it might actually be right up your
street ;-)

You could write your single 'control app' so that its Caption is, for
example 'SameoControlApp' and so it sets up a tray icon and positions its
actual window off the screen, so that its only visible presence is its tray
icon. Then write your main app so that when an instance of it is started the
first thing it does is iterate through all top level windows to see whether
the control app is running by checking each window (GetWindowText) to see if
the first part of the window text is 'SameoControlApp' (You can't use the
simpler FindWindow method for this for reasons that will become apparent
later).

If the above code fails to find the window (if the control app is not
running) then the instance of the main app Shells it. The control app
contains code so that as soon as it starts up it sets its own caption to
'SameoControlApp' followed by the hex representation of the handle of an
otherwise unused TextBox in the control app, for example
'SameoControlApp2B03D4'. The code that shelled it now loops again until a
window appears with the name 'SameoControlApp' followed by some digits. It
then sends the control app a message using SendMessage with WM_SETTEXT on
the handle of the TextBox in the control app. The text it sends would simply
be the word 'started' followed by the hex representation of the window
handle of an otherwise unused TextBox of its own. This message will be
picked up by the Change event of the TextBox in the control app.

If, on the other hand, the instance of the main app discovers that the
control app is already running then of course it does not need to Shell it
and so it simply does the second part of the above (send the string 'started'
followed the hex string representation of an otherwise unused TextBox to the
handle of the TextBox on the control app.

Every time it received a new message (at every Change event in the control
app's textBox) the control app checks if it begins with the word 'started'
and then adds the received TextBox handle of the instance of the main app to
a list (an array of longs perhaps). If however the new message begins with
the word 'closed' then the control app removes that specific main app
instance's TextBox handle from the list (each instance of the main app of
course sends the string 'closed' followed by the TextBox handle to the
control app as that instance is closed by the user).

In this way (unless of course I've forgotten some details, which is quite
likely!) each instance of the main app is able to send a message to the
control app any time it wishes, and the control app in turn can send a
message to any running instance of the main app (or to all of them if it
wishes). In this way you have two way communication between the control app
and all the running instances of the main app, which should enable you to do
almost anything you want.

I told you it was a bit 'Heath Robinson' ;-)

Mike



BeeJ

3/22/2012 1:30:00 AM

0

I have done apps that talk to each other so that is OK.
I was just exploring possible other ways to connect things together.
Thanks for your enlightenment.

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


BeeJ

3/22/2012 1:32:00 AM

0

Mine has only one desktop icon also.
But once multiples are started, they are remembered and they all start
as configured after the next boot.
Was trying to have just one Tray icon (next to the clock in the tray)
to control all those that are open.

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


GS

3/22/2012 4:42:00 AM

0

BeeJ formulated the question :
> Mine has only one desktop icon also.
> But once multiples are started, they are remembered and they all start as
> configured after the next boot.
> Was trying to have just one Tray icon (next to the clock in the tray) to
> control all those that are open.

I get it. I use the hwnd to keep track of the instances so the main app
can manage them 'like' they run in-process even though they're
stand-alone EXEs. The startup configs are stored in a plain text file,
with one line per hwnd. Obviously, each instance gets a new hwnd at
startup and so is not included in the file. The line count serves as
the number of simultaneously running instances at last use. I dump the
file into a zero-based array (1st line always has headings) so the
UBound tells me how many instances to open.

This concept can be used in piggyback where each instance can open
other EXEs and keep track of them in the same fashion. This allows
users to close individual instances and any external apps it started
just by shutting down the instance that started the external EXE[s].

Once you work out the methodology it can be used in a nested fashion to
any level. I even use it in VBA projects! What spawned making this work
for me was wanting to use Html.EXEs for userguides instead of CHMs, by
modifying code from Karl Petersen's website samples. That extended to
users opening different text editors to work on application-specific
machine code files.

--
Garry

Free usenet access at http://www.eternal-sep...
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Mike Williams

3/22/2012 7:36:00 AM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:jkdvaf$bi9$1@speranza.aioe.org...
>
> I have done apps that talk to each other so that is OK.
> I was just exploring possible other ways to connect
> things together. Thanks for your enlightenment.

Okay. By the way, do you [and GS] use anything remotely similar to the
method I suggested, or do you use DDE or some other more conventional
method?

Mike


Dee Earley

3/22/2012 10:37:00 AM

0

On 21/03/2012 00:33, BeeJ wrote:
> I have an app that is on the desktop multiple times.
> Rather than having multiple items on the bar or not putting anything on
> the Taskbar, I would like to have ONE tray icon that "controls" all of
> the (same) apps. Basically it would be nice to be able to Hide/Show each
> app individually but hiding/showing them all would be OK.
> Not familiar with terminology so Googling did not help me.
> Is there a way to get multiple desktop apps to interact with one tray
> icon? Is there some terminology that will help me search?
> I am thinking that it will probably take another unique app to do the
> tray icon that would then communicate with the other sameo apps but if
> that is the only way, then how would the sameo apps communicate back to
> get the tray icon menu items to change e.g. checkmark on show/hide or
> whatever.

Use windows 7, it does all this for you :)
(If the user hasn't configured it not to of course!)

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Larry Serflaten

3/22/2012 12:30:00 PM

0

BeeJ wrote:
> But once multiples are started, they are remembered and they all start
> as configured after the next boot.
> Was trying to have just one Tray icon (next to the clock in the tray)
> to control all those that are open.

That is starting to sound a bit rough on the edges. If the user kicks off the main app, do they all start, or just one, and if one, which one?

Do you need more control of those copies than just some configuation data? I am just wondering what sort of control you would want to supply?

It seems to me you could manage them all without the use of a separate control app (File menu item: Close This and Close All sort of control).

Think about the work flow, is it really going to be advantageous for the user to interact with a tray icon, to control those other forms?