trayicon keeps disappearing when hovering over with mouse.

Started by white scorpion, April 18, 2005, 07:18:44 PM

Previous topic - Next topic

pbrennick

That's a good idea, Thomas, I will try that later when I get up.

Paul

white scorpion

running it through olly doesn't show anything unusual, just as changing the handle of the window.

this is really strange, on windows 98 it works like it should, but on ME,2000 and XP it doesn't work like it should...
i'm glad i'm not the only one having this problem (otherwise i would have felt stupid :lol), but this makes the challenge of solving it a lot bigger  :8)

i'm still trying about everything i can think of, but the only way i can get it to work is to create a thread with an infinite loop sending the message to show the icon... Not a clean solution.....

<edit> another interesting thing, run the program and without touching the messagebox kill the program. this will still keep the icon in the traybar until you touch it with your mousepointer. it really looks like the icon is living it's own life....</edit>

Shantanu Gadgil

solved !!!

the NOTIFYICONDATA's hWnd should be a valid window handle !!!

the following code works at my place:
---
.
.
.
invoke   GetDesktopWindow
mov   hDesk,eax
.
.
.
push   hDesk
pop   nfdat.hwnd
.
.
.
---

This prevents the trayicon from dissappearing.  :clap: :)
To ret is human, to jmp divine!

pbrennick

shantanu,
That is a very good solution.  I don't think I have ever done that before, but the ability to get the handle to the desktop is a good thing to know.

Thank you,
Paul

MichaelW

Quote from: shantanu_gadgil on April 23, 2005, 02:56:40 PM
solved !!!

the NOTIFYICONDATA's hWnd should be a valid window handle !!!

the following code works at my place:
---
.
.
.
invoke   GetDesktopWindow
mov   hDesk,eax
.
.
.
push   hDesk
pop   nfdat.hwnd
.
.
.
---

This prevents the trayicon from dissappearing.  :clap: :)

Yes, that works under Windows 2000 :U

I had been assuming that the handle for the desktop window would always be zero, and that was why I tried a handle value of zero. But in my tests just now the handle returned by GetDesktopWindow was 1000Ah. Handle zero seems to always work for a message box, so what is it?
eschew obfuscation

thomasantony

Hey,
   That was what I was going to post. I just got Window 2003 Enterprise Server. I tested and found the icon disappearing. I put the handle from GetDesktopWindow and it worked

Thomas :U
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

AeroASM

An optimization tip:
instead of

invoke PROCEDURE
mov MEM,eax
...
push MEM
pop STRUCT.MEM

put

invoke PROCEDURE
mov STRUCT.MEM,eax

white scorpion

wow!!! perfect solution!!!!

I never thought of it but it works like a charm :lol:

Thanks guys for all the support and help  :bg


Tedd

Quote from: MichaelW on April 23, 2005, 05:45:49 PM
I had been assuming that the handle for the desktop window would always be zero, and that was why I tried a handle value of zero. But in my tests just now the handle returned by GetDesktopWindow was 1000Ah. Handle zero seems to always work for a message box, so what is it?

I doubt NULL is a valid handle for anything. However, it does work for messagebox, which means there is either some special handling, or I suppose it could be the handle of the desktop container(?) ie. the window that contains the desktop(s).
No snowflake in an avalanche feels responsible.

Mark Jones

My experience with invoking a messagebox with a handle of zero was that it did NOT become modal - it shows up as a separate entity on the taskbar. (But it does work without error.) Replace that zero with hWnd, and it becomes modal; meaning there is no additional entry in the taskbar - the messagebox is now "part" of the source application.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

MichaelW

From the MASM32 windows.inc (1.27d BETA):

HWND_DESKTOP                         equ 0

From winuser.h in the PSDK:

/*
* Special value for CreateWindow, et al.
*/
#define HWND_DESKTOP        ((HWND)0)

eschew obfuscation

Igor

Just encountered the same problem (on windows 2003) and found that if I don't put anything in hwnd (just leave default value, which ever it is) that icon is not disappearing, so if someone else could also check this to confirm that this is actually working... :)