0

This is a very strange issue for me.

I downloaded a COM samples directly from Microsoft "All-In-One Code Framework" series in two versions: EXE (out-of-process COM) and DLL (in-process).

I used the C++ samples. I am able to compile both. Both are registered as well.

I am able to use the EXE object via a VBScript client. However, I change the client to use the DLL one, and I get the following error:

ActiveX Component Cannot Create Object

My system is Windows 7 64-bit. The COM components are 32-bit, however for the EXE component the client works with both 32-bit and 64-bit Script Hosts, while the DLL component works with neither of them.

How can I script the DLL one as well?

Community
  • 1
  • 1
user3707763
  • 91
  • 1
  • 8
  • Does the in-process DLL support late-binding (the IDispatch interface)? – Bond Sep 09 '14 at 19:44
  • @Bond Yes, both objects inherit IDispatch, which is implemented by ATL. They are exactly the same, except for the EXE or DLL part. – user3707763 Sep 09 '14 at 19:45
  • Since you mentioned it's a 32-bit component, do you know if it's being registered with the 32-bit version of REGSVR32? That is, the one found in SysWOW64. – Bond Sep 09 '14 at 19:48
  • Pay more attention to build warnings. The DLL project cannot normally register itself unless you run Visual Studio elevated so it can write to the registry. Right-click the VS shortcut and select "Run as Administrator". – Hans Passant Sep 09 '14 at 19:54
  • @Bond registration is fine. I can find Both GUIDs in the system registry. – user3707763 Sep 09 '14 at 19:57
  • Then use SysInternals' Process Monitor. You'll see the script interpreter searching the registry for the key. – Hans Passant Sep 09 '14 at 19:58
  • @HansPassant I have done that specifically but the issue still remains. – user3707763 Sep 09 '14 at 19:58
  • Can you create a late-bound instance of the component via another language? In other words, is your problem specific to VBScript or specific to the component? – Bond Sep 09 '14 at 20:01
  • @Bond I have tried with VBA but that doesn't really count as another language. This is not language specific, the Microsoft sample provides a VBS client in both versions. The EXE one works, the other doesn't, where both of them use late binding. – user3707763 Sep 09 '14 at 20:04
  • So it doesn't work in VBA? Can you add a reference to the component's type library in VBA and instantiate it with early binding? – Bond Sep 09 '14 at 20:06
  • @Bond yes it works with early binding in VBA, but that's not what I am after. – user3707763 Sep 09 '14 at 20:12
  • I understand that's not what you're after. But that's helpful info. So it works with early binding in VBA but not late binding in VBA? – Bond Sep 09 '14 at 20:13
  • @Bond Yes. Now I am curious, how is this info helpful? – user3707763 Sep 09 '14 at 20:17
  • Because it's starting to sound like an IDispatch issue again. It looks like you've had trouble with late-binding [before](http://stackoverflow.com/questions/24633409/com-interface-created-by-atl-inherits-idispatch-but-late-binding-does-not-work). Did you ever find out what your issue was there? Or [here](http://stackoverflow.com/questions/24143406/registered-com-dll-works-in-vba-but-not-in-vbscript)? – Bond Sep 09 '14 at 20:23
  • @Bond No this is a follow up on that issue. I think the problem is with ATL templates for in-process component. The only solution I can think of is implementing IDispatch without ATL which I have no idea how to and it is for sure very time consuming. I have paid top money to have ATL included with my VS2012 and it frustrates me that I can't use it. – user3707763 Sep 09 '14 at 20:38
  • @HansPassant Where should I look in the SysInternals' software? I have filtered the Registry events and I am now running my script but I am not sure where to go from that. – user3707763 Sep 09 '14 at 20:41
  • When you search for the ProgID of your component in the registry, do you find an entry under HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{}\ProgID? – Bond Sep 09 '14 at 20:46
  • @Bond Yes, indeed. As I said, this is not a registration issue. – user3707763 Sep 09 '14 at 20:50
  • It looks like it has nothing to do with dispatch anyways.. i.e. the error says "can't create object". That can only mean, that the object is not properly registered. Does the following snippet work for example? Set x = CreateObject("") – Nikolay Sep 11 '14 at 22:39
  • One more thing - in-process component "bitness" should match the host "bitness". That is, you can't use 32-bit in-process component in 64-bit program, and you can't use 64-bit in-process component in 32-bit program directly. – Nikolay Sep 11 '14 at 22:45

0 Answers0