图片base64转hBitmap直接用于pic控件

ImgBase64=
(join LTrim
Qk04GQAAAAAAADYAAAAoAAAAKAAAACgAAAABACAAAAAAAAIZAAASCwAAEgsAAAAAAAAAAAAA////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////APf39wDLysoAlpGRAGNYVwA+NDIAJx4cABoVEwAaFRMAJx4cADsxLwBhV1YAk46NAMrJyQD39/cA////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A397eAIiDggA0KScABxYUAAZCQQAFeHcABZ+fAAa5uAAFxcQABcXFAAa5uQAGoaAABXl5AAZFRAAHFhUAMiclAIyHhgDf398A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wDt7e0AgHt6ABMNCwAHPz4ACJybAAXm5gAD//8AAf//AAD//wAA//8AAP//AAD//wAA//8AAP//AAH//wAC//8ABefoAAefnwAFPz8AEgwLAH54dwDq6uoA////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wC1tLQAKB4eAAY5OQAIubgAA///AAD//wAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAA//8AA///AAi7uwAHPT0AIhgXALCvrwD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP39/QCKh4YABgoJAAiMiwAE+/sAAP//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAA//8ABP39AAmRkQAFCwoAgn99AP39/QD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////APv7+wBqZGMAAxsaAAnDwwAB//8AAP//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAv/+AAL//gAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAB//8ACcjIAAIgHwBuZ2cA/Pz8AP///wD///8A////AP///wD///8A////AP///wD///8A////AP7+/gB3cXEAASQkAAjb2wAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AA/D9AAOz/AADdvwAAk/8AAE8/QABPP0AAk/8AAN0/AAEsfwAA+79AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAI398AACcmAG1nZgD9/f0A////AP///wD///8A////AP///wD///8A////AP///wCempkAABcWAAjc3AAA//8AAf//AAH//wAB//8AAf//AAH//wAD7v0ABIP7AAMf+wABAP0AAAD+AAAA/gAAAP4AAAD+AAAA/gAAAP4AAQD9AAMd+wAEgPsAA+z9AAH//wAB//8AAf//AAH//wAB//8AAP//AAjf3wAAGhoAj4uKAP///wD///8A////AP///wD///8A////AP///wDNzMsAAQIBAAnDwwAA//8AAf//AAH//wAB//8AAf//AAH//wAEvPwAAyf7AAAA/gAAAP4AAAD+AAAA/gAAAP4AAAD+AAAA/gAAAP4AAAD+AAAA/gAAAP4AAAD+AAMk+wAEufsAAf//AAH//wAB//8AAf//AAH//wAA//8ACMnIAAEDAgDMy8oA////AP///wD///8A////AP///wD29/YAKx0cAAeEhAAB//8AAf//AAH//wAB//8AAf//AAH//gAFofoAAgb8AAAA/gAAAP4AAAD+AAEA/QACGvwAAjr9AAJN/QACTf0AAjv9AAIb/AABAP0AAAD+AAAA/gAAAP4AAQT8AAWb+gAC//4AAf//AAH//wAB//8AAf//AAH//wAHjYwAIxcVAPT19AD///8A////AP///wD///8Al5KRAAArKgAF+fkAAP//AAH//wAB//8AAf//AAH//wAFsfsAAgP8AAAA/gAAAP4AAhj8AARy+wADxPwAAu/9AAL//gAC//4AAv/+AAL//gAC8P0AA8X8AAR1+wACGvwAAAD+AAAA/gACAfwABar6AAH//wAB//8AAf//AAH//wAA//8ABPz8AAExLwCRi4oA////AP///wD///8A7e3tABYMCgAHsrEAAP//AAH//wAB//8AAf//AAH//wAD4fwAAxX7AAAA/wABAfwABG36AAPk/QAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AA+f9AAVy+gACA/wAAAD/AAMS+wAE3fwAAf//AAH//wAB//8AAf//AAD//wAHuroAEAcGAOvr6gD///8A////AJ6amQACMC8AA/z8AAD//wAB//8AAf//AAH//wAC//8ABGD7AAAA/gACEPwABK77AAL//gAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAC//4ABLP7AAIT/AAAAP4ABFb7AAH//wAB//8AAf//AAH//wAB//8AA/7+AAE1NACZlJMA////APv7+wA5LSwABpOTAAD//wAB//8AAf//AAH//wAB//8AA9n8AAEG/QABDPwABML8AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAExvwAAhD8AAED/QAD1fwAAf//AAH//wAB//8AAf//AAD//wAFmJcANCgmAPr6+gDc29sABgwLAAXe3gAA//8AAf//AAH//wAB//8AAf//AAOF/AABAPwABab6AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAWs+gABAP0ABH37AAH//wAB//8AAf//AAH//wAA//8ABubmAAUPDgDU1NMAqaWkAAMzMgAD/v8AAf//AAH//wAB//8AAf//AAH//wACOPwABEv6AAL//gAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAC//4ABFT6AAIv/AAC//4AAf//AAH//wAB//8AAf//AAP//wADOzkAoJybAHVsawADZWQAAf//AAH//wAB//8AAf//AAH//wAB9v4AAyv7AAPN/AAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAPV/AADKPsAAvL+AAH//wAB//8AAf//AAH//wAB//8ABHBvAGZdXABDOTgABpKSAAD//wAB//8AAf//AAH//wAB//8AAeT+AAVn+wAC//4AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//4ABWT6AAHg/gAB//8AAf//AAH//wAB//8AAP//AAWZmAA9MzMAKCAeAAevrwAA//8AAf//AAH//wAB//8AAf//AALm/QAFtvsAAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAS5+wAC4/0AAf//AAH//wAB//8AAf//AAD//wAGsbEAJh4cABkREQAHvb0AAP//AAH//wAB//8AAf//AAH//wAC+f4AA/X9AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAD9f0AAvn+AAH//wAB//8AAf//AAH//wAA//8ABr29ABgREQAZEREAB728AAD//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAP//AAa9vQAZEREAKB8eAAeurgAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAGsbAAJx8dAEM5OAAGkZEAAP//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAA//8ABZiXAD40MwBzamkABGNjAAH//wAB//8AAf//AAD//wAH6uoAAv39AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAA//8AA/z8AAfr6wAA//8AAf//AAH//wAA//8ACOrqAAP6+gAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAL9/gAH6ekAAP//AAH//wAB//8AAf//AARubQBoXl0AqKWkAAMyMAAD/v4AAf//AAH//wAA//8ADK+vAAjc3AAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAP//AAfX1wAKsbEAAP//AAH//wAB//8AAP//AAuzswAI0dEAAP//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAH4OAADKqqAAD//wAB//8AAf//AAL//wADOTgAoJybANrZ2QAHDAoABt3dAAD//wAB//8AAP//AAe5uQAPaWgAAv//AAD//wAB//8AAf//AAH//wAB//8AAP//AAL//wAPYmIACL++AAD//wAB//8AAf//AAD//wAHxsYAD2BfAAL//wAA//8AAf//AAH//wAB//8AAf//AAD//wAC//8ADmxrAAiwsAAA//8AAf//AAD//wAF5OQABhAOANfW1QD8/PwAOi4sAAWQjwAA//8AAf//AAH//wAD9/cADTIwAAt4dwAF+/sAAP//AAD//wAA//8AAP//AAT5+QAMcXEADjc2AAP6+gAB//8AAf//AAH//wAB//8AA/z8AA0+PQAMamkABPj4AAD//wAA//8AAP//AAD//wAE/f0ADH5+AA0tKwAD9PQAAf//AAH//wAA//8ABpWUADcqKQD7+/sA////AKGdnAACLSwABPv7AAD//wAB//8AAP//AAjJyQAMCwsADC8vAAmTkwAGwL8ABr+/AAiRkQALLCsADQ4OAAjQ0AAA//8AAf//AAH//wAB//8AAf//AAD//wAI1NQADRMSAAsoJwAJj44ABr6+AAbAwAAJlpUACzIyAAsIBwAIxMQAAP//AAH//wAA//8AA/7+AAEzMgCbl5UA////AP///wDw8PAAGA4MAAaurgAA//8AAf//AAH//wAA//8ACM3MAAs2NgAKAAAACQAAAAkAAAAKAAAADDo6AAjS0gAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAP//AAjW1gAMPj4ACgAAAAkAAAAJAAAACgAAAAsyMgAIyckAAP//AAH//wAB//8AAP//AAe2tgAUCgkA7O3sAP///wD///8A////AI2IhwACKyoABfj4AAD//wAB//8AAf//AAD//wAD//8AB8rKAAihoAAHoaEAB8vLAAP//wAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAA//8AA///AAfNzQAHoqIACKCgAAfIyAAD/v4AAP//AAH//wAB//8AAf//AAT7+wACLy0AjYiHAP///wD///8A////AP///wD4+PgALiEfAAZ+fQAB//8AAf//AAH//wAB//8AAf//AAD//wAA//8AAP//AAD//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAA//8AAP//AAD//wAA//8AAf//AAH//wAB//8AAf//AAH//wAIiIcAJhoYAPT09AD///8A////AP///wD///8A////ANTT0wACAgEACb6+AAD//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAJxMQAAgIBANHQzwD///8A////AP///wD///8A////AP///wD///8AoJybAAASEQAI2NgAAP//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAI3NwAABcWAJmVlAD///8A////AP///wD///8A////AP///wD///8A////AP7+/gB6dHQAABwcAAnX2AAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAI29sAASQjAHlycQD+/v4A////AP///wD///8A////AP///wD///8A////AP///wD///8A/f39AHp2dQABFxYACb6+AAH//wAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAP//AAH//wAJw8MAAxoZAGpkZAD8/PwA////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD+/v4AkY+OAAUIBwAJg4MABPn5AAD//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAP//AAT6+wAIiIgABAgIAI+LigD+/v4A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wC/vr4AKR8dAAc1NAAIsbEABP7+AAD//wAA//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAH//wAB//8AAf//AAD//wAA//8AA///AAi0tAAGODgAKyEgALu6ugD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////APLy8gCIhIIAFg4NAAY4OAAGl5cABd/fAAP//wAB//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAf//AAP//wAF4eIABpqaAAc7OgAWDw4AgHx7AO7u7gD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AOXl5QCTjo0ANSopAAgSEAAGOzoABm9uAAaamQAFt7cABMTEAATFxQAGuLcABpuaAAZwbwAGPTwACBMRADUqKQCNiIcA4uLiAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////APn5+QDPzs4AnpmYAGddXABDODcAKCAfABsWFAAaFRQAKCAfAEE4NgBqYF8AnJeWAM3NzAD5+fkA////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAA
)

hBitmap:=Base64TohBitmap(ImgBase64)
Gui,Destroy
Gui,-Caption AlwaysOnTop
Gui,add,Pic,x0 y0 w64 h64 BackgroundTrans,% "hBitmap:*" hBitmap
Gui,Show,w64 h64
OnMessage(0x201, "WM_LBUTTONDOWN")

WM_LBUTTONDOWN(wParam, lParam, uMsg, hWnd){
	PostMessage, 0xA1, 2
}

;脚本不想带文件的,小图片适用
Base64TohBitmap(base64){
	hBitmap := 0
	VarSetCapacity(B64, StrLen(base64) << !!A_IsUnicode)
	B64 := base64
	If !DllCall("Crypt32.dll\CryptStringToBinary", "Ptr", &B64, "UInt", 0, "UInt", 0x01, "Ptr", 0, "UIntP", DecLen, "Ptr", 0, "Ptr", 0)
		 Return False
	VarSetCapacity(Dec, DecLen, 0)
	If !DllCall("Crypt32.dll\CryptStringToBinary", "Ptr", &B64, "UInt", 0, "UInt", 0x01, "Ptr", &Dec, "UIntP", DecLen, "Ptr", 0, "Ptr", 0)
		 Return False
	; Bitmap creation adopted from "How to convert Image data (JPEG/PNG/GIF) to hBITMAP?" by SKAN
	; -> http://www.autohotkey.com/board/topic/21213-how-to-convert-image-data-jpegpnggif-to-hbitmap/?p=139257
	hData := DllCall("Kernel32.dll\GlobalAlloc", "UInt", 2, "UPtr", DecLen, "UPtr")
	pData := DllCall("Kernel32.dll\GlobalLock", "Ptr", hData, "UPtr")
	DllCall("Kernel32.dll\RtlMoveMemory", "Ptr", pData, "Ptr", &Dec, "UPtr", DecLen)
	DllCall("Kernel32.dll\GlobalUnlock", "Ptr", hData)
	DllCall("Ole32.dll\CreateStreamOnHGlobal", "Ptr", hData, "Int", True, "PtrP", pStream)
	hGdip := DllCall("Kernel32.dll\LoadLibrary", "Str", "Gdiplus.dll", "UPtr")
	VarSetCapacity(SI, 16, 0), NumPut(1, SI, 0, "UChar")
	DllCall("Gdiplus.dll\GdiplusStartup", "PtrP", pToken, "Ptr", &SI, "Ptr", 0)
	DllCall("Gdiplus.dll\GdipCreateBitmapFromStream",	"Ptr", pStream, "PtrP", pBitmap)
	DllCall("Gdiplus.dll\GdipCreateHBITMAPFromBitmap", "Ptr", pBitmap, "PtrP", hBitmap, "UInt", 0)
	DllCall("Gdiplus.dll\GdipDisposeImage", "Ptr", pBitmap)
	DllCall("Gdiplus.dll\GdiplusShutdown", "Ptr", pToken)
	DllCall("Kernel32.dll\FreeLibrary", "Ptr", hGdip)
	DllCall(NumGet(NumGet(pStream + 0, 0, "UPtr") + (A_PtrSize * 2), 0, "UPtr"), "Ptr", pStream)
	Return hBitmap
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA捐赠
共{{data.count}}人
人已捐赠
其他

修改注册表把cspslock换成Ralt

2021-12-12 21:00:49

其他

ahk使用循环解析,根据句号分割一句一行保存

2021-12-14 15:22:30

2 条回复 A文章作者 M管理员
  1. 白云朵朵

    学习

  2. hexuren

    搞一个bitmap转base64的呀!?

个人中心
购物车
优惠劵
有新私信 私信列表
搜索