Page 2 of 4

Re: GUI skinning using USkin.dll and .msstyles

Posted: 28 Jan 2015, 10:26
by Soft
@joedf / thank you so much!

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 11:56
by Soft
2015/02/03 + I added SkinSharp.dll method and modified the article

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 12:28
by joedf
Very cool find! Do you have the source code for this other dll?

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 13:22
by lblb
Hi Soft,

This is nice! Thanks for your work on this.

I'm encountering a small issue though. On my system (Win 7 64 bit, ahk 1.1.16.05 ANSI 32), if I add for example a FileSelectFile command to the button in your example, the address bar of the FileSelectFile window doesn't show correctly (there is a black bar surrounding it). To reproduce, add "gSelectFile" as a g-label for the Button on your Gui, then add somewhere:

Code: Select all

SelectFile:
FileSelectFile, OutputVar
Msgbox, %OutputVar%
Return
Can you reproduce this issue? If yes, can anything be done about this?

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 23:38
by Soft
@joedf / I saw some parts of source but couldnt find the file. and the article was written in chinese
@lblb / I just tested FileSelectFile window, and it was fine for me

tested script (used 'Ayofe.msstyles')

Code: Select all

DllCall("LoadLibrary", str, A_ScriptDir "\USkin.dll")
DllCall("USkin\USkinInit", Int, 0, Int, 0, AStr ,A_ScriptDir "\Ayofe.msstyles")

FileSelectFile, OutputVar
Msgbox, %OutputVar%
Return

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 23:45
by joedf
@Soft ahhh... ok :P

Re: GUI Skinning Methods

Posted: 02 Feb 2015, 23:56
by Soft
@joedf / Here is SkinSharp API C++ file. Its written in Chinese but you probably can understand the API syntax!
Spoiler
.she theme file editor (Chinese again... can anyone speak chinese? plz translate this)
http://knowledgeisfree.tistory.com/atta ... 257682.zip

Re: GUI Skinning Methods

Posted: 03 Feb 2015, 00:14
by lblb
Hi Soft,

Thanks for the quick reply.

Did you have Windows Aero turned on during your test? It seems like the bug shows up only when Aero is on. See the attached animated gif. You can see that the address bar has an unwanted black box around it. Also, when I resize the FileSelectFile, you can see that there are all kinds of artifacts that show up. While resizing, a black contour around the FileSelectFile window sometimes shows up. Also, you can see that on the right edge of the FileSelectFile window there are some dark marks that appear from time to time.

Thanks in advance for any input you may have.

Re: GUI Skinning Methods

Posted: 03 Feb 2015, 00:21
by Soft
@lblb / oh same for me, the black box appears while resizing. I will figure it out. Thanks for the report

Re: GUI Skinning Methods

Posted: 03 Feb 2015, 01:55
by huyaowen
The second method maybe has bug,click button cannt change his skin sometimes.

Re: GUI Skinning Methods

Posted: 03 Feb 2015, 03:50
by Soft
@hyaowen / try this script

Code: Select all

; Cool preview gui script written by 'garry'

#NoEnv
#SingleInstance force

setworkingdir,%a_scriptdir%
Gui,1:default
f2=%a_scriptdir%\GuiStyle_Soft.ahk
RSSINI=%A_scriptdir%\RSSINI.ini
Loop, %a_scriptdir%\*.she,,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 w100 gNextx,NEXT>
Gui,1:show, x200 y400 h90 w140
gosub,create2
;gosub,next2
return


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

;--------------
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,5000
 }
return

Guiclose:
exitapp
;---------------------------------------
create2:
Gui,1:submit,nohide
e4x=
(
#NoEnv
#SingleInstance force
pr:= a_scriptdir . "\SkinH_EL.dll"
IniRead, aa1, %rssini% , A1 , Key1
aa1:= aa1
SkinForm(Apply,pr,aa1)

OnExit, GetOut
Gui,2: +LastFound +hwndMainF
Gui,2: add, button,xm w100 h40, Button
Gui,2: add, edit, xm y+20 w100 h20, Edit
Gui,2: add, listbox,xm y+20, ListBox
Gui,2: add, checkbox,xm y+20, checkbox
Gui,2: add, DDL, xm y+20, DropDownList
Gui,2: Show, w200 , GUI_Style
return
;-----------------------------------

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

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



Re: GUI Skinning Methods

Posted: 04 Feb 2015, 02:31
by huyaowen
Soft wrote:@hyaowen / try this script

Code: Select all

; Cool preview gui script written by 'garry'

#NoEnv
#SingleInstance force

setworkingdir,%a_scriptdir%
Gui,1:default
f2=%a_scriptdir%\GuiStyle_Soft.ahk
RSSINI=%A_scriptdir%\RSSINI.ini
Loop, %a_scriptdir%\*.she,,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 w100 gNextx,NEXT>
Gui,1:show, x200 y400 h90 w140
gosub,create2
;gosub,next2
return


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

;--------------
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,5000
 }
return

Guiclose:
exitapp
;---------------------------------------
create2:
Gui,1:submit,nohide
e4x=
(
#NoEnv
#SingleInstance force
pr:= a_scriptdir . "\SkinH_EL.dll"
IniRead, aa1, %rssini% , A1 , Key1
aa1:= aa1
SkinForm(Apply,pr,aa1)

OnExit, GetOut
Gui,2: +LastFound +hwndMainF
Gui,2: add, button,xm w100 h40, Button
Gui,2: add, edit, xm y+20 w100 h20, Edit
Gui,2: add, listbox,xm y+20, ListBox
Gui,2: add, checkbox,xm y+20, checkbox
Gui,2: add, DDL, xm y+20, DropDownList
Gui,2: Show, w200 , GUI_Style
return
;-----------------------------------

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

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


aha,looks ok!thanks.
Could U write some ways to support .Skn skin file?

Re: GUI Skinning Methods

Posted: 04 Feb 2015, 02:58
by Soft
@huyaowen / I dont know about .skn file. Where can I find .skn file?
with dll and c++ source maybe I can help you

Re: GUI Skinning Methods

Posted: 06 Feb 2015, 00:55
by huyaowen
.skn and .ssk can also used for changing skin.
FSViewer.exe is an example.but I don't know much.
Can you dig dig and dig it?

Re: GUI Skinning Methods

Posted: 12 Feb 2015, 17:49
by tmplinshi
SkinH is a shareware. Unregistered version will have a small T-shirt icon in the title bar and menu.

There is a SHEditor.exe in the official downloads, which can used to create or edit the .she skin file. It also can convert .msstyles file to .she file :P .

SkinH supports loading .she skin from memory, then by using HotkeyIt's _MemoryLibrary we can generate a standalone exe (contains dll and .she in it).
SkinH_AttachRes Sample.ahk
SkinH_AttachRes Sample.7z
Some .she skins (49 files)

Re: GUI Skinning Methods

Posted: 13 Feb 2015, 15:27
by evilC
A little technique I use to add USkin to any UI:

In your C:\Program Files\Autohotkey\Lib folder, Make a Uskin folder and place inside it your Uskin.dll and msstyles files.
In the main lib folder, make a file USkin.ahk, paste in the following code and alter to your needs:

Code: Select all

; set path to files here
path := "C:\Program Files\AutoHotkey\Lib\Uskin\"
; Set style
Style := path "Milikymac.msstyles"
; Do not edit below here
dll := path "USkin.dll"
SkinForm(Apply, dll, Style)
; normal skinform func
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")
		}
}
Add the code #include *i <USkin> to the start of any script you wish to try USkin with.

The *i means it will skip if file not found, so if you give someone else the script and forget to take the include out, no biggie, it will ignore the include and they will just get normal ahk gui.
This means you can use Uskin in GitHub repos without having it as a dependency.

By the way, USkin does not seem to play well with scrollable GUIs. any ideas on that?

Re: GUI Skinning Methods

Posted: 13 Feb 2015, 15:56
by evilC
Same technique, but for SkinSharp:

Code: Select all

; set path to files here
path := "C:\Program Files\AutoHotkey\Lib\SkinSharp\"
; Set style
Style := path "aero.she"
; Do not edit below here
dll := path "SkinH_EL.dll"
DllCall("LoadLibrary", str, dll) ;Opens the DLL
DllCall(dll "\SkinH_AttachEx", AStr, Style, Str,"mhgd")
put files in C:\Program Files\Autohotkey\Lib\SkinSharp, include with #include *i <SkinSharp>

Unlike USkin, SkinSharp does NOT break ScrollGui :thumbup:

Re: GUI Skinning Methods

Posted: 19 Feb 2015, 01:27
by tomoe_uehara
I suggest you to make a mirror for the download link, because in the past we had sooo many broken links when autohotkey.net is down.
Image

I don't say that your personal blog will be down, but nobody knows the future, so I suggest you to make a mirror to prevent that thing from happening again

Image

Re: GUI Skinning Methods

Posted: 19 Feb 2015, 09:06
by Guest
evilC wrote:Same technique, but for SkinSharp:

Code: Select all

; set path to files here
path := "C:\Program Files\AutoHotkey\Lib\SkinSharp\"
; Set style
Style := path "aero.she"
; Do not edit below here
dll := path "SkinH_EL.dll"
DllCall("LoadLibrary", str, dll) ;Opens the DLL
DllCall(dll "\SkinH_AttachEx", AStr, Style, Str,"mhgd")
put files in C:\Program Files\Autohotkey\Lib\SkinSharp, include with #include *i <SkinSharp>

Unlike USkin, SkinSharp does NOT break ScrollGui :thumbup:
What does "mhgd" mean?

Re: GUI Skinning Methods

Posted: 19 Feb 2015, 09:36
by Soft
skinsharp.dll's password