Jump to content
Sign in to follow this  
ken82m

Is this VB.NET Example possible in AU3?

Recommended Posts

ken82m

I built a UDF for the SkinCrafter demo a while ago and it worked. I used the VB (non .NET dll)

They just released a light version which is free to use and distribute and I'm trying to figure out if it can work with AutoIT.

There's really no sample code to post but the download includes screenshots in the help file and a sample VS project.

http://www.skincrafter.com/products/skincrafter-lite

Thanks,

Kenny

EDIT: Here's some sample code from the .NET Retail version

Imports DMSoft
    ...
    Public SkinOb As DMSoft.SkinCrafter
        
    ' The code in CODE SECTION has to be called before InitializeComponent() function
    ' --------- Begin of CODE SECTION ---------- '  
    DMSoft.SkinCrafter.Init()
    SkinOb = New DMSoft.SkinCrafter
    'These function parameters are used for Skincrafter DEMO
    SkinOb.InitLicenKeys("SKINCRAFTER", "SKINCRAFTER.COM", "support@skincrafter.com", "DEMOSKINCRAFTERLICENCE")
    SkinOb.InitDecoration(1)
    ' --------- End of CODE SECTION ---------- '    
    
    SkinOb.LoadSkinFromFile("C:\\Program Files\\SkinCrafter.Net\\Skins\\Amazonite.skf")
    SkinOb.ApplySkin()

Here's the existing UDF for the retail version:

#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()

                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    Applies additionaly loaded skin to window
                Skin must already be loaded by _LoadSkin

 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 Invalid

 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
Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites
Richard Robertson

You can't load .Net objects like that. AutoIt does not currently support that.

The only ones you can load are .Net objects that are registered through COM. I used Skincrafter and I don't believe it had a COM interface for it in the .Net assembly.

Share this post


Link to post
Share on other sites
ken82m

oh well, that answers that :)

I appreciate the answer. Thanks Rich -Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.