Solved

URGENT: Problem Sending Windows Message to taskbar icon.

Posted on 2003-11-11
5
441 Views
Last Modified: 2008-03-03
I have a taskbar icon (program) that is supposed to open a form when a user double clicks on a file associate with the program.  I don't want to open a new instance, so in the Main function, I check to see if there is already an instance running, if so, write the filename to registry and tell the existing tray program to open it via SendMessage imported from user32.dll.  The problem is, the taskBar has  form that is run as minimized wtih ShowInTaskBar set to false.  When I set this to true, it accepts the Windows message correctly.  When I set it to false, it does not.  

how can I send a windows message to the application in the tray?  Is it possible?  If not, is there some way I can notify the .exe without have to setup remoting (I don't want to use TCP/IP, so this would be a problem).  

0
Comment
Question by:jjacksn
  • 2
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
_TAD_ earned 500 total points
ID: 9726443


If you are using WIN API then you want to use the Shell_NotifyIcon Function  


here is a page from the MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shell_notifyicon.asp
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9726480


More or less, you need to tell the tray icon to show the window/applicaiton (whether minimized or not is up to you), you then send your window message to the open application like you normally would
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9726568
_TAD_

I'm slightly confused.

How do you "Show" something that is minimized.  I don't think the application is listening for Widows Messages.  When the ShowInTaskBar boolena is set to true, everything works like it is supposed to.  I think the form is already running in its minimized state, as I am calling Application.Run on the form...
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9740596
May be you need a Window Messagequeue to send and receive Messages.
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9741337
I got it.

I was using processes to find the process by the same name, then callling process.handle or process.mainWindowHandle (i still think the latter should work)

but doing a simple FindWindow works.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question