Sign in to follow this  
Followers 0
senatin

Source Code of dll covert to autoit

1 post in this topic

#1 ·  Posted (edited)

I found this tutorial script about dll but is written in other code
I want to know what it return or throw when it fails.
Im starting to learn calldll and its other related code.
Can you please help me convert this code to autoit

class MSC_Helper {
static _ := MSC_Helper.InitClass()

InitClass() {
    if !A_IsAdmin {
        Run *RunAs "%A_ScriptFullPath%"  
        ExitApp
    }
    this.LoadDll()
}

LoadDll() {
    if A_Is64bitOS {
        dllFile := (A_PtrSize=8) ? "64\mscon64.64.dll" : "64\mscon32.32.dll"
    } else {
        dllFile := "32\mscon32.dll"
    }

    if !this.hModule := DllCall("LoadLibrary", "Str", dllFile, "Ptr") {
        if !FileExist(dllFile) {
            throw, dllFile " not found."
        }
        throw, "LoadLibrary failed. DllFile is " dllFile
    }
    this.dllFile := dllFile
}

UnloadDll() {
    DllCall("FreeLibrary", "Ptr", this.hModule)
}

}

Thank you in advance.

Edited by senatin

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