I'm assuming there's a way to do it using DllCall or maybe PostMessage.
But the point is, I want to take the compiled script's icon and use it in a gui inside of said script.
If there is a way, please to tell or point me in the right direction, thank you!
Show Icon on compiled Script as a picture in Gui
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Show Icon on compiled Script as a picture in Gui
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: Show Icon on compiled Script as a picture in Gui
Hi.
A few years ago I used autohotkey basic and I was able to input bmp file into ahk files and even into compiled versions.
Unfortunately this method does not works now. Maybe the new autohotkey version, I'm using 1.1.26.01, does not support.
I used a tool called Get Hex of Bmp .ahkThe old compiled versions does show the image. The ahk versions does not.
I don't know why, maybe you know how to fix. I would be glad too, knowing a functionally method.
A few years ago I used autohotkey basic and I was able to input bmp file into ahk files and even into compiled versions.
Unfortunately this method does not works now. Maybe the new autohotkey version, I'm using 1.1.26.01, does not support.
I used a tool called Get Hex of Bmp .ahk
Spoiler
and after conversion I put this hex chars into my script like below
Code: Select all
...
GoSub, LoadBitmap1
hBMP := DllCall( "CreateDIBitmap", UInt,hDC, UInt,(bmiHAddr:=&BMP+14)
,UInt,(CBM_INIT:=4), UInt,&BMP+NumGet(BMP,10), UInt,&BMP+14, UInt,(DIB_PAL_COLORS:=1) )
SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBMP,, ahk_id %hPic%
...
Gui, Show, ,%MainWnd%
return
LoadBitmap1:
BMPH =
( Join
... (the hex chars)
)
nSize := StrLen(BMPH)//2
VarSetCapacity( BMP,nSize )
Loop % nSize
NumPut( "0x" . SubStr(BMPH,2*A_Index-1,2), BMP, A_Index-1, "Char" )
return
I don't know why, maybe you know how to fix. I would be glad too, knowing a functionally method.
Einfach nur ein toller Typ.
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: Show Icon on compiled Script as a picture in Gui
Hopefully I find a way, it may be something as simple as a DllCall but I'd rather just take my time with it.
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: Show Icon on compiled Script as a picture in Gui
Here are some ideas re. icons and Guis. Cheers.
Code: Select all
q:: ;show icons (note: have Notepad/IE icons, to see their icons)
;see also:
;Crazy Scripting : Include an Icon in your script - Scripts and Functions - AutoHotkey Community
;https://autohotkey.com/board/topic/31044-crazy-scripting-include-an-icon-in-your-script/
;method 1
Gui, Add, Picture,, % A_AhkPath
;method 2
hIcon := LoadPicture(A_AhkPath, "", vType)
Gui, Add, Picture,, % "HICON:" hIcon
;method 3
WinGet, hWnd, ID, ahk_class IEFrame
;ICON_SMALL := 0 ;ICON_BIG := 1 ;ICON_SMALL2 := 2
SendMessage, 0x7F, 1,,, % "ahk_id " hWnd ;WM_GETICON := 0x7F
hIcon := ErrorLevel
Gui, Add, Picture,, % "HICON:" hIcon
;method 4
WinGet, hWnd, ID, ahk_class Notepad
;GCL_HICON := -14 ;GCL_HICONSM := -34
vSfx := (A_PtrSize=8) ? "Ptr" : ""
if hIcon := DllCall("GetClassLong" vSfx, Ptr,hWnd, Int,-14, UInt)
Gui, Add, Picture,, % "HICON:" hIcon
;method 5
hIcon := DllCall("LoadIcon", Ptr,0, Ptr,32512, Ptr) ;IDI_APPLICATION (standard exe icon)
Gui, Add, Picture,, % "HICON:" hIcon
;method 6
vPath := A_AhkPath
hModule := DllCall("LoadLibrary", Str,vPath)
hIcon00 := DllCall("LoadIcon", Ptr,hModule, Ptr,159, Ptr) ;[green H]
hIcon01 := DllCall("LoadIcon", Ptr,hModule, Ptr,206, Ptr) ;S on [green S]
hIcon10 := DllCall("LoadIcon", Ptr,hModule, Ptr,207, Ptr) ;P on [red H]
hIcon11 := DllCall("LoadIcon", Ptr,hModule, Ptr,208, Ptr) ;PS on [red S]
vList := "00,01,10,11"
Loop, Parse, vList, % ","
Gui, Add, Picture,, % "HICON:" hIcon%A_LoopField%
Gui, Show, w300 h400
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA