CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 58

Thread: I need Taskbar APIs

  1. #16
    Join Date
    Apr 2007
    Posts
    66

    Re: I need Taskbar APIs

    Any updates to this, I am trying to do the same. I would like to update explorer.exe manually.

    This works for many start menu reg options (in HKLM):
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer

    Code:
    Call SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, ByVal 0)
    But does not work for taskbar stuff, like HideClock. Iv tried sending it driectly to the clock hwnd but still doesn't work. Any Ideas?


    I also got the TaskbarGlooming to work with:

    Code:
    SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, 0, "TraySettings", SMTO_NOTIMEOUTIFNOTHING, 1000, 0
    but it seems better to just do vbNullString to send to all instead of just TraySettings, which will also to "Policy" too. I dont know where to find those commands that can be sent but it looks like vbNullString sends to all.

    Anyways, neither work to update that **** taskbar nor a call to RefreshPolicyEx, so I am on the hunt on to how.
    Last edited by AltF4; October 2nd, 2007 at 09:08 PM.

  2. #17
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Hey AltF4!

    Give me a few minutes, let me see what I have, I did make some progress.
    Mind waiting
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  3. #18
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: I need Taskbar APIs

    Anyway, a good show so far, boys.

  4. #19
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Wait a minute AltF4, did I understand you correctly, did you manage to find a way to change the Show the Clock setting

    Quote Originally Posted by WoF
    Anyway, a good show so far, boys.
    Hey thanx!
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  5. #20
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Update as promised..

    The Show the Clock setting in the Taskbar properties, seem to be controlled by this registry key :
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Stuckrects2\Settings

    Now, you have to understand that other Taskbar properties are also controlled by this key, and they are :
    AutoHide
    Always on Top
    Show Small Icons

    These 4 options, store different things into this registry key, as I'll demonstarte with the following :
    Code:
    '                                    Auto   Always  Show Small  Hide
    '                   Binary  Dec Hex  Hide   On Top    Icons     Clock
    '                 ----------------------------------------------------
    '                 | 00000000 00 00 |      |        |           |     |
    
    '                 | 00000001 01 01 |  x   |        |           |     |
    
    '                 | 00000010 02 02 |      |   x    |           |     |
    
    '                 | 00000011 03 03 |  x   |   x    |           |     |
    
    '                 | 00000100 04 04 |      |        |    x      |     |
    
    '                 | 00000101 05 05 |  x   |        |    x      |     |
    
    '                 | 00000110 06 06 |      |   x    |    x      |     |
    
    '                 | 00000111 07 07 |  x   |   x    |    x      |     |
    
    '                 | 00001000 08 08 |      |        |           |  x  |
    
    '                 | 00001001 09 09 |  x   |        |           |  x  |
    
    '                 | 00001010 10 0A |      |   x    |           |  x  |
    
    '                 | 00001011 11 0B |  x   |   x    |           |  x  |
    
    '                 | 00001100 12 0C |      |        |    x      |  x  |
    
    '                 | 00001101 13 0D |  x   |        |    x      |  x  |
    
    '                 | 00001110 14 0E |      |   x    |    x      |  x  |
    
    '                 | 00001111 15 0F |  x   |   x    |    x      |  x  |
    
    '                 | --------------------------------------------------
    Also, keep in mind 9 if it's not already obvious ) that we are dealing with Binary values here, and not strings / Dwords, so to be able to identify the current setting / to change the setting will be quite tough. There is a thread here about reading binary values from the registry ( can't remember the precise location - but the thread dealt with determining if we are in Classic mode / or XP Mode ).

    And yes, we will definitely need to use SendMessageTimeOut to reload explorer.exe to immediately see the changes.
    Last edited by HanneSThEGreaT; October 4th, 2007 at 04:17 AM.
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  6. #21
    Join Date
    Dec 2001
    Posts
    6,332

    Re: I need Taskbar APIs

    Quote Originally Posted by HanneSThEGreaT
    There is a thread here about reading binary values from the registry ( can't remember the precise location - but the thread dealt with determining if we are in Classic mode / or XP Mode ).
    Interesting...

    Does this mean the returned values are different in xp, or accessing them is different?
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  7. #22
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Quote Originally Posted by WizBang
    Does this mean the returned values are different in xp, or accessing them is different?
    I don't think so
    I was actually talking about this thread :
    detect if using Classic start menu
    for getting / setting the Binary values
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  8. #23
    Join Date
    Dec 2001
    Posts
    6,332

    Re: I need Taskbar APIs

    Quote Originally Posted by HanneSThEGreaT
    I don't think so
    I was actually talking about this thread :
    detect if using Classic start menu
    for getting / setting the Binary values
    OK, thanks. For a moment there it sounded as if xp was even more different...
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  9. #24
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Quote Originally Posted by WizBang
    OK, thanks. For a moment there it sounded as if xp was even more different...
    It's actually a good point your brought up, one that I didn't think of earlier, so thanx!
    I'm wondering now, after this post how my Vista will react to this. AFAIK, quite a few things have indeed changed with Windows Vista, I'll test this tonight ( hopefully if it doesn't rain, and I have power )
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  10. #25
    Join Date
    Apr 2007
    Posts
    66

    Re: I need Taskbar APIs

    Interesting key, although it looks difficult to manage since its a combination of many taskbar settings.

    Could u give an example of somehting using a .reg or vbs. I just need to see it in action to use properly.

    Example: what would be the Settings value if I wanted to Hide the clock?



    EDIT:

    Also will WM_SETTINGCHANGE update the taskbar for explorer? I really hope so but for some reason I have a feeling it is not =[.

    Alhtough I know it would be possible because the Explorer Taskbar Settings dialog can do it once u clikc Apply.

    Thank for your help man.
    Last edited by AltF4; October 4th, 2007 at 10:17 PM.

  11. #26
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Quote Originally Posted by AltF4
    Interesting key, although it looks difficult to manage since its a combination of many taskbar settings.

    Could u give an example of somehting using a .reg or vbs. I just need to see it in action to use properly.

    Example: what would be the Settings value if I wanted to Hide the clock?
    OK, not sure if this will work, but I think so.
    Save the following as a VBS file, in Notepad :
    Code:
    Option Explicit
    On Error Resume Next
     
    Dim RegKey
    Dim Bits_to_Clear
    Dim Bits_to_Set
    Dim Comp 
    Dim KeyPath
    Dim ValueName
    Dim Value
     
    Const HKEY_CURRENT_USER  = &H80000001
    
    Const Hide_Clock   = 8
    Const Show_Small_Icons   = 4
    Const Always_On_Top   = 2
    Const Auto_Hide_Taskbar   = 1
     
    Bits_to_Set = Always_On_Top + Show_Small_Icons
    Bits_to_Clear = Auto_Hide_Taskbar + Hide_Clock
     
    Comp = "."
    KeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Stuckrects2"  
    ValueName = "Settings"
     
    Set RegKey=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
        Comp & "\root\default:StdRegProv")
    RegKey.GetBinaryValue HKEY_CURRENT_USER, KeyPath, ValueName, Value
     
    Value(8) = Value(8) OR Bits_to_Set
    ' or Value(8) = Value(8) OR Hide_Clock
    
    Value(8) = Value(8) AND (NOT(Bits_to_Clear))
    'or  Value(8) = Value(8) AND (NOT(Hide_Clock)) 
    
    RegKey.SetBinaryValue HKEY_CURRENT_USER, KeyPath, ValueName, Value
    This makes use of WMI ( Windows Management Instrumentation )

    Quote Originally Posted by AltF4
    Also will WM_SETTINGCHANGE update the taskbar for explorer? I really hope so but for some reason I have a feeling it is not =[.

    Alhtough I know it would be possible because the Explorer Taskbar Settings dialog can do it once u clikc Apply.
    You must use WM_SETTINGCHANGE along with HWND_BROADCAST to refresh / reload the explorer, so that it can load the new settings. remember, these are registry settings, and registry settiungs get loaded when explorer.exe loads, meaning, after a reboot. By using SendMessageTimeOut, we eliminate the need for a reboot.

    I hope this was helpful
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  12. #27
    Join Date
    Apr 2007
    Posts
    66

    Re: I need Taskbar APIs

    Quote Originally Posted by HanneSThEGreaT
    OK, not sure if this will work, but I think so.
    Save the following as a VBS file, in Notepad :
    Code:
    Option Explicit
    On Error Resume Next
     
    Dim RegKey
    Dim Bits_to_Clear
    Dim Bits_to_Set
    Dim Comp 
    Dim KeyPath
    Dim ValueName
    Dim Value
     
    Const HKEY_CURRENT_USER  = &H80000001
    
    Const Hide_Clock   = 8
    Const Show_Small_Icons   = 4
    Const Always_On_Top   = 2
    Const Auto_Hide_Taskbar   = 1
     
    Bits_to_Set = Always_On_Top + Show_Small_Icons
    Bits_to_Clear = Auto_Hide_Taskbar + Hide_Clock
     
    Comp = "."
    KeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Stuckrects2"  
    ValueName = "Settings"
     
    Set RegKey=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
        Comp & "\root\default:StdRegProv")
    RegKey.GetBinaryValue HKEY_CURRENT_USER, KeyPath, ValueName, Value
     
    Value(8) = Value(8) OR Bits_to_Set
    ' or Value(8) = Value(8) OR Hide_Clock
    
    Value(8) = Value(8) AND (NOT(Bits_to_Clear))
    'or  Value(8) = Value(8) AND (NOT(Hide_Clock)) 
    
    RegKey.SetBinaryValue HKEY_CURRENT_USER, KeyPath, ValueName, Value
    This makes use of WMI ( Windows Management Instrumentation )


    You must use WM_SETTINGCHANGE along with HWND_BROADCAST to refresh / reload the explorer, so that it can load the new settings. remember, these are registry settings, and registry settiungs get loaded when explorer.exe loads, meaning, after a reboot. By using SendMessageTimeOut, we eliminate the need for a reboot.

    I hope this was helpful

    Hmm I cant exactly seem to get this to update once the values are set.

    I have tried both of these:

    Call SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "TraySettings", SMTO_NOTIMEOUTIFNOTHING, 1000, 0)

    Call SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, vbNullString, SMTO_NOTIMEOUTIFNOTHING, 1000, 0)

    It does update explorer, but not the taskbar =[.

    Any Help?

  13. #28
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Just a dumb idea....
    Have your tried using Shell_TrayWnd instead of "TraySettings"
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  14. #29
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: I need Taskbar APIs

    Perhaps try TrayClockWClass for the clock window itself
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  15. #30
    Join Date
    Apr 2007
    Posts
    66

    Re: I need Taskbar APIs

    I have not, but the vbNullString should make it sent out to all messages and not something specific.


    Perpahs something like this requires process injection of explorer to do this. Because explorer.exe can do this when you manually click the check boxes under Taskbar and Startmenu Settings.
    But that is too complex and out of the scope of any project like this.

    I really need to find some other method to try and inform explorer to reload and update the taskbar.

    Stuff like this can be really valuable because whenever you perform a reg val change, many times it will say "you MUST log off for effect to take place" but this alone proves you dont always have to. The only thing I cant figure out how to update is this **** taskbar. (Besides killing and restarting explorer, which causes problems with System Tray Items not being re-displayed.)

    Ill keep trying, but I dont know if this is gonna be possible without hacking the memory of explorer. Grrr.

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)