FileGetSize, size, 1.jpg file := FileOpen("1.jpg","r") readbytes := file.RawRead(buff, size) file.close() file2 := FileOpen("2.jpg","w") writebytes := file2.RawWrite(&buff, readbytes) file2.close() Return /* FileGetSize, vSize, D:\PSTools\图标\11原图.png FileRead, vData, *c D:\PSTools\图标\11原图.png pToken := Gdip_StartUp() ; GDI库加载 MsgBox % hBitmap := GDIPlus_hBitmapFromBuffer(vData, vSize) Gui, Add, Picture, vPic, % "HBITMAP:*" hBitmap Gui, Show, w1000 h700, AHK窗口显示 Return GDIPlus_hBitmapFromBuffer(ByRef Buffer, nSize) { ; by SKAN hData := DllCall("GlobalAlloc", "Uint", 2, "Uint", nSize) pData := DllCall("GlobalLock", "Uint", hData) DllCall("RtlMoveMemory", "Uint", pData, "Uint", &Buffer, "Uint", nSize) DllCall("GlobalUnlock", "Uint", hData) DllCall("ole32\CreateStreamOnHGlobal", "Uint", hData, "int", True, "UIntP", pStream) DllCall("gdiplus\GdipCreateBitmapFromStream", "Uint", pStream, "UIntP", pBitmap) DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Uint", pBitmap, "UIntP", hBitmap, "Uint", DllCall("ntdll\RtlUlongByteSwap", "Uint", DllCall("GetSysColor", "int", 15 ) <<8 ) | 0xFF000000) DllCall("gdiplus\GdipDisposeImage", "Uint", pBitmap) DllCall(NumGet( NumGet(1*pStream)+8 ), "Uint", pStream) ; IStream::Release Return hBitmap } */
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)