Solved

URGENT: Problem Sending Windows Message to taskbar icon.

Posted on 2003-11-11
5
447 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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