Jump to content

SkinCrafter UDF


ken82m
 Share

Recommended Posts

Thanks to monoceres for the example to get me started on this.

Saw a few posts here and there some worked most didn't.

So I put together this UDF to make using this thing a little easier.

Enjoy,

Kenny

Example

#include <SkinCrafter.au3>
_LoadSkinCrafter("SkinCrafterDLL.dll");Load SkinCrafter DLL

;GUI With Initial Skin
$GUI_1 = GuiCreate("Test", -1, -1, 0, 0)
_InitializeSkinCrafter($GUI_1, "ice-cold.skf")
GUICtrlCreateButton("Test", 50, 50, 50)
GUISetState()

;GUI With Additional Skin Loaded & Applied
$GUI_2 = GuiCreate("Test2", -1, -1, 200, 0)
GUICtrlCreateButton("Test", 10, 10, 50)
_LoadSkin("skinastic.skf", 2)
_ApplySkin($GUI_2, 2)
GUISetState()

;GUI with no skin applied
$GUI_3 = GuiCreate("Test3", -1, -1, 400, 0)
GUICtrlCreateButton("Test", 10, 10, 50)
_ExcludeSkin($GUI_3)
GUISetState()

;GUI with initial skin automatically applied
$GUI_4 = GuiCreate("Test4", -1, -1, 600, 0)
GUICtrlCreateButton("Test", 10, 10, 50)
GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd

UDF

#cs ----------------------------------------------------------------------------
 AutoIt Version: 3.3.0.0
 Author:         Kenneth P. Morrissey (ken82m)

 UDF Function:   Enabled skinning of AutoIT GUI's using SkinCrafter
                (Tested with SkinCrafter 3.3.3)
                 
 Example
                #include <SkinCrafter.au3>
                _LoadSkinCrafter("SkinCrafterDLL.dll");Load SkinCrafter DLL

        ;GUI With Initial Skin
                $GUI_1 = GuiCreate("Test", -1, -1, 0, 0)
                _InitializeSkinCrafter($GUI_1, "ice-cold.skf")
                GUICtrlCreateButton("Test", 50, 50, 50)
                GUISetState()

        ;GUI With Additional Skin Loaded & Applied
                $GUI_2 = GuiCreate("Test2", -1, -1, 200, 0)
                GUICtrlCreateButton("Test", 10, 10, 50)
                _LoadSkin("skinastic.skf", 2)
                _ApplySkin($GUI_2, 2)
                GUISetState()

        ;GUI with no skin applied
                $GUI_3 = GuiCreate("Test3", -1, -1, 400, 0)
                GUICtrlCreateButton("Test", 10, 10, 50)
                _ExcludeSkin($GUI_3)
                GUISetState()

        ;GUI with initial skin automatically applied
                $GUI_4 = GuiCreate("Test4", -1, -1, 600, 0)
                GUICtrlCreateButton("Test", 10, 10, 50)
                GUISetState()

                While 1
                   If GuiGetMsg()=-3 Then Exit
                WEnd
#ce ----------------------------------------------------------------------------
Global $nSkinCrafterDll



#cs===================================================================================
 Fuction        _LoadSkinCrafter ( $nDLL ) 

 Description    Loads the SkinCrafter DLL into Memory
                This should be run before any GUI's are created.

 Parameter      $nDLL       The path to SkinCrafterDLL.dll

 Return         Success     1
                Failure     0   Sets @error:  1 - $nDLL   Does Not Exist
                                              2 - DLLOpen  Failed

 Author         Kenneth P. Morrissey (ken82m)
#ce===================================================================================
Func _LoadSkinCrafter($nDLL)
    $nSkinCrafterDll = DllOpen($nDLL)
    If Not FileExists($nDLL) Then
        SetError(1)
        Return 0
    EndIf
    If $nSkinCrafterDll = -1 Then
        SetError(2)
        Return 0
    EndIf
    DllCall($nSkinCrafterDll, "int:cdecl", "InitLicenKeys", "wstr","SKINCRAFTER", "wstr","SKINCRAFTER.COM", "wstr", "support@skincrafter.com","wstr","DEMOSKINCRAFTERLICENCE")
    DllCall($nSkinCrafterDll, "int:cdecl", "DefineLanguage", "int", 0)
    Return 1
EndFunc



#cs===================================================================================
 Fuction        _InitializeSkinCrafter ( $nHWND , $nSkin )

 Description    Load Initial Skin and Apply to GUI (Only Run ONCE)
                This should be run AFTER the GUI is created but BEFORE any controls.
                
                This skin will apply to all future GUI's by default.

 Parameter      $nHWND      Handle to the first GUI created
                $nSkin      Path to Skin File (SKF)

 Return         Success     1
                Failure     0   Sets @error:  1 - $nInitialGUI  Does Not Exist
                                              2 - $nSkin        Does Not Exist

 Author         Kenneth P. Morrissey (ken82m)
#ce===================================================================================
Func _InitializeSkinCrafter($nHWND, $nSkin)
    If Not WinExists($nHWND) Then
        SetError(1)
        Return 0
    EndIf
    If Not FileExists($nSkin) Then
        SetError(2)
        Return 0
    EndIf
    DllCall($nSkinCrafterDll, "int:cdecl", "InitDecoration", "int", 1)
    DllCall($nSkinCrafterDll, "int:cdecl", "LoadSkinFromFile", "wstr", $nSkin)
    DllCall($nSkinCrafterDll, "int:cdecl", "ApplySkin")
    DllCall($nSkinCrafterDll, "int:cdecl", "DecorateAs","long",$nHWND,"long",1)
    Return 1
EndFunc



#cs===================================================================================
 Fuction        _ApplySkin ( $nHWND , $nSkinID )

 Description    Load Initial Skin and Apply to GUI (Only Run ONCE)
                No restrictions, this can be run at any time during the script after InitializeSkinCrafter()

 Parameter      $nHWND      Handle to the first GUI created
                $nSkinID    ID of loaded skin to apply (Must be greater than 1)

 Return         Success     1
                Failure     0   Sets @error:  1 - $nHWND    Does Not Exist
                                              2 - $nSkinID  is invalid

 Author         Kenneth P. Morrissey (ken82m)
#ce===================================================================================
Func _ApplySkin($nHWND, $nSkinID)
    If Not WinExists($nHWND) Then
        SetError(1)
        Return 0
    EndIf
    If $nSkinID > 1 Then
        DllCall($nSkinCrafterDll, "int:cdecl", "ApplyAddedSkin","long",$nHWND,"long",$nSkinID)
        Return 1
    Else
        SetError(2)
        Return 0
    EndIf
EndFunc



#cs===================================================================================
 Fuction        _LoadSkin ( $nSkin , $nSkinID )

 Description    Load additional skin file.

 Parameter      $nSkin      Path to the skin file being loaded
                $nSkinID    ID to associate with the skin (Must be a number greater than 1)

 Return         Success     1
                Failure     0   Sets @error:  1 - $nSkin    Does Not Exist
                                              2 - $nSkinID  is Inavlid

 Author         Kenneth P. Morrissey (ken82m)
#ce===================================================================================
Func _LoadSkin($nSkin, $nSkinID)
    If Not FileExists($nSkin) Then
        SetError(1)
        Return 0
    EndIf
    If $nSkinID > 1 Then
        DllCall($nSkinCrafterDll, "int:cdecl", "AddSkinFromFile", "wstr", $nSkin, "short",$nSkinID)
        Return 1
    Else
        SetError(2)
        Return 0
    EndIf
EndFunc



#cs===================================================================================
 Fuction        _ExcludeSkin ( $nHWND )

 Description    Excludes a GUI from all loaded skins.

 Parameter      $nHWND      Handle to the GUI to exclude

 Return         Success     1
                Failure     0   Sets @error:  1 - $nHWND  Does Not Exist

 Author         Kenneth P. Morrissey (ken82m)
#ce===================================================================================
Func _ExcludeSkin($nHWND)
    If Not WinExists($nHWND) Then
        SetError(1)
        Return 0
    EndIf
    DllCall($nSkinCrafterDll, "int:cdecl", "ExcludeWnd", "long", $nHWND)
    Return 1
EndFunc

post-240-1236625138_thumb.jpg

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Added to first post. You can see shots of different skins here: http://www.skincrafter.com/skingal.php

-Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Looks cool on the screenshot but I don't understand how to use it, will I need the fullversion of SkinCrafter or is the demo enough? What's the difference between them?

Link to comment
Share on other sites

The demo always shows a splash when a style is assigned to a window and the user has to close it.

USkin ( http://www.neemedia.com/newsite/index.php?category=5 ) has some free functions without splash, but you can only set .msstyles (default windows styles, no transparency) global for you app.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

The demo always shows a splash when a style is assigned to a window and the user has to close it.

USkin ( http://www.neemedia.com/newsite/index.php?category=5 ) has some free functions without splash, but you can only set .msstyles (default windows styles, no transparency) global for you app.

Thanks ProgAndy. I am never gonna pay 400 usd for a splash screen :P but I will take a look at USkin
Link to comment
Share on other sites

lucky me i have the dll but im facing a problem with tabs every time i use SkinCrafter

if u test this script i posted u will see that every input control do not have a boarder

strange but true

can u help with that?

take a look on the script

#include <SkinCrafter.au3>

_LoadSkinCrafter("Skin.dll");Load SkinCrafter DLL
$Form1 = GUICreate("Test", 615, 400)
_InitializeSkinCrafter($Form1, "skin.skf")

$hTab = GUICtrlCreateTab(205, 70, 380, 270)

GUICtrlCreateTabItem("One") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateInput("", 340, 210, 200, 20)
GUICtrlCreateInput("", 345, 270, 40, 20)
GUICtrlCreateCombo("1", 395, 270, 68, 20)
GUICtrlSetData(-1, "2|3", "1")
GUICtrlCreateButton("ok", 270, 305, 90, 25)
GUICtrlCreateButton("cancel", 400, 305, 90, 25)

GUICtrlCreateTabItem("Two") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateInput("", 300, 207, 80, 20)
GUICtrlCreateInput("", 450, 207, 80, 20)
GUICtrlCreateInput("", 300, 237, 100, 20)
GUICtrlCreateInput("", 450, 237, 30, 20)
GUICtrlCreateInput("", 345, 270, 40, 20)
GUICtrlCreateCombo("1", 395, 270, 68, 20)
GUICtrlSetData(-1, "2|3", "1")
GUICtrlCreateButton("ok", 270, 305, 90, 25)
GUICtrlCreateButton("cancel", 400, 305, 90, 25)
GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)

While 1
    If GuiGetMsg()=-3 Then Exit
WEnd
Link to comment
Share on other sites

Like andy said you get the nag screen.Luckily a friend of mine had the full for me to play with.

You could try the window info tool. Maybe you can close the window as soon as it comes up.

Kenny

Looks cool on the screenshot but I don't understand how to use it, will I need the fullversion of SkinCrafter or is the demo enough? What's the difference between them?

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

hey it not working for me

help me

#include <SkinCrafter.au3>
_LoadSkinCrafter("SkinCrafterDll.dl");Load SkinCrafter DLL

;GUI With Initial Skin
$GUI_1 = GuiCreate("Test", -1, -1, 0, 0)
_InitializeSkinCrafter($GUI_1, "Zondar.skf")
GUICtrlCreateButton("Test", 50, 50, 50)
GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd

dll flie: SkinCrafterDll.dll

http://www.mediafire.com/download.php?nyynzgemymj

Link to comment
Share on other sites

Maybe here is the problem:

try replace

>> _LoadSkinCrafter("SkinCrafterDll.dl");Load SkinCrafter DLL

to

_LoadSkinCrafter("SkinCrafter.dll");Load SkinCrafter DLL

:P

* I cant run your ScinCrafter DLL he says that some file missing !!!

* We need other ScinCrafter DLL !!!

Edited by Enforcer
[RU] Zone
Link to comment
Share on other sites

i changed but it still not working

try replace

>> _LoadSkinCrafter("SkinCrafterDll.dl");Load SkinCrafter DLL

to

_LoadSkinCrafter("SkinCrafter.dll");Load SkinCrafter DLL

#include <SkinCrafter.au3>

_LoadSkinCrafter("SkinCrafterDll.dll");Load SkinCrafter DLL

;GUI With Initial Skin
$GUI_1 = GuiCreate("Test", -1, -1, 0, 0)

GUICtrlCreateButton("Test", 50, 50, 50)
_ApplySkin($GUI_1, "Zondar.skf")
_InitializeSkinCrafter($GUI_1, "Zondar.skf")
_ExcludeSkin($GUI_1)
GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd
Link to comment
Share on other sites

here ya go http://www.mediafire.com/?sharekey=0fddc05...2db6fb9a8902bda

I don't have any ideas on the tabs, I hardly ever use them so I hadn't noticed.

So far it has worked with everything thing else gui related for me.

However one thing that didn't work was msgbox's.

they work but the buttom of the window where the buttons are is just a white stripe.

i just used the _MsgBox function from the forum and problem solved.

Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

You just need to remove this line, that function is designed to specify a GUI you don't want the skin to apply to.

_ExcludeSkin($GUI_1)

You can also remove the _ApplySkin line. It's just needed when you load a second skin in the same script.

This is all you need for your script:

#include <SkinCrafter.au3>
_LoadSkinCrafter("SkinCrafterDll.dll");Load SkinCrafter DLL

$GUI_1 = GuiCreate("Test", -1, -1, 0, 0)
_InitializeSkinCrafter($GUI_1, "Zondar.skf")

GUICtrlCreateButton("Test", 50, 50, 50)
GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd

Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

i changed and it is working

i see very nice skin , i like it ,now my scrpit is working !!!!!!!!!!

thank

try replace

>> _LoadSkinCrafter("SkinCrafterDll.dl");Load SkinCrafter DLL

to

_LoadSkinCrafter("SkinCrafter.dll");Load SkinCrafter DLL

#include <SkinCrafter.au3>

_LoadSkinCrafter("SkinCrafterDll.dll");Load SkinCrafter DLL

;GUI With Initial Skin
$GUI_1 = GuiCreate("Test", -1, -1, 0, 0)
_InitializeSkinCrafter($GUI_1, "Zondar.skf")
GUICtrlCreateButton("Test", 50, 50, 50)



GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd
Edited by toxicvn
Link to comment
Share on other sites

this is my code but I do not see any difference

#include <SkinCrafter.au3>
_LoadSkinCrafter("SkinCrafterDll.dll");Load SkinCrafter DLL

$GUI_1 = GuiCreate("Test", -1, -1, -1,-1)
_InitializeSkinCrafter($GUI_1, "SkinasticST.skf")

GUICtrlCreateButton("Test", 50, 50, 50)
GUISetState()

While 1
   If GuiGetMsg()=-3 Then Exit
WEnd
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...