NerdFencer Posted January 5, 2010 Posted January 5, 2010 I am attempting to get a handle from an object defined in a dll. I cannot find any information on how to do this... I have tried ObjGet("Au3Irr.dll","CAu3Irr") DllCall("Au3Irr.dll","none","CAu3Irr") ; in hopes of calling the constructor Does anybody know? _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
trancexx Posted January 5, 2010 Posted January 5, 2010 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
NerdFencer Posted January 5, 2010 Author Posted January 5, 2010 Thanks trancexx Unfortunately, I am also writing the DLL, so I am now researching how to implement DllRegisterServer and DllUnregisterServer... _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
trancexx Posted January 5, 2010 Posted January 5, 2010 That's probably the easiest thing to do. It's all about writing couple of registry keys (and deleting obviously). ♡♡♡ . eMyvnE
NerdFencer Posted January 5, 2010 Author Posted January 5, 2010 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
trancexx Posted January 5, 2010 Posted January 5, 2010 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
NerdFencer Posted January 5, 2010 Author Posted January 5, 2010 Yes. You miss one important registry key....I will edit.Thanks! _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
trancexx Posted January 5, 2010 Posted January 5, 2010 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
NerdFencer Posted January 5, 2010 Author Posted January 5, 2010 (edited) 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 January 5, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now