com

What's the correct way to use win32inet.WinHttpGetProxyForUrl

浪尽此生 提交于 2019-12-04 11:46:07
I'm trying to use a feature of the Microsoft WinHttp library that has been exposed by the developers of Win32com. Unfortunately most of the library does not seem to be documented and there are no example of the correct way to use the win32inet features via the win32com library. This is what I have so far: import win32inet hinternet = win32inet.InternetOpen("foo 1.0", 0, "", "", 0) # Does not work!!! proxy = win32inet.WinHttpGetProxyForUrl( hinternet, u"http://www.foo.com", 0 ) As you can see, all I am trying to do is use the win32inet feature to find out which proxy is the appropriate one to

QueryInterface fails with E_ACCESSDENIED

末鹿安然 提交于 2019-12-04 11:45:46
The following method is a DCOM server method. The COM client and server is running in different WinXP machines. The COM client calls RegisterClient method to register callback interface. The problem is QueryInterface method fails with error code E_ACCESSDENIED . What could be the reason for the issue? STDMETHODIMP CGEMExtension::RegisterClient(IUnknown** ppGEMExtensionEvents, int* nClientId, int* nResult) { HRESULT hRes = (*ppGEMExtensionEvents)->QueryInterface(IID_IGEMExtension,(void**)&pUnknown); return hRes; } When you get an E_ACCESSDENIED, it means you have a permissions problem (don't

How to register COM libraries at runtime?

拥有回忆 提交于 2019-12-04 11:36:57
Let's say I'm developing an application that installs COM component and installer registers them. This works great. Now the software is required to run from a memory stick. How can I register my libraries runtime and make sure, that the registry is cleaned up after running the application? Are you always running on XP or later? Don't bother. Use "registration free COM". Essentially what you do is create a manifest file for the COM component so the Windows loader know what its registration is without having to put that in the registry. A walkthrough of what to do is in this article on MSDN:

From C#, open an arbitrary application

情到浓时终转凉″ 提交于 2019-12-04 11:30:53
Related question [stackoverflow] here . I'm trying to do the above, but I want to take the process one step further. I want to open an arbitrary file using the default editor for the file type. From that point, I want to allow my user to interact with the file as they would normally, or continue to work in my application. The extension is what happens after the user finishes editing. Is there a way I can capture a close (and ideally save) event from the external application and use that as a trigger to do something else? For my purposes, tracking the closing of the external application would

Delphi Spring DI: Is it possible to delegate interface instantiation without an implementing type?

岁酱吖の 提交于 2019-12-04 11:27:03
问题 I'm just getting started with the Delphi Spring Framework and was wondering whether the current version of the DI container somehow allows delegating the construction to a factory method without specifying an implementing type? E.g. something similar to this: GlobalContainer .RegisterFactory<ISomeObject>( function: ISomeObject begin Result := CreateComObject(CLASS_SomeObject) as ISomeObject; end) .Implements<ISomeObject> // could probably be implied from the above .AsSingletonPerThread; As

Building a byte array in PHP with variants?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 11:18:37
I am trying to build a byte array in PHP using Variants . However, I can't seem to make it work. Here's a sample code: $ie = new COM("InternetExplorer.Application"); $ie->Visible = true; $ie->Height = 500 ; $ie->Width = 700 ; $post = array (ord('p'),ord('='),ord('1')) ; $v = new VARIANT($post, VT_ARRAY|VT_UI1); $ie->Navigate2("http://host/web/echo_request.php",0,'',$v) ; The code produces an error: Fatal error: Uncaught exception 'com_exception' with message 'Variant type conversion failed: Type mismatch.type conversion failed: Type mismatch. I have tried with all sorts of combinations for the

Expose dll for COM Interop

佐手、 提交于 2019-12-04 11:09:48
问题 I thought I knew how to do this, but obviously not so I'd appreciate some help! I can't get my dll to register so I can instantiate it in a VBS, or elsewhere. I wrote the following sample class, checked "Make assembly COM Visible", checked "Register for COM Interop", then built it. When I try to instantiate it from VBS I get the "Activex component can't create object" error. This is the class code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace

com4j versus jacob to call COM methods from Java

旧巷老猫 提交于 2019-12-04 11:05:53
问题 I maintain a legacy Java application that uses Jacob, or Java-COM Bridge, to make calls via the COM interfaces of MS VBA and MS Word. I have been looking at com4j from Sun, and it looks promising. The reason it looks good to me is that it uses vtable binding to methods, instead of IDispatch. Assuming all the COM objects we manipulate present vtable interfaces, it seems cleaner to use them instead of IDispatch. Back in the days when COM and CORBA where the hot binary interface technologies, I

Dynamically load and use COM object in C#

风流意气都作罢 提交于 2019-12-04 11:05:43
I have a C# project, where I would like to access MS outlook, if it is installed on a client´s machine. The "access outlook" part has been done by referencing the outlook COM object, and going from there. My problem is now the "if it is installed" part. At the moment, my project doesn´t compile on machines without outlook installed, so I assume that I will have to not reference the outlook component, and instead load and use it dynamically, after detecting that outlook is present, but I haven´t found a way to do this. Am I correct, and does anybody have any hints on how to do this? Thanks.

Best method of calling managed code(c#) from unmanaged C++

佐手、 提交于 2019-12-04 11:01:21
We have developed a s/w architecture consisting of set of objects developed in C#. They make extensive use of events to notify the client of changes in status, etc. The intention originally was to allow legacy code to use these managed objects through COM interop services. That was easy to write in the design specification but, I'm seeing that actually implementing it is more problematic. I've searched for many hours looking for a good sample of event handling using this method. Before we march down that path, I want to make sure that COM interop is the best way to allow legacy code to call