I'm still on the tray icon. I wanted to make a program, that should only show a tray icon and no window. I tried, and the icon shows correctly, but it disappears when I move the mouse on it. I think this is because I put NULL as window handle in the NOTIFYICONDATA structure. Is this the reason? Is there any way to make a tray icon with no window? Thanx, Kefren
Posted on 2001-04-19 05:11:00 by kefren
Kefren, Is your program still running after it puts the icon in the tray? if it exits, then it will disappear when the mouse moves over the tray. Umbongo
Posted on 2001-04-19 05:14:00 by umbongo
Yes, it is still running. I register a hotkey, then enter a message loop waiting for the hotkey message. When it arrives, I unregister it and exit. But if i put the mouse over the icon, it disappears, and the process remains alive. This is the code of my prog: ;------------------------------------------------------- INVOKE GetModuleHandle, NULL mov hInstance, eax invoke RegisterHotKey,NULL,HKQ,MOD_ALT or MOD_CONTROL or MOD_SHIFT,VK_Q mov note.cbSize,sizeof NOTIFYICONDATA push NULL pop note.hwnd mov note.uID,IDI_TRAY mov note.uFlags,NIF_ICON mov note.uCallbackMessage,WM_SHELLNOTIFY invoke LoadIcon,NULL,IDI_WINLOGO mov note.hIcon,eax invoke lstrcpy,addr note.szTip,addr AppName invoke Shell_NotifyIcon,NIM_ADD,addr note MessageLoop: invoke GetMessage,ADDR msg,NULL,0,0 mov eax,msg.message cmp eax,WM_HOTKEY je EndMe jmp MessageLoop EndMe: invoke UnregisterHotKey,NULL,HKQ invoke ExitProcess,NULL ;----------------------------------------------- What's wrong with it? Thanx, Kefren
Posted on 2001-04-19 06:16:00 by kefren
Kefren, Well, I'm stumped, I loaded it up and ran it, now I have an icon stuck in my tray which won't go away! I'm running Windows NT, what are you using? umbongo
Posted on 2001-04-19 07:01:00 by umbongo
I'm running Windows 2000. It's right, your icon should remain there forever, since I forgot the invoke Shell_NotifyIcon,NIM_DELETE,addr note But this puzzles me more and more... Why my does icon go away?....
Posted on 2001-04-19 08:04:00 by kefren
didnt test it but looks like you didnt set your uFlags correctly. you need to change your flags line to: mov note.uFlags,NIF_ICON+NIF_MESSAGE that way uCallbackMessage will contain valid data smurf
Posted on 2001-04-19 11:46:00 by smurf