Microsoft.Windows.ActCtx on Windows Xp

2019-02-11 01:48发布

问题:

These days I'm very much busy on developing an activex/com application. Some of our customers are working under heavily restricted windows environments. So i decided to make my application regfree. I found genman32.exe which can easily create manifests (also mt.exe is useful). Everything went fine but when i tried to execute my application from wsh(vbs or js) -which is obligated for my the situation because the application works on a com server-

set o = CreateObject("Application.Interface") 

// No object reference 

Because "CreateObject" looks to the registery and there is no registery entry :) then i searched and found the thing that is "actctx". It is very easy to implement in a dot.net environment. But i must execute my application from wsh(vbs or js) ;) so i decided to search a little then found

set o = CreateObject("Microsoft.Windows.ActCtx")
o.manifest = "L:\\Application.dll.manifest"
set app = o.CreateObject("Application.Interface")
app.Launch() // which is my executing function

Problem - "Microsoft.Windows.ActCtx" interface is not available in Windows Xp machines even in SP3 - Microsoft never lets it easy - Is there any solution to that problem? Do You know any other methods or windows update that creates that interface?

回答1:

I figured out the problem with my manifest. I'll share it with anyone else who may have run into a similiar problem.

Please be aware that you MUST specify the progid="" property in your manifest when using this with the "Microsoft.Windows.ActCtx" interface otherwise you get ActiveX Component Can't Create Object error.

<comClass
clsid="{ED59F192-EF2E-4BCC-95EB-85A8C5C65326}"
progid="myclass.process"
threadingModel = "Apartment" />

The following manifest example should get you up and running :)

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
  manifestVersion="1.0">

<assemblyIdentity
   type="win32"
   name="myclass"
   version="1.0.0.0"/>

<file name = "myclass.dll">

<comClass
    clsid="{ED59F192-EF2E-4BCC-95EB-85A8C5C65326}"
    progid="myclass.process"
    threadingModel = "Apartment" />

<typelib tlbid="{7AE20C3A-48C2-42C1-A68D-A1C3EB0A2C65}"
       version="1.0" helpdir=""/>

</file>

<comInterfaceExternalProxyStub 
    name="_PROCESS" 
    iid="{187D0811-470D-44C0-B68C-C1C7F3EEFDA0}"
    proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
    baseInterface="{00000000-0000-0000-C000-000000000046}"
    tlbid = "{7AE20C3A-48C2-42C1-A68D-A1C3EB0A2C65}" />

</assembly>


回答2:

If the Microsoft.Windows.ActCtx were redistributable, there would have to be some way for it to get onto the machine and globally registered. If you had access to register this on the machine, can't you insted simply register Application.Interface? If you're dealing with a restricted environment ... well you have to deal with what's available already.

It looks like you're using the wsh script to launch your application. Why not write a stub to launch the app in native or managed code (where you will be able to use a manifest), and call that stub instead?