Solved

URGENT: Problem Sending Windows Message to taskbar icon.

Posted on 2003-11-11
5
448 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamics CRM Plugin Query TotalRecordCount returning -1 13 88
How can I do Unit Testing with Session ? 1 41
C# Get Current Exchange Rate from XE 9 42
C# LINQ query question 11 30
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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

732 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