GUI Skinning Methods

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

GUI Skinning Methods

08 Jan 2015, 00:30

2015/02/03 + Added SkinH.dll, modified the article

Currently, There are 2 methods for GUI skinning

#1 USkin based on SKAN's USkin article
Image

Requirement : download via my blog (blog is written in Korean so I'll give u direct link below)

USkin.dll http://knowledgeisfree.tistory.com/atta ... 2E0DF4.dll
.msstyles(THEME file) All in one ZIP file! (I've collected) http://knowledgeisfree.tistory.com/atta ... 048C49.zip
.msstyles(THEME file) I used in above screenshot http://knowledgeisfree.tistory.com/atta ... 2.msstyles

or All in one 'USkin ArchivePack' by 'joedf' http://ge.tt/8zMaRUW1?c

SkinForm.ahk (Lib file)

Code: Select all

SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
	if(Param1 = Apply){
		DllCall("LoadLibrary", str, DLL)
		DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName) ; For Unicode AHK
		;DllCall(DLL . "\USkinInit", Int,0, Int,0, Str, SkinName) ; For ANSI AHK
	}else if(Param1 = 0){
		DllCall(DLL . "\USkinExit")
		}
}
PUT Lib file in Autohotkey\Lib or use #Include

How To:
to Skin your Gui write this code on top of your script, remeber you have to set .msstyles name!
SkinForm(Apply, A_ScriptDir . "\USkin.dll", A_ScriptDir . "\FileNameHere.msstyles")

when exitting you have to
SkinForm(0)
in order to close the USkin.dll

Example: Using .msstyles that was used in screenshot

Code: Select all

#NoEnv
#SingleInstance force
SkinForm(Apply, A_ScriptDir . "\USkin.dll", A_ScriptDir . "\Milikymac.msstyles")
OnExit, GetOut
Gui, add, button,xm w100 h40, Button
Gui, add, edit, xm y+20 w100 h20, Edit
Gui, add, listbox,xm y+20, ListBox
Gui, add, checkbox,xm y+20, checkbox
Gui, add, DDL, xm y+20, DropDownList
Gui, Show, AutoSize, Test
return

GetOut:
GuiClose:
Gui, Hide
SkinForm(0)
ExitApp
return

SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
	if(Param1 = Apply){
		DllCall("LoadLibrary", str, DLL)
		DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
	}else if(Param1 = 0){
		DllCall(DLL . "\USkinExit")
		}
}
#2 SkinSharp

Image

2015/02/03 - I found this dll in AutoIt forum. And ported to AutoHotkey

Requirement
http://knowledgeisfree.tistory.com/atta ... 2DDA49.zip
Examples are included.

How To
to skin your project, write the code on top of your script and remember to change ThemeFileName!
DllCall(A_ScriptDir "\SkinH_AttachEx", AStr,A_ScriptDir "\ThemeFileName.she", Str,"mhgd")

Code: Select all

DllCall("LoadLibrary", str, A_ScriptDir "\SkinH_EL.dll") ;Opens the DLL
DllCall(A_ScriptDir "\SkinH_AttachEx", AStr,A_ScriptDir "\ThemeFileName.she", Str,"mhgd")
/*
 SkinH_AttachEx - Changes GUI
 SkinH_AttachExt - Changes GUI, bright, fonts and more (not Implemented? I'm trying to figure out)
 
===SkinH_EL.dll Function List
SkinH_AdjustAero			5004960
SkinH_AdjustHSV			5004912
SkinH_Attach			5004720
SkinH_AttachEx			5004736
SkinH_AttachExt			5004768
SkinH_AttachRes			5004816
SkinH_AttachResEx			5004864
SkinH_Detach			5005136
SkinH_DetachEx			5005152
SkinH_GetColor			5005168
SkinH_LockUpdate			5005072
SkinH_Map			5005104
SkinH_NineBlt			5005280
SkinH_SetAero			5004944
SkinH_SetBackColor			5005440
SkinH_SetFont			5005328
SkinH_SetFontEx			5005360
SkinH_SetForeColor			5005472
SkinH_SetMenuAlpha			5005024
SkinH_SetTitleMenuBar			5005232
SkinH_SetWindowAlpha			5005040
SkinH_SetWindowMovable			5005200
SkinH_VerifySign			5005504
/*

Any ideas are welcome!

Reference
USKin soure code http://www.codeproject.com/Articles/139 ... Applicatio
Last edited by Soft on 02 Feb 2015, 11:56, edited 7 times in total.
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
TheDewd
Posts: 1503
Joined: 19 Dec 2013, 11:16
Location: USA

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 09:41

Wow, thanks! I didn't know you could use msstyles with USkin. I assumed only skins made by USkin would work.
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 10:44

Thanks! I never got around to giving this (that topic) a try. will try this!
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 14:49

Corrected SkinForm.ahk
DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName) ; For ANSI AHK
to
DllCall(DLL . "\USkinInit", Int,0, Int,0, Str, SkinName) ; For ANSI AHK
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
fischgeek
Posts: 433
Joined: 29 Jan 2014, 21:39

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 15:19

This is pretty cool. Thanks for the styles too. I read the original post from the .com site (link below) and couldn't find a clear cut answer on how to make or edit skins.

http://www.autohotkey.com/board/topic/5 ... ication-c/
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 17:17

USkin.dll Source code: http://www.codeproject.com/KB/library/USkin.aspx

Please add it to your post. ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
fischgeek
Posts: 433
Joined: 29 Jan 2014, 21:39

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 18:59

Yeah. I saw that, but wasn't too sure how to use it. Perhaps I just need to spend more time with it.
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: GUI skinning using USkin.dll and .msstyles

09 Jan 2015, 22:31

joedf wrote:USkin.dll Source code: http://www.codeproject.com/KB/library/USkin.aspx

Please add it to your post. ;)
thanks joedf!
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GUI skinning using USkin.dll and .msstyles

24 Jan 2015, 16:32

I think so, yes! It changes the resources used for the visuals!
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: GUI skinning using USkin.dll and .msstyles

25 Jan 2015, 00:51

@evilC Yes.
@joedf Exactly
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: GUI skinning using USkin.dll and .msstyles

26 Jan 2015, 03:54

It's very nice. Thanks!
Everything is possible!
garry
Posts: 3720
Joined: 22 Dec 2013, 12:50

Re: GUI skinning using USkin.dll and .msstyles

26 Jan 2015, 12:06

thank you 'Soft'
added a testscript to see the styles for 5 seconds
it works for me , but maybe needs corrections

EDIT : added menu to GUI_Style script

more x.msstyles files :
http://www.codejock.com/downloads/sampl ... styles.asp

Code: Select all

modified=20150127
; http://ahkscript.org/boards/viewtopic.php?f=6&t=5841
; add this script to the same folder with *.msstyles ( subfolder is OSXstyle ) and USkin.dll
;------------------------------------------------------------------------------------------------------------------------------------------------------------
; from user = 'Soft'  ,  here added a testscript to test GUI_Styles
; Requirement : download via my blog (blog is written in Korean so I'll give u direct link below)
; USkin.dll      http://knowledgeisfree.tistory.com/attachment/[email protected]
;
; .msstyles(THEME file) All in one ZIP file collected ahk-user 'soft' http://knowledgeisfree.tistory.com/attachment/[email protected]
;-------------------------------------------------------------------------------------------------------------------------------------------------------------
setworkingdir,%a_scriptdir%
Gui,1:default

uskinx=%a_scriptdir%\USkin.dll
ifnotexist,%uskinx%
  {
  msgbox, 262208, ,USkin.dll not exist`nYou should download ZIP-File also with msstyles from ahk-user Soft`nAnd add this script to the same folder
  run,http://knowledgeisfree.tistory.com/attachment/[email protected]
  exitapp
  }

f2=%a_scriptdir%\GuiStyle_Menu.ahk      ;- 2nd ahk-file with NEW Styles
RSSINI=%A_scriptdir%\RSSINI.ini

Loop, %a_scriptdir%\*.msstyles,,1
  e .= A_LoopFileFullPath . "`r`n"

n=0
z=0
Gui,1:Font, CDefault, FixedSys
Gui,1:Color,Black

;- use button Next
;  or
;- use gosub next2 which displays for 5 seconds

Gui,1:add,edit    ,x10 y10 h25 w120 vE1 readonly cYellow,
Gui,1:add,button  ,x10 y50 h25 w120 gNextx,NEXT-STYLE >>
Gui,1:show, x10 y10 h90 w140
gosub,create2
gosub,nextx      ;- button
;gosub,next2     ;- auto
return

;-- button select -------------
nextx:
Gui,1:submit,nohide
n++
Loop,parse,e,`n,`r
 {
 z++
 y:=A_LoopField
 if (y="")
    {
    n:=(n-1)
    GuiControl,1:,e1,%n%-styles END
    n=0
    return
    }
 if (n=z)
    {
    z=0
    break
    }
 }
IniWrite,%y%   , %rssini% ,A1   , KEY1
SplitPath,y,name, dir, ext, name_no_ext, drive
run,%f2%
GuiControl,1:,e1, %name_no_ext%
return

;---- auto-select ----------
next2:
Gui,1:submit,nohide
Loop,parse,e,`n,`r
 {
 y:=A_LoopField
 if (y="")
   continue
 ;msgbox, 262208, ,%y% ,
 IniWrite,%y%   , %rssini% ,A1   , KEY1
 SplitPath,y,name, dir, ext, name_no_ext, drive
 run,%f2%
 GuiControl,1:,e1, %name_no_ext%
 sleep,6000
 }
return
;--------
Guiclose:
exitapp
;---------------------------------------
create2:
Gui,1:submit,nohide
e4x=
(
#NoEnv
#SingleInstance force
pr:= a_scriptdir . "\USkin.dll"
IniRead, aa1, %rssini% , A1 , Key1
SplitPath,aa1,name, dir, ext, name_no_ext2, drive
aa1:= aa1

SkinForm(Apply,pr,aa1)
OnExit, GetOut

Gui,2:Font, CDefault, FixedSys
Gui,2:Color,Teal

Menu, FFFF, Add, &Notepad , 1F
Menu, FFFF, Add, &Calc    , 2F
Menu, AAAA, Add, &OPEN_2, :FFFF
Menu, AAAA, Add, &Charmap , 2A
Menu, AAAA, Add, &AHK_Version , 3A
Menu, BBBB, Add, &OPEN_1, :AAAA

Menu, BBBB, Add, &Print, FilePrint
Menu, BBBB, Add  ;- Separator line.
Menu, BBBB, Add, &Exit, FileExit

Menu, DDDD, Add, &About Test, Help

Menu,MyMenuBar, Add, &File, :BBBB
Menu,MyMenuBar, Add, &Help, :DDDD

Gui,2: Menu, MyMenuBar

Gui,2: add, button,xm w100 h40 gButton1, Button-1
Gui,2: add, edit, xm y+20 w100 h45 vE1,Line1``nLine2``nLine3``nLine4
MList:="Soft|David|Garry"
Gui,2: add, listbox,xm y+20 vList1 gLB1,`% MList
Gui,2: add, checkbox,xm y+20 vCB1, checkbox-1
Gui,2: add, DDL, xm y+20 gDDLx vDDLv, a1|a2||a3
t1=_
Gui,2: Show,x160 y10 w200 ,`%t1`%
GuiControl,2: Choose, List1, 2
WinSetTitle, `%T1`%, , `%name_no_ext2`%
return
;-----------------------------------


Fileexit:
GetOut:
2GuiClose:
Gui,2: Hide
SkinForm(0)
ExitApp

Button1:
Gui,2:submit,nohide
if (cb1)
 k=YES
else
 k=NO
msgbox, 262208, ,You clicked Button-1``nContent from Edit is=``n `%e1`%``nListbox_Selected=`%List1`%``nCheckbox=`%k`%``nDDL=`%ddlv`%
return

DDLX:
Gui,2:submit,nohide
msgbox, 262208, ,You selected `%ddlv`%
return

LB1:
Gui,2:submit,nohide
msgbox, 262208, ,You selected `%List1`%
return

;--- menus ---------------------
Help:
msgbox,This is an example
return

1F:
Run,notepad
return

2F:
Run,calc
return

2A:
run,charmap
return

3A:
msgbox,AHKVERSION=%a_ahkversion%
return

Fileprint:
msgbox, 262208, ,Fileprint_Message
return

;-----------------------------------

SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
    if(Param1 = Apply){
        DllCall("LoadLibrary", str, DLL)
        DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
    }else if(Param1 = 0){
        DllCall(DLL . "\USkinExit")
        }
}
)
ifnotexist,%f2%
  fileappend,%e4x%,%f2%
e4x=
return
;========================================================

Last edited by garry on 28 Jan 2015, 16:44, edited 3 times in total.
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: GUI skinning using USkin.dll and .msstyles

26 Jan 2015, 21:32

Wow~This is pretty cool。



Cannt set MENU text into this right style.
QQ截图20150127100835.jpg
QQ截图20150127100835.jpg (40.7 KiB) Viewed 19297 times
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: GUI skinning using USkin.dll and .msstyles

27 Jan 2015, 01:42

@garry / wow! I always thoght about that. Excellent work.
@huyaowen / I guess the .msstyles does not support MENU?
AutoHotkey & AutoHotkey_H v1.1.22.07
garry
Posts: 3720
Joined: 22 Dec 2013, 12:50

Re: GUI skinning using USkin.dll and .msstyles

27 Jan 2015, 08:21

@huyaowen / I guess the .msstyles does not support MENU?
EDIT :
I tried, had success with MENU , added to test-script above
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GUI skinning using USkin.dll and .msstyles

27 Jan 2015, 20:37

Dont forget to mention that its only a 32 bit dll!!!! ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GUI skinning using USkin.dll and .msstyles

27 Jan 2015, 23:47

added `USkin-ArchivePack-0001.7z`
here: http://ge.tt/8zMaRUW1?c
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: GUI skinning using USkin.dll and .msstyles

28 Jan 2015, 01:17

joedf wrote:added `USkin-ArchivePack-0001.7z`
here: http://ge.tt/8zMaRUW1?c
thanks.joedf and garry.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 74 guests