Sign in to follow this  
Followers 0
=sinister=

Some weird dll error

22 posts in this topic

well i'm using the skincrafter dll (www.skincrafter.com) to skin a GUI and it used to work well a few months back but when I tried it again, I get a stack corruption error. How do I fix this? I'm using the default demo calls:

$Dll = DllOpen("./Dll/Skin.dll")
DllCall($dll, "int", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($Dll, "int", "DefineLanguage", "int", 0)
DllCall($Dll, "int", "InitDecoration", "int", 1)
DllCall($Dll, "int", "LoadSkinFromFile", "int", ("./Skins/Mac-style.sfk"))
DllCall($Dll, "int", "ApplySkin")

Func BSTR($str)
    $len = StringLen($str)
    $buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
    DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
    Return $buff[0]
EndFunc

Share this post


Link to post
Share on other sites



well i'm using the skincrafter dll (www.skincrafter.com) to skin a GUI and it used to work well a few months back but when I tried it again, I get a stack corruption error. How do I fix this? I'm using the default demo calls:

$Dll = DllOpen("./Dll/Skin.dll")
DllCall($dll, "int", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($Dll, "int", "DefineLanguage", "int", 0)
DllCall($Dll, "int", "InitDecoration", "int", 1)
DllCall($Dll, "int", "LoadSkinFromFile", "int", ("./Skins/Mac-style.sfk"))
DllCall($Dll, "int", "ApplySkin")

Func BSTR($str)
    $len = StringLen($str)
    $buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
    DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
    Return $buff[0]
EndFunc
If the AutoIt version you used which worked was before 3.2.0 then you might need to use "int:cdecl" as the return type.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

For everything?

like this:?

$Dll = DllOpen("./Skin.dll")
DllCall($dll, "int:cdecl", "InitLicenKeys", "int:cdecl", BSTR("0"), "int:cdecl", BSTR("SKINCRAFTER"), "int:cdecl", BSTR("SKINCRAFTER.COM"), "int:cdecl", BSTR("support@skincrafter.com"),"int:cdecl", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($Dll, "int:cdecl", "DefineLanguage", "int:cdecl", 0)
DllCall($Dll, "int:cdecl", "InitDecoration", "int:cdecl", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "int:cdecl", ("./Skin.skf"))
DllCall($Dll, "int:cdecl", "ApplySkin")

Func BSTR($str)
    $len = StringLen($str)
    $buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
    DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
    Return $buff[0]
EndFunc

Share this post


Link to post
Share on other sites

hrm, it still won't work. This time it doesn't apply the skin it just does nothing. Any ideas?

Share this post


Link to post
Share on other sites

Hrm, can anyone figure this out? I don't want to have to install a earlier version of AutoIt.

Share this post


Link to post
Share on other sites

no not everywhere :)

Only on return value data type.

and i doubt that that ever worked:

DllCall($Dll, "int", "LoadSkinFromFile", "int", ("./Skins/Mac-style.sfk"))

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Hrm, well I tested it. I put :cdecl to every return value that got an error. So it turned out like:

$Dll = DllOpen("./Skin.dll")
DllCall($dll, "int:cdecl", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($Dll, "int:cdecl", "DefineLanguage", "int", 0)
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "int", ("./Skin.skf"))
DllCall($Dll, "int", "ApplySkin")

Well, I get the 2 popups saying it's a demo, but it doesn't actually skin the GUI.

Heres the entire code:

$Dll = DllOpen("./Skin.dll")
DllCall($dll, "int:cdecl", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
DllCall($Dll, "int:cdecl", "DefineLanguage", "int", 0)
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "int", ("./Skin.skf"))
DllCall($Dll, "int", "ApplySkin")
If @Error = 1 Then MsgBox(0, "test", "error 1")
If @Error = 2 Then MsgBox(0, "test", "error 2")
If @Error = 3 Then MsgBox(0, "test", "error 3")

Func BSTR($str)
    $len = StringLen($str)
$buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
    DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
    Return $buff[0]
EndFunc

; example 1
#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Share this post


Link to post
Share on other sites

It would be easier if you post the function declarations and the relevant defines from the headers...

btw. BSTR() is leaking, memory is never freed.


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Ok so how would I fix it?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I was having the same trouble with SkinCrafter like 2 months ago, never found a solution. Using an earlier version of autoit will probably make it work, however, switching back to a different version is a pain.

PM me if you find a solution :)

Thanks,

Kurt

EDIT: Ooo, 666 posts.. spooky

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

in VB:

Private SkinOb As New SKINCRAFTERLib.SCSkin2

' The code in CODE SECTION has to be called in Form_Initialize() function

' --------- Begin of CODE SECTION ---------- '

SkinOb.InitLicenKeys("SKINCRAFTER","SKINCRAFTER.COM",
"support@skincrafter.com","DEMOSKINCRAFTERLICENCE")
SkinOb.DefineLanguage 2
SkinOb.InitDecoration 1

' --------- End of CODE SECTION ---------- '

SkinOb.LoadSkinFromFile "D:\\Skin.skf"
SkinOb.ApplySkin

However, I'm positive that BSTR() is needed, without using it, it simply does not work.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Yeah BSTR() is needed. Picaso, I can't find the "headers" for the dll. Looking around the skincrafter forums for some help, but not getting any. I don't understand. the 1.x version worked perfectly with an older version of Autoit (Not sure about 2.x). Why did they change the way the dll call worked?

Share this post


Link to post
Share on other sites

really ? :)

$Dll = DllOpen("SkinCrafterDll.dll")
DllCall($dll, "int:cdecl", "InitLicenKeys", "wstr","SKINCRAFTER","wstr","SKINCRAFTER.COM", "wstr", "support@skincrafter.com","wstr","DEMOSKINCRAFTERLICENCE")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", "Vista-style_ST.skf")
DllCall($Dll, "int:cdecl", "ApplySkin")

GUICreate("Some window")
GUISetState()

While 1
   Sleep(100)
WEnd

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

DUDE! DO YOU KNOW WHAT YOU JUST DID!!!!!!!!!!!! YOU JUST MADE HISTORY MAN!!! Omfg I can't believe you got the 2.x skincrafter to work with the CURRENT autoit!! I LOVE YOU MAN!!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Yeah, but it doesn't seem to work with the 1.x, and the 1.x is better because there is no annoying SkinCrafter advert. for buying a license.. the 1.x didn't do that.

Anyway to get the 1.x working?

EDIT: Also, using the 2.x the title of the window is always: "SkinCrafter Demo test" whereas in the 1.x you can choose the title (demo or not) and no advert. Any ideas?

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

try this:

; SkinCrafter code for AutoIt
; put this before gui
 $dll = DllOpen("Skin.dll")
 DllCall($dll, "int:cdecl", "InitLicenKeys", "int", BSTR("0"), "int", BSTR("SKINCRAFTER"), "int", BSTR("SKINCRAFTER.COM"), "int", BSTR("support@skincrafter.com"),"int", BSTR("DEMOSKINCRAFTERLICENCE"))
 DllCall($dll, "int:cdecl", "DefineLanguage", "int", 0)
 DllCall($dll, "int:cdecl", "InitDecoration", "int", 1)
 DllCall($dll, "int:cdecl", "LoadSkinFromFile", "int", BSTR("Skin.skf"));skin file
 DllCall($dll, "int", "ApplySkin")
; Put this function anywhere
 Func BSTR($str)
 $len = StringLen($str)
 $buff = DllCall("oleaut32.dll", "int", "SysAllocStringLen", "int", 0, "int", $len)
 DllCall("kernel32.dll", "int", "MultiByteToWideChar", "int", 0, "int", 0, "str", $str, "int", $len, "ptr", $buff[0], "int", $len)
 Return $buff[0]
 EndFunc

For the 1.x version.

Also, it seems that for both versions, the background is the default autoit background. Don't know how to fix it :\

Share this post


Link to post
Share on other sites

1.x is not available on the website any more...

Can you post it? (or upload it to thrashbin - see sig. - if its too large)

Just in case you dont know: Valuater's XSkin is free :)


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

However XSkin requires several image files, and yes I have the 1.x, I can send it to you once I get back to my home computer. They don't have the 1.x versions because they do not want to allow free Skins for programmers, they want our money for licenses instead :)

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

OOOH Man!!! Thanks so much for sharing Sinister!!!

God, I have been playing around with that stuff for a long time. I really appreciate it, bud.

Thanks again,

Kurt


Awaiting Diablo III..

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  
Followers 0