|
-
Feb 18th, 2006, 01:51 PM
#1
Thread Starter
Addicted Member
Refresh Tasbbar Help with code
Hey. I have some code to refresh the windows taskbar, but it doesn't seem to work... heres what I have:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer
Private Const WM_PAINT As Integer = &HF&
Dim taskbarHandle As IntPtr = FindWindow("SHELL_TRAYWND", String.Empty)
SendMessage(taskbarHandle, WM_PAINT, 0, 0)
I put the second part under a command button and when I click it, it does nothing. I have some icons in the taskbar that aren't actually there, so they should dissappear when I do this. Can someone get this to work please?
Thanks
John
-
Feb 18th, 2006, 04:15 PM
#2
Addicted Member
Re: Refresh Tasbbar Help with code
Are you trying to put icons in the system tray that arn't really there!?!?!
if so, you could just use the notifyicon object...
-
Feb 18th, 2006, 05:09 PM
#3
Thread Starter
Addicted Member
Re: Refresh Tasbbar Help with code
well when i close my program it leaves the icons in the tray. I know that i could just tell it to hide the icons on close, but for the way its programmed, I need to have the taskbar refreshed... can you help with the code?
Thanks
-
Feb 19th, 2006, 04:04 PM
#4
Thread Starter
Addicted Member
Re: Refresh Tasbbar Help with code
-
Mar 3rd, 2006, 07:49 PM
#5
Thread Starter
Addicted Member
Re: Refresh Tasbbar Help with code
-
Mar 3rd, 2006, 07:59 PM
#6
Re: Refresh Tasbbar Help with code
That's just bad design. Your icon should clean itself up. If refreshing it doens't work I don't know what else to recommend except to actually develop a good design with your application and its Taskbar Icon.
If that still doesn't work then you might need to restart Explorer. Only problem is sometimes that REMOVES icons that should still be there. I have a feeling refreshing might do the same so you might actually make the User's experience worse.
-
Mar 4th, 2006, 12:31 PM
#7
Thread Starter
Addicted Member
Re: Refresh Tasbbar Help with code
hmm ok. Let me explain my situation here to see what you think and why I'm lookking for a taskbar refresh code:
Ok so my program is designed so that it doesn't showup in the taskbar when its running. (showintaskbar property is false). I created a taskbar icon however that lets the user right click and access additional information. When the user clicks the exit button, I added code in the form_closing() routine that hides the tray icon. Otherwise it would continue to show. My application has a feature that lets you close all of my applications at the same time. When you click that button, it searches through the task manager for anything thats called my application and tries to close it. Now here is the problem. Since my program doesnt show in the taskbar, I can't use the .closemainWindow() command. I have to use .kill(). By using .kill(), it doesn't take away the tray icon! So I usually end up having like 5 icons in the taskbar after everything is closed. So I was thinking that I would have the main application refresh the taskbar after it closes all the other ones, then the icons would be gone. Get whats going on?
Thanks
John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|