Skip to content

Commit

Permalink
refactor: static savedLocalizedWord_TaskView := VD._onceLocalizedWord…
Browse files Browse the repository at this point in the history
…_TaskView()
  • Loading branch information
FuPeiJiang committed Dec 21, 2024
1 parent 2db8e3b commit 0fac893
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions VD.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,6 @@ class VD {
this.IID_IVirtualDesktop_ptr := DllCall("GlobalAlloc","UInt",0x00,"Uint",16,"Ptr")
DllCall("ole32\CLSIDFromString","Str",IID_IVirtualDesktop_str,"Ptr",this.IID_IVirtualDesktop_ptr)

;----------------------

this.savedLocalizedWord_TaskView:=false
this.savedLocalizedWord_Desktop := false

;----------------------
OnMessage(DllCall("RegisterWindowMessageW","WStr","TaskbarCreated","Uint"), VD._ExplorerRestarted)
}
Expand Down Expand Up @@ -569,25 +564,26 @@ class VD {
}
}

_getLocalizedWord_TaskView() {
if (this.savedLocalizedWord_TaskView) {
return this.savedLocalizedWord_TaskView
}

_onceLocalizedWord_TaskView() {
hModule := (hModule:=DllCall("GetModuleHandle", "Str","twinui.pcshell.dll", "Ptr")) ? hModule : DllCall("LoadLibrary", "Str","twinui.pcshell.dll", "Ptr")
length:=DllCall("LoadString", "Uint",hModule, "Uint",1512, "Ptr*",lpBuffer, "Int",0) ;1512="Task View"
this.savedLocalizedWord_TaskView := StrGet(lpBuffer, length, "UTF-16")
return this.savedLocalizedWord_TaskView
savedLocalizedWord_TaskView := StrGet(lpBuffer, length, "UTF-16")
return savedLocalizedWord_TaskView
}
_getLocalizedWord_Desktop() {
if (this.savedLocalizedWord_Desktop) {
return this.savedLocalizedWord_Desktop
}

_onceLocalizedWord_Desktop() {
hModule := DllCall("GetModuleHandle", "Str","shell32.dll", "Ptr") ;ahk always loads "shell32.dll"
length:=DllCall("LoadString", "Uint",hModule, "Uint",21769, "Ptr*",lpBuffer, "Int",0) ;21769="Desktop"
this.savedLocalizedWord_Desktop := StrGet(lpBuffer, length, "UTF-16")
return this.savedLocalizedWord_Desktop
savedLocalizedWord_Desktop := StrGet(lpBuffer, length, "UTF-16")
return savedLocalizedWord_Desktop
}

_getLocalizedWord_TaskView() {
static savedLocalizedWord_TaskView := VD._onceLocalizedWord_TaskView()
return savedLocalizedWord_TaskView
}
_getLocalizedWord_Desktop() {
static savedLocalizedWord_Desktop := VD._onceLocalizedWord_Desktop()
return savedLocalizedWord_Desktop
}
getNameFromDesktopNum(desktopNum) {
desktopName:=""
Expand Down

0 comments on commit 0fac893

Please sign in to comment.