Solved

URGENT: Problem Sending Windows Message to taskbar icon.

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

696 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