SetWorkingDir %A_ScriptDir%

hBitmap := DevIL_FileToHBitmap("test.psd")
Gui, Add, Pic, , HBITMAP:%hBitmap%
Gui, Show
Return

; https://www.autohotkey.com/boards/viewtopic.php?p=351222#p351222

; https://openil.sourceforge.net/download.php

; Requires DevIL.dll, ILU.dll, ILUT.dll
; from http://openil.sourceforge.net/
DevIL_FileToHBitmap(Filename) {
  hModule := DllCall("LoadLibrary", "str", "DevIL.dll", "ptr")
  DllCall("DevIL\ilInit")

  hDC := DllCall("GetDC", "ptr", 0, "ptr")
  hBitmap := DllCall("ILUT\ilutWinLoadImage", "str", Filename, "ptr", hDC, "ptr")
  
  DllCall("ReleaseDC", "ptr", 0, "ptr", hDC)
  DllCall("DevIL\ilShutDown")
  DllCall("FreeLibrary", "ptr", hModule)
  return hBitmap
}

GuiClose() {
  ExitApp
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。