Matrix112 Posted March 22, 2013 Share Posted March 22, 2013 Hi, for some of my Scripts i need a function to change some file properties. I have downloaded a .dll file from Microsoft with the function i need. Now my problem: It is a COM function. How can i call it without the need, to register the dll? Is it possible? I tried to translate some VB code (only working with registered DLL): Set oFile = CreateObject("DSOFile.OleDocumentProperties") oFile.Open("c:\tmp\test.txt") oFile.SummaryProperties.Comments = "Test Comment" oFile.Save oFile.Close Now my Script: $dll = DllOpen("dsofile.dll") $oFile = ObjCreate("DSOFile.OleDocumentProperties") If Not @error Then MsgBox(4096, "ObjCreate Test", "ObjCreate() of a DSO File Object successful !") Else MsgBox(4096, "ObjCreate Test", "Failed to create Object. Error code: " & Hex(@error, 8)) EndIf DllClose($dll) Exit If i run the script above, i get the error code: 800401F3 This semms to be "Object not found" or something similar. Maybe i can call the function out of the DLL with dllcall, but how? I used DLL Export Viewer to get the following information (not all functions in this dll file): Function names: _OleDocumentProperties::Close _OleDocumentProperties::CLSID _OleDocumentProperties::IsOleFile _OleDocumentProperties::Open _OleDocumentProperties::Save CustomProperties::Add CustomProperty::Remove SummaryProperties::Comments I´m not very familiar with dllcall and com objects, so maybe someone knows how to do it? Link to comment Share on other sites More sharing options...
Danp2 Posted March 22, 2013 Share Posted March 22, 2013 AFAIK, you can't create a COM object without first registering the associated DLL. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
trancexx Posted March 22, 2013 Share Posted March 22, 2013 (edited) There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything. It would be something like this: ; Object identifiers Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}" Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}" $sDll = "dsofile.dll" ; location and name of your dll $hDll = DllOpen($sDll) ; open it ; Experimenal feature. Try with newer versions of AutoIt $oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll) ; Check for errors and work with object ;... Edited March 22, 2013 by trancexx minxomat, mLipok and moimon 3 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Matrix112 Posted March 22, 2013 Author Share Posted March 22, 2013 There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything. It would be something like this: ; Object identifiers Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}" Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}" $sDll = "dsofile.dll" ; location and name of your dll $hDll = DllOpen($sDll) ; open it ; Experimenal feature. Try with newer versions of AutoIt $oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll) ; Check for errors and work with object ;... That works, thank you Link to comment Share on other sites More sharing options...
moimon Posted February 9, 2020 Share Posted February 9, 2020 On 3/23/2013 at 2:43 AM, trancexx said: There is experimental feature available in some latest versions of AutoIt that allows you to create COM objects from modules without any demand on user to register anything. It would be something like this: ; Object identifiers Global Const $sCLSID_OleDocumentProperties = "{58968145-CF05-4341-995F-2EE093F6ABA3}" Global Const $IID_OleDocumentProperties = "{58968145-CF01-4341-995F-2EE093F6ABA3}" $sDll = "dsofile.dll" ; location and name of your dll $hDll = DllOpen($sDll) ; open it ; Experimenal feature. Try with newer versions of AutoIt $oObj = ObjCreate($sCLSID_OleDocumentProperties, $IID_OleDocumentProperties, $hDll) ; Check for errors and work with object ;... @trancexx I tried it with your Subrogation function instead of using DllOpen function but failed. https://www.autoitscript.com/forum/topic/108969-subrogation/ Can you improve it or is there any other way to create a COM object using an hActiveX from memory ? Thanks for the help ♥️ Link to comment Share on other sites More sharing options...
TheAutomator Posted February 11, 2020 Share Posted February 11, 2020 If you can't find an alternative you can also use software like Enigma Virtual Box or Boxed App with your compiled exe, that way you can virtualize any types of files, dynamic libraries (*.dll), ActiveX/COM objects (*.dll, *.ocx), video and music files (*.avi, *.mp3), text files (*.txt, *.doc), etc. Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone Link to comment Share on other sites More sharing options...
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