#Requires AutoHotkey v2.0
; narrow win10 taskbar that is on left of desktop without dll inject.   By Tebayaki

; ~LButton::{
; 	DllCall("GetCursorPos", "ptr", lpPoint := Buffer(8))
; 	if 11 = SendMessage(0x0084, 0, NumGet(lpPoint, 4,"int") << 16 | NumGet(lpPoint, "int"), WinExist("ahk_class Shell_TrayWnd")) {
; 		posLast := ""
; 		while A_Cursor == "SizeWE" && GetKeyState("LButton", "P") {
; 			if posLast != posNow := NumGet(lpPoint, "int")
; 				ResizeTB(posLast := posNow)
; 			DllCall("GetCursorPos", "ptr", lpPoint)
; 		}
; 	}
; }

ResizeTB(size){
  pAppBarData := Buffer(48), NumPut("uint", pAppBarData.Size, pAppBarData)
  DllCall("Shell32\SHAppBarMessage", "uint", 0x00000005, "ptr", pAppBarData)
  ; if taskbar is on left of screen
  if 0 = NumGet(pAppBarData, 20, "uint") {
    hTB := WinExist("ahk_class Shell_TrayWnd")
    NumPut("int", -A_ScreenWidth, pAppBarData, 24), NumPut("int", size, pAppBarData, 32)
    ; if taskbar is locked
    if 0 = bMovable := RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove") {
      RegWrite(1, "REG_DWORD", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove")
      SendMessage(0x0111, 0x1A065, 0,, hTB)
    }
    SendMessage(0x0214, 2, pAppBarData.Ptr + 24,, hTB), WinMove(0, 0)
    if 0 = bMovable {
      RegWrite(0, "REG_DWORD", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove")
      SendMessage(0x0111, 0x1A065, 0,, hTB)
    }
  }
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。