API for TaskBar options

A

adam99

Hi All,

Can someone help me with the Windows task bar. I am trying to turn of
"Keep task bar on top" option. I have found an API that gets the stat
of the taskbar but I cannot seem to set it.
Declare Function SHAppBarMessage Lib "shell32.dll" _
(ByVal dwMessage As Long, pData As APPBARDATA) As Long

Does anyone know how to set this property?
The only information I have found that it can only be set for Window
2000 which in my case would be fine.
I need to turn this option off before I change the resolution o
computers running Windows 2000 as it causes the whole taskbar to b
placed in the middle of the screen.

Thanks,
Adam
 
K

keepITcool

Adam..

ApiViewer and ApiGuide do not mention the ABM_SETSTATE constant
nevertheless it works.. in WINDOWS XP only

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/shellcc/platform/shell/reference/messages/abm_setstate.asp


Although toggling thru the settings is quite useless it DOES demonstrate
how to set the options AutoHide and AlwaysOnTop <vbg>


Option Explicit

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type


Const ABS_AUTOHIDE As Long = &H1
Const ABS_ALWAYSONTOP As Long = &H2
Const ABM_GETSTATE As Long = &H4
Const ABM_GETTASKBARPOS As Long = &H5
Const ABM_SETSTATE As Long = &HA


Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal
dwMessage As Long, pData As APPBARDATA) As Long


Sub TaskBarToggle()
' keepITcool excel.programming 17-jul-2004
Dim BarData As APPBARDATA, Ret As Long

'Prep buffer
BarData.cbSize = Len(BarData)

'Fill structure
Call SHAppBarMessage(ABM_GETTASKBARPOS, BarData)
'get state
Ret = SHAppBarMessage(ABM_GETSTATE, BarData)
Debug.Print "Before:", (Ret And ABS_AUTOHIDE), _
(Ret And ABS_ALWAYSONTOP)
'set lParam
BarData.lParam = Ret Mod 3 + 1
'notify system
Ret = SHAppBarMessage(ABM_SETSTATE, BarData)
'read back
Ret = SHAppBarMessage(ABM_GETSTATE, BarData)
Debug.Print "After :", (Ret And ABS_AUTOHIDE), _
(Ret And ABS_ALWAYSONTOP)
Debug.Print
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
A

adam99

Thanks for replying keepITcool,

I will definately check the code out. I am hoping it will work wit
Windows 2000 as this is the operating system I am having problem
with.

Have you seen anything on the problem I described with changing th
resolution on Windows 2000 have you?

Cheers,
Adam.:
 
K

keepITcool

just read it...

personally I wouldn't be too pleased with an application that's changing
my display settings. (unless ofcourse it's utility where I expect it to
work on my monitor config.)

Imagine how you could crash my multimonitor configuration?
that's why even if I did have some useful input...
I will not even think about it :)


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
J

Jon Peltier

That's why I ignored this post at first. I hate when a program tries to
mess with my system settings. The programmer has to figure out how to
deal with the current settings without changing them.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
just read it...

personally I wouldn't be too pleased with an application that's changing
my display settings. (unless ofcourse it's utility where I expect it to
work on my monitor config.)

Imagine how you could crash my multimonitor configuration?
that's why even if I did have some useful input...
I will not even think about it :)


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
A

adam99

Jon Peltier & keepITcool, thanks for the input I will try another tac
without changing the resolution.

Cheers,
Adam. :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top