Last active
July 7, 2022 14:55
-
-
Save tmplinshi/2cdff7eb3619783c8328 to your computer and use it in GitHub Desktop.
用 quricol32.dll 生成二维码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; quricol32.dll -- https://perevoznyk.wordpress.com/2013/09/11/quricol-2-0-qr-code-generator/ | |
; ============================= Examples ============================= | |
/* | |
quricol_GeneratePNG("output.png", "Test String") | |
*/ | |
/* | |
; -===== GetPNG =====- | |
If quricol_GetPNG("Test String", bufferSize, buffer) { | |
FileOpen("output.png", "w").RawWrite(buffer+0, bufferSize) | |
quricol_DestroyBuffer(buffer) | |
} | |
*/ | |
/* | |
; -===== GetHBitmap =====- | |
hBitmap := quricol_GetHBitmap("Test String") | |
Gui, Add, Text, +0xE w290 h290 HwndCtrlHwnd, | |
SendMessage, 0x172, 0, hBitmap, , ahk_id %CtrlHwnd% | |
DllCall("DeleteObject", "Ptr", hBitmap) | |
Gui, Show | |
Return | |
GuiClose: | |
ExitApp | |
*/ | |
; ========================================================================= | |
; level - The error correction level | |
; (QualityLow, QualityMedium, QualityStandard, QualityHigh) | |
quricol_GenerateBMP(filename, text, margin:=4, pixelSize:=3, level:=0) { | |
Return DllCall("quricol32\GenerateBMP", "Str", filename | |
, "Str", text | |
, "Int", margin | |
, "Int", pixelSize | |
, "Int", level) | |
} | |
quricol_GeneratePNG(filename, text, margin:=4, pixelSize:=3, level:=0) { | |
Return DllCall("quricol32\GeneratePNG", "Str", filename | |
, "Str", text | |
, "Int", margin | |
, "Int", pixelSize | |
, "Int", level) | |
} | |
quricol_GetBackgroundColor() { | |
Return DllCall("quricol32\GetBackgroundColor", "UInt") | |
} | |
quricol_GetForegroundColor() { | |
Return DllCall("quricol32\GetForegroundColor", "UInt") | |
} | |
quricol_SetBackgroundColor(RGB) { | |
Return DllCall("quricol32\SetBackgroundColor", "UInt", RGB) | |
} | |
quricol_SetForegroundColor(RGB) { | |
Return DllCall("quricol32\SetForegroundColor", "UInt", RGB) | |
} | |
quricol_GetHBitmap(text, margin:=4, pixelSize:=3, level:=0) { | |
Return DllCall("quricol32\GetHBitmap", "Str", text | |
, "Int", margin | |
, "Int", pixelSize | |
, "Int", level | |
, "Ptr") | |
} | |
quricol_GetPNG(text, ByRef bufSize, ByRef pBuffer, margin:=4, pixelSize:=3, level:=0) { | |
Return DllCall("quricol32\GetPNG", "Str", text | |
, "Int", margin | |
, "Int", pixelSize | |
, "Int", level | |
, "Int*", bufSize | |
, "Ptr*", pBuffer) | |
} | |
quricol_DestroyBuffer(pBuffer) { | |
Return DllCall("quricol32\DestroyBuffer", "Ptr", pBuffer) | |
} | |
_quricol_auto_load_unload() { | |
static _ := { base: {__Delete: "_quricol_auto_load_unload"} } | |
static hModule := DllCall("LoadLibrary", "Str", A_ScriptDir "\quricol32.dll", "Ptr") | |
!_ ? DllCall("FreeLibrary", "Ptr", hModule) : "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment