Skip to content

Commit 2f7e2db

Browse files
authored
Update API.ahk
added __unicodeToAnsi back in
1 parent ade5ed8 commit 2f7e2db

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

API.ahk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,18 @@ __ansiToUnicode(sString, nLen = 0) {
242242
return wString
243243
}
244244

245+
__unicodeToAnsi(wString, nLen = 0) {
246+
pString := wString + 1 > 65536 ? wString : &wString
247+
248+
if (!nLen)
249+
nLen := DllCall("WideCharToMultiByte", "UInt", 0, "UInt", 0, "UInt", pString, "Int", -1, "UInt", 0, "Int", 0, "UInt", 0, "UInt", 0)
250+
251+
VarSetCapacity(sString, nLen)
252+
DllCall("WideCharToMultiByte", "UInt", 0, "UInt", 0, "UInt", pString, "Int", -1, "Str", sString, "Int", nLen, "UInt", 0, "UInt", 0)
253+
254+
return sString
255+
}
256+
245257
__NOP(hProcess, dwAddress, dwLen) {
246258
if (dwLen < 1 || !hProcess || !dwAddress)
247259
return false

0 commit comments

Comments
 (0)