How to remove systray icon?
Re: How to remove systray icon?
SROD YOU ARE A GENIUS!!!
You code didn't work at first, findwindow kept returning 0, until I changed from this: FindWindow_("Windowname", 0) to this: FindWindow_(0,"Windowname")
I always thought the string you are searching for with findwindow is the second parameter. Anyway, it works, thank you so much.
You code didn't work at first, findwindow kept returning 0, until I changed from this: FindWindow_("Windowname", 0) to this: FindWindow_(0,"Windowname")
I always thought the string you are searching for with findwindow is the second parameter. Anyway, it works, thank you so much.
Re: How to remove systray icon?
Okay, just keep in mind that FindWindow_(0,"Windowname") can be unsafe/unreliable because window titles can change. Take a look at IE for example, the window title changes to reflect whichever page I am currently viewing. Also, the window title could be language dependent etc.
You are better off using the window class name. Use the following code to determine the classname (using the hWnd value you have found) :
Once you have the classname, modify your FindWindow_() to :
With my Trillian example, I used the classname "trillian" which the application had registered etc.
You are better off using the window class name. Use the following code to determine the classname (using the hWnd value you have found) :
Code: Select all
a$ = space(256)
GetClassName_(hWnd, @a$, 256)
debug a$
Code: Select all
FindWindow_("Insert Classname here", 0)
I may look like a mule, but I'm not a complete ass.
Re: How to remove systray icon?
Hi,
here is my small try for a solutionPlease test it.
Bernd
here is my small try for a solution
Code: Select all
Procedure Refresh(hTray.l)
Result = #False
If hTray
rRect.RECT
;get the size of the window
If GetClientRect_(hTray, rRect)
;loop through each line
; For z.l = 0 To rRect\bottom
z = rRect\bottom / 2
; send a MouseMove to each position
For x = 0 To rRect\right Step 4
SendMessage_(hTray, #WM_MOUSEMOVE, 0, (z << 16) | x)
Next x
; Next z
Result = #True
EndIf
EndIf
ProcedureReturn Result
EndProcedure
Procedure.l FindSysTray()
hWnd.l = FindWindow_("Shell_TrayWnd", #Null)
If hWnd
hWnd = FindWindowEx_(hWnd, 0, "TrayNotifyWnd", #Null)
If hWnd
hWnd = FindWindowEx_(hWnd, 0, "SysPager", #Null)
If hWnd
hWnd = FindWindowEx_(hWnd, 0, "ToolbarWindow32", #Null)
EndIf
EndIf
EndIf
ProcedureReturn hWnd
EndProcedure
Procedure SysTrayRefresh()
Result = #False
;get handle of Systray
hSystray.l = FindSysTray()
;refresh Systray
If Refresh(hSystray) : Result = #True : EndIf
ProcedureReturn Result
EndProcedure
SysTrayRefresh()
Bernd
Last edited by infratec on Fri Feb 19, 2010 12:18 pm, edited 3 times in total.
Re: How to remove systray icon?
Yep that works here.
Nice solution.

Nice solution.
I may look like a mule, but I'm not a complete ass.
Re: How to remove systray icon?
Thanks infratec, another good solution.
Re: How to remove systray icon?
Hi,
it is not neccessary to send a MouseMove to each line,
so I reduced it to the middle line.
I also 'move' now only every 4th pixel.
Since I still hit every icon, it works.
Bernd
it is not neccessary to send a MouseMove to each line,
so I reduced it to the middle line.
I also 'move' now only every 4th pixel.
Since I still hit every icon, it works.
Bernd
Last edited by infratec on Fri Feb 19, 2010 12:19 pm, edited 1 time in total.
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: How to remove systray icon?
Right !RASHAD wrote:Hi Michael
Nice talking to you
Give me some details, like What do you want to do?(may be I can help)
I think XP is in your mind not Win 7, right?
Re: How to remove systray icon?
Hi Michael,
my solution 'refreshes' the systray complete.
Like you move the mouse above it
Bernd
my solution 'refreshes' the systray complete.
Like you move the mouse above it

Bernd
Re: How to remove systray icon?
Hi Berned
Sorry it does not work here not with XP nor with Windows 7
It seems to me it will work with some special cases
I created a prog. it is only a process no windows it create a system tray icon and using Esc key to quit
When I kill the process the icon stayes in the system tray and no way up to now to clean it specially with 7
It is a kind of a f**** task somehow
Hi Micharl
Ok I will try (may be .... who knows)
Sorry it does not work here not with XP nor with Windows 7
It seems to me it will work with some special cases
I created a prog. it is only a process no windows it create a system tray icon and using Esc key to quit
When I kill the process the icon stayes in the system tray and no way up to now to clean it specially with 7
It is a kind of a f**** task somehow
Hi Micharl
Ok I will try (may be .... who knows)
Egypt my love
Re: How to remove systray icon?
Hi Rashad,
I use XP 32 bit and the 'notepad' example.
It works without any problems.
The only thing what it does, is to simulate a mousemove across the whole stuff.
So if your icon removes when you use your real mouse, it should also remove with my program.
Please try the latest version.
Bernd
I use XP 32 bit and the 'notepad' example.
It works without any problems.
The only thing what it does, is to simulate a mousemove across the whole stuff.
So if your icon removes when you use your real mouse, it should also remove with my program.
Please try the latest version.
Bernd
Re: How to remove systray icon?
Hi Berned
I know that you are testing some special case
Keep tring will you?
whertz just opened the hell
Michael
BTW:Your marvel code for ejecting the USB flash works for me in XP only
But nobody complain about that so I kept quiet check that please.
I know that you are testing some special case
Keep tring will you?
whertz just opened the hell
Michael
BTW:Your marvel code for ejecting the USB flash works for me in XP only
But nobody complain about that so I kept quiet check that please.
Egypt my love
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: How to remove systray icon?
Wrote some words like "Thanks Bernd and Rashad" but it seems that I forgot to click on "send"
Your code snippets work fine here, I'm sure, one of my next programs will use some lines of them
Michael
The only thing in the eject procedure lines I had to change for Vista was the following (I fear, that has nothing to do with your problems)

Your code snippets work fine here, I'm sure, one of my next programs will use some lines of them

Michael
Hm - I'm using the eject routines in a small tool called "Runner", which is something like a swiss knife on my USB stick. I also have included the routine to eject USB devices, which worked fine on all PCs for now (2000, XP, Vista and 7) -- the only difference is, that the LED doesn't get off on VistaRASHAD wrote:Michael
BTW:Your marvel code for ejecting the USB flash works for me in XP only
But nobody complain about that so I kept quiet check that please.

The only thing in the eject procedure lines I had to change for Vista was the following (I fear, that has nothing to do with your problems)
Global LocalDrive;=FirstChar(PeekS(GetCommandLine_()))
GetModuleFileName_(0,@LocalDrive,2); <--- 1 works for XP but not for Vista !
LocalDrive&$df;
Re: How to remove systray icon?
OK Michael
I will give the code another look
Now see next if it will suit you
Sorry if we are hijacking this thread
I will give the code another look
Now see next if it will suit you
Sorry if we are hijacking this thread
Code: Select all
h1 = FindWindow_("Shell_TrayWnd",0)
h2 = FindWindowEx_(h1,0,"TrayNotifyWnd",0)
h3 = FindWindowEx_(h2,0,"SysPager",0)
h4 = FindWindowEx_(h3,0,"ToolbarWindow32",0)
h5 = FindWindowEx_(h2,0,"TrayClockWClass",0)
;********************************( Show Desktop Windows 7 )************************
;h6 = FindWindowEx_(h2,0,"TrayShowDesktopButtonWClass",0)
;******************( Maximize Clock )**************************
ShowWindow_(h3,#SW_HIDE)
ShowWindow_(h5,#SW_MAXIMIZE)
SHChangeNotify_(134217728,0,0, 0)
;******************( Restore Previous )**************************
; ShowWindow_(h5,#SW_RESTORE )
; ShowWindow_(h3,#SW_SHOW)
; SHChangeNotify_(134217728,0,0, 0)
Egypt my love