Page 1 of 1

How getting Position of the TaskBar Icons in Windows 11 ?

Posted: Tue Jun 28, 2022 10:21 pm
by AL90
Hi,

How i can get the position of the taskbar icons in windows 11 ?
i mean if is left or centered. i hope you can help me. thank you very much. :wink:

Ciao
AL90

Re: How getting Position of the TaskBar Icons in Windows 11 ?

Posted: Tue Jun 28, 2022 11:35 pm
by breeze4me
Such information is usually stored in the registry. Therefore, it is easy to know by googling.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
"TaskbarAl" DWORD value
0 = left alignment
1 = center alignment

Code: Select all

;Return value: -1 (error), 0 (left), 1 (center)
Procedure IsTaskBarIconsCenterAligned()
  Protected Value, Result = -1
  Protected Type = #REG_DWORD, Size = 4
  
  If OSVersion() >= #PB_OS_Windows_11
    If SHRegGetUSValue_("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", @Type, @Value, @Size, 0, 0, 0) = #ERROR_SUCCESS
      Result = Value
    EndIf
  EndIf
  ProcedureReturn Result
EndProcedure

Debug IsTaskBarIconsCenterAligned()


Re: How getting Position of the TaskBar Icons in Windows 11 ?

Posted: Wed Jun 29, 2022 12:29 am
by BarryG

Code: Select all

SHRegGetUSValue_()
Wow, I've never seen that before! Such a short and sweet way to grab a Registry value without using a procedure or module. Thanks!

Re: How getting Position of the TaskBar Icons in Windows 11 ?

Posted: Wed Jun 29, 2022 1:11 am
by AL90
breeze4me wrote: Tue Jun 28, 2022 11:35 pm Such information is usually stored in the registry. Therefore, it is easy to know by googling.
Wow that works fine. Many thanky to you! :D