Jump to content

Recommended Posts

Posted (edited)

@argumentum

Try this one :

But change the path of the Manifest location in the script

If it works I will adjust to initial post with the correct settings and setup definitions

ps : Script removed see updated version here 

https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472602

Edited by ptrex
Posted
  On 1/10/2021 at 9:11 PM, ptrex said:

So it runs if you use regsvr32 dynwrap.dll

Expand  
RegSvr32
---------------------------
The module "dynwrap.dll" was loaded but the call to DllRegisterServer failed with error code 0x80004005.
For more information about this problem, search online using the error code as a search term.

 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

I am sure are doing something wrong,

Keep in mind that this is a 32bit com ONLY object.

So you just can't just run regsvr32. You need to run it from the SysWOW64 folder.

The same for running the Vbsript.

 

Final files and instructions for testing are updated here ;

https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472602

 

Edited by ptrex
Posted (edited)

This is the Regfree version in AutoIt

Calling Win API's from the COM object using AutoIt

This is of course 1 bridge too far because we can call Win API from within AutoIt natively...

#AutoIt3Wrapper_UseX64=N

; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

Local $oActCtx = ObjCreate("Microsoft.Windows.ActCtx")
$oActCtx.manifest = @ScriptDir & "\dynwrap.sxs.manifest"

ConsoleWrite(@ScriptDir &  "\dynwrap.dll" & @CRLF)

$UserWrap = $oActCtx.CreateObject("DynamicWrapper")

; Call MessageBoxA(), first register the API function
$UserWrap.Register ("USER32.DLL", "MessageBoxA", "I=HsSu", "f=s", "R=l")
; now call the function

Local $oVBS = ObjCreate("ScriptControl")
$oVBS.language = "VBScript"
Global Const $Nothing = $oVBS.eval("Null")
$oVBS = $Nothing

$UserWrap.MessageBoxA ($oVBS, "MessageBox (ANSI)", "From DynaWrap Object", 3)


Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)   ; to check for after this function returns
Endfunc

Keep this only for test and demonstration purposes. 😉

 

 

Edited by ptrex
Posted
  On 1/11/2021 at 4:28 PM, ptrex said:

This means as of now everyone can start doing DLLCall's from VBScripts in a Portable way ! 😄

Expand  

Please provide example.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

@Professor_Bernd  / @argumentum  

Here I posted some examples and documentation on how to use the DynaWrap object to do DLLCalls 

https://www.autoitscript.com/forum/topic/204903-dllcalls-using-vbscripts-possible/

 

Enjoy !

  • 2 years later...
Posted

 

Thought one more try using "Microsoft.Windows.ActCtx" to check if this realy work.
Copy all the three file in C:\Temp folder as @ptrex mention 
- AutoItX3_x64.dll
- AutoItX3.sxs.manifest
- Test.vbs
but it not work giving @error: Library not registered

@ptrex does this really worked for you using AutoItX3_x64.dll ?
It's quite strange why you not got this Error: Library not registered on computer where Autoit never installed :huh2:

Posted

@jugador 

Just tested this script and all runs fine on my PC windows 10

 

#AutoIt3Wrapper_UseX64=Y

; Error Monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
  ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
  Exit
EndFunc    ;==>_ErrFunc

Local $oAutoIt = ObjCreate("Microsoft.Windows.ActCtx")
$oAutoIt.manifest = @ScriptDir&"\AutoItX3.sxs.manifest"

Local $obj = $oAutoIt.CreateObject("AutoItX3.Control")

MsgBox(0, "", "You are now running RegFree AutoItX3.Control Version : " & $obj.Version)

ConsoleWrite($obj.Version & @CRLF)

ConsoleWrite("Are you admin : " & $obj.IsAdmin & @CRLF)

$obj.ToolTip("This is a tooltip", 450, 200)
$obj.Sleep(3000)

$obj = ""
$oAutoIt = ""

 

Posted

@ptrex 
I try again on window7 with this modified manifest file where Autoit is not installed using vbscript.
It's still not working getting error: Library not registered :huh2:

Procedure:
1) Create C:\Temp folder
2) Copy all 3 file
 > AutoItX3.dll
 > AutoItX3.sxs.manifest
 > Test.vbs

AutoItX3.sxs.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity type="win32" name="AutoItX3.sxs" version="1.0.0.0" />
    <file name="AutoItX3.dll">
        <typelib tlbid="{F8937E53-D444-4E71-9275-35B64210CC3B}" resourceid="0" version="1.0" helpdir="" flags="HASDISKIMAGE" />    
        <comClass clsid="{1A671297-FA74-4422-80FA-6C5D8CE4DE04}" threadingModel="Apartment" tlbid="{F8937E53-D444-4E71-9275-35B64210CC3B}" progid="AutoItX3.Control" description="AutoItX3 Class" />        
    </file>
</assembly>

Test.vbs

ExampleA()
Function ExampleA()
    Dim o
    Set o = CreateObject("Microsoft.Windows.ActCtx")
    o.manifest = "C:\Temp\AutoItX3.sxs.manifest"

    Dim obj
    Set obj = o.CreateObject("AutoItX3.Control")
    Msgbox "You are now running AutoItX3.Control Version : " + obj.Version

    Set obj = Nothing
    Set o = Nothing
End Function


I will later compiled your au3 file and test on computer where Autoit not installed.
I think it will also not work.

Posted (edited)

@ptrex

same error: Library not registered

WshManifest.PNG.1241e6ffdfa43e54f91a5d0d7b7fb956.PNG

@ptrex  I think you will get same error if you run your above code on fresh installation.
where you haven't load Autoit before.

Edited by jugador
Posted

Indeed you are correct it does not run on a machine that has no AutoIT installed.

According to me this has nothing to do with running regfree COM objects ... but rather how the AutoIT developers created the COM dependencies

 I give you this other example I tested succesfully.

The issue with COM objects is as well that you need take in account the bit factor !

I know that the dynwrap is a 32 bit COM object.

so if you would run the vbscript as is you would get this error.

image.png.1cd4147c11d89e7e05f443b88d449016.png

While if you run it as a 32bit vbscript using cscript, all runs well

image.png.ba4337da85bdbfc70c8861a5b86adcf5.png

 

 

 

Dynwrap.zipFetching info...

Posted (edited)

One more thing to conclude on this subject.
Microsoft.Windows.ActCtx method not work for me.
but now I have both the code to work with internal and external manifest :D :bye:

Edited by jugador

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
  • Recently Browsing   0 members

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