Shell_NotifyIcon and a Context Menu(Engels...sorry)

Status
Niet open voor verdere reacties.

Neo Angelus

Gebruiker
Lid geworden
27 mei 2007
Berichten
27
Hallo iedereen,

Ik heb een vraagje over een Context Menu in combinatie met een Shell_NotifyIcon te maken in C++. Ik heb deze vraag al eens tevergeefs elders gesteld vandaar dat ik de vraag verder in het Engels zal stellen. Het was namelijk best een verhaal om te schrijven. Als het erg vervelend is zal ik het vertalen naar het Nederlands, maar voor nu lijkt het me niet nodig(is ook conform de huisregels.

First I will describe my problem: I am trying to create a System Tray Icon(don't know what the official name is...the little square icons next the clock...) with a Context(or sometimes referred to as 'popup' menu...the menu usually see when pressing the right mouse button) menu. That is all.(sounds so simple:p)

The tools I am using are: Microsoft Visual C++ 2005 Proffesional Edition and Windows XP (SP3)

As I like to start everything from scratch I started with an empty project(project wizard) and started programming. First problem I ran into was getting a hWnd without a window. First solution was using the console(I love consoles) hWnd, but I couldn't retrieve the messages.(I used NOTIFYICONDATA and Shell_NotifyIcon) And as I didn't really want to show a console I dropped the console and tried to create a message only window in my project. This failed miserably.(I am really not that experienced in programming Windows in C++...in any language to be honest) Thus I abandoned my empty project.

The second try I started with a Win32 project (with obligatory precompiled header...:'() this time around I got the Tray Icon to work as I wanted. I could create a Message Only Window and retrieve the messages from the Tray Icon and even show my Message Only Window(which obviously I turned into something else then a HWND_MESSAGE) with a right mouse click on the Tray icon. But then I ran into two problems. I only wanted a 'Context Menu' not really a Window/Form to show, but after a lot of googling I couldn't find anything about creating a Context Menu in VC++ without using MFC(and I have never used MFC...I usually don't use Windows/Forms...almost always console only...). So I gave up. I didn't think I would ever find it using google so I decided to create my own Context menu using WS_POPUPWINDOW and HWND_TOPMOST and just drawing everything on the Window/Form. Though it seemed like a lot of work it was my only solution. But again I ran into a problem. When I show the Window/Form it shows up in the taskbar and 'alt-tab'-switch. I really don't want that to happen.(mostly because it annoys me)

I hope this describes my situation accurately enough. Here come my questions. Is there a simpler way to create a Context Menu in my Win32 project? If not...is there a way I can hide my Window/Form from the taskbar and 'alt-tab'-switch? And the most important question of all...have I taken a wrong direction and is there an better(and|or easier)) solution to my 'problem'?(more of a project then a problem:)) I do like to write everything from scratch(not from 'total' scratch of course, but beginning with a empty project) as it makes me understand the program and everything I write better. (always get a bit confused if I start with a lot of code I didn't write:D)

Thank you in advance:D and I hope someone can help me
 
Probeer het eens met de functie TrackPopupMenu() of TrackPopupMenuEx().
Met deze functie kan je een popupmenu maken.
 
Laatst bewerkt:
Ok:|...ik kan wel huilen:p...super bedankt:D...echt waar...hoelang ik niet op zoek ben geweest en hoe simpel het dan uiteindelijk blijkt te zijn. Echt super bedankt.
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan