[AHK_H]Creates a COM Object from a unregistered COM dll?

Ask for help, how to use AHK_H, etc.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

[AHK_H]Creates a COM Object from a unregistered COM dll?

04 May 2015, 08:27

http://hotkeyit.github.io/v2/docs/comma ... ObjDll.htm

I'm confused. Isn't ComObjDll designed for creating COM Object from a unregistered COM dll?

But below script prompt "0x8002801D - Library not registered" error message.

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

hModule := DllCall("LoadLibrary", "Str", "xd2txcom.dll")
obj := ComObjDll(hModule, "{4ECE8E8A-BCC2-4709-BCAE-264210DF321B}") ; Have tried "xd2txcom.Xdoc2txt.1" and "xd2txcom.Xdoc2txt" too.
fileText := obj.ExtractText("sample.doc", False)
MsgBox % fileText


vbs sample by the xd2txcom.dll author: (Of cause, this will need to register xd2txcom.dll first.)

Code: [Select all] [Download] (Untitled.txt)GeSHi © Codebox Plus

Set obj = CreateObject("xd2txcom.Xdoc2txt.1")

Dim fileText
fileText = obj.ExtractText("sample.doc",False)

MsgBox fileText

testing files: https://www.dropbox.com/s/samiybf94b3ef ... 9.7z?raw=1
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

04 May 2015, 16:03

When I try to register the dll I get the error:
The module "...\xd2txcom.dll" was loaded but the call to DllRegisterServer failed with error code 0x80070005.

ComObjDll works same as ComObjCreate but the dll does not need to be registered.
E.g. try using AutoHotkey.dll without registering.


Can you provide a working example in any other language using xd2txcom.dll?
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 00:58

ahh, you were right, this dll file is not working even when it has registered to system (using regsvr32 xd2txcom.dll). Sorry I didn't have a try.

I'll try other versions of this dll, to see if it works. The official website is http://ebstudio.info/home/xdoc2txt.html.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 01:07

Found a note in the README.txt, on 64bit OS the usage is:

Code: [Select all] [Download] GeSHi © Codebox Plus

C:\Windows\SysWOW64\cscript.exe comtest.vbs
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 01:17

Could you get it to run?
When I run, I get an error:
Microsoft VBScript runtime error: ActiveX component can't create object: 'xd2txcom.Xdoc2txt.1'
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 01:21

Yes, it works for me. But need to call by using C:\Windows\SysWOW64\cscript.exe comtest.vbs. double-click the vbs produce the same error as you get.
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 01:23

So it works on 64-bit only? Did you try 64-bit AutoHotkey?
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 01:29

Code: [Select all] [Download] GeSHi © Codebox Plus

obj := ComObjCreate("xd2txcom.Xdoc2txt.1")
fileText := obj.ExtractText("sample.doc",False)
MsgBox % fileText

My OS is win7 64bit, this code works in AutoHotkey A32 and U32, but not U64.
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 03:36

That is because the dll is 32-bit I think, but I am not sure.
lexikos
Posts: 5598
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 04:00

One DLL cannot be both 32-bit and 64-bit. Unless you've registered two separate DLLs, one in the 32-bit section of the registry and one in the 64-bit, it cannot work on both.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 09:45

@lexikos
After some registry modifies by following the steps from this article, it works in A32, U32 and U64. And still only one DLL.

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus



@HotKeyIt
Would you consider that as a bug to AHK_H? Since ComObjCreate works fine when the COM dll is registered. Or could you provide a way to make ComObjDll works? Thanks!
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 12:14

tmplinshi wrote:Would you consider that as a bug to AHK_H? Since ComObjCreate works fine when the COM dll is registered. Or could you provide a way to make ComObjDll works? Thanks!
Do you mean to load a 32-bit dll from 64-bit AutoHotkey using ComObjDll?
This is not possible as I understand. Probably you could load it using dllhost but I am not sure how.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 19:57

No, load a 32-bit dll from 32-bit AutoHotkey using ComObjDll, but should support x86 and x64 OS.
lexikos
Posts: 5598
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 20:18

tmplinshi wrote:@lexikos
After some registry modifies by following the steps from this article, it works in A32, U32 and U64. And still only one DLL.
I stand corrected. The key here is that the DLL is not loaded into the AutoHotkey process directly, but instead loaded into a DLL surrogate proccess.

However, that sort of technique couldn't possibly work with ComObjDll, since you have to load the DLL into the current process first.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

05 May 2015, 21:10

Thanks, lexikos. I don't know much about programming.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

07 May 2015, 20:47

HotKeyIt wrote:When I try to register the dll I get the error:
The module "...\xd2txcom.dll" was loaded but the call to DllRegisterServer failed with error code 0x80070005.


OK, I get this error too, on windows XP x86.

But then I've tried another dll XImage, the ComObjDll didn't work on x86 and x64 OS.

Code: [Select all] [Download] GeSHi © Codebox Plus

; https://www.dropbox.com/s/5ky068zs63364yx/XImage_test.7z?raw=1
hModule := DllCall("LoadLibrary", "Str", A_ScriptDir "\XImage.dll")
img := ComObjDll(hModule, "{DBE17C44-B996-4245-8031-5984FB09FE0F}")
img.Load(A_ScriptDir "\test.jpg")
MsgBox, % img.Width
HotKeyIt
Posts: 1577
Joined: 29 Sep 2013, 18:35
Contact:

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

08 May 2015, 07:07

Looking at the error this dll must be registered if I understand right.
It also requires admin privileges but not sure if this is relevant.
tmplinshi
Posts: 1094
Joined: 01 Oct 2013, 14:57

Re: [AHK_H]Creates a COM Object from a unregistered COM dll?

10 May 2015, 06:38

Thanks for your help, HotKeyIt. So far I only get ComObjDll working with AutoHotkey.dll. I'll find more COM dlls to test, maybe ComObjDll is only working for AutoHotkey.dll.

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 1 guest