Jump to content

Getting an Object from a DLL


Recommended Posts

You need to go thru registration process.

#RequireAdmin

$sDll = "Au3Irr.dll" ; full path

$aCall = DllCall($sDll, "dword", "DllRegisterServer")

If @error Then
    MsgBox(48, "Error", "Failed to register!" & @CRLF & "Error number " & @error)
    Exit
EndIf

If $aCall[0] Then
    MsgBox(48, "Error", "DllRegisterServer failed with error code 0x" & Hex($aCall[0]))
    Exit
EndIf

MsgBox(64, "OK", "DllRegisterServer succeeded!")

$oObj = ObjCreate("CAu3Irr")

If IsObj($oObj) Then
    MsgBox(64, "OK", "Object successfully created!")
Else
    MsgBox(48, "Error", "Object not created!")
EndIf

Exit

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Unfortunately, I don't know exactly what to write...

I have implemented what I know for the script executing the registration...

Here is what I have

#RequireAdmin

RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}","","REG_SZ","Au3Irr 0.1")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\InprocServer32","","REG_SZ",@ScriptDir&"\Au3Irr.dll")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\VersionIndependentProgID","","REG_SZ","CAu3Irr")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\ProgID","","REG_SZ","CAu3Irr")

$sDll = "Au3Irr.dll" ; full path

$oObj = ObjCreate("CAu3Irr")

If IsObj($oObj) Then
    MsgBox(64, "OK", "Object successfully created!")
Else
    MsgBox(48, "Error", "Object not created!")
EndIf

RegDelete("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}")

Exit

Any Ideas on what is going wrong?

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

Unfortunately, I don't know exactly what to write...

I have implemented what I know for the script executing the registration...

Here is what I have

#RequireAdmin

RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}","","REG_SZ","Au3Irr 0.1")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\InprocServer32","","REG_SZ",@ScriptDir&"\Au3Irr.dll")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\VersionIndependentProgID","","REG_SZ","CAu3Irr")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\ProgID","","REG_SZ","CAu3Irr")

$sDll = "Au3Irr.dll" ; full path

$oObj = ObjCreate("CAu3Irr")

If IsObj($oObj) Then
    MsgBox(64, "OK", "Object successfully created!")
Else
    MsgBox(48, "Error", "Object not created!")
EndIf

RegDelete("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}")

Exit

Any Ideas on what is going wrong?

Yes. You miss one important registry key.

...I will edit.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Try this.

If it doesn't work then you likely did bad job with dll.

#RequireAdmin
;RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}","","REG_SZ","Au3Irr 0.1")
RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\InprocServer32", "", "REG_SZ", FileGetLongName(@ScriptDir) & "\Au3Irr.dll")
;RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\VersionIndependentProgID","","REG_SZ","CAu3Irr")
;RegWrite("HKEY_CLASSES_ROOT\CLSID\{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}\ProgID","","REG_SZ","CAu3Irr")
RegWrite("HKEY_CLASSES_ROOT\CAu3Irr\CLSID", "", "REG_SZ", "{F0BBA28D-6471-4b4e-B7EC-B3B1F082B47A}")


;$sDll = "Au3Irr.dll" ; full path

$oObj = ObjCreate("CAu3Irr")

If IsObj($oObj) Then
    MsgBox(64, "OK", "Object successfully created!")
Else
    MsgBox(48, "Error", "Object not created!")
EndIf

Exit

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I think I messed up with the DLL (its my first time writing a dll)

Once the dll is working, I can put in the functionality I need, but for now, I have the function CreateDevice to use as a test.

Here is my source and project file for the dll (still relatively small).

Can you take a look?

Edited by NerdFencer

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
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
 Share

  • Recently Browsing   0 members

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