com

How to cast a control to IOleObject

被刻印的时光 ゝ 提交于 2019-12-06 14:15:51
I want to invoke GetClientSite on a .net control. For this purpose I am trying to cast a control (in example Windows.Forms.Form) to IOleObject which returns null. What should I do to get IOleObject? using System; using System.Runtime.InteropServices; using System.Security; using System.Windows.Forms; namespace Test001 { public class Form001 : Form { public Form001() { InitializeComponent(); } private void InitializeComponent() { this.SuspendLayout(); this.Name = "Form001"; this.Text = "Form001"; this.Load += new System.EventHandler(this.Form001_Load); this.ResumeLayout(false); } private void

Handle HTMLElementEvents2 when DWebBrowserEvents2 has been handled using ATL's macros

人走茶凉 提交于 2019-12-06 14:15:49
问题 I'm creating a Browser Helper Object using VS2008, C++. My class has been derived from IDispEventImpl among many others class ATL_NO_VTABLE CHelloWorldBHO : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CHelloWorldBHO, &CLSID_HelloWorldBHO>, public IObjectWithSiteImpl<CHelloWorldBHO>, public IDispatchImpl<IHelloWorldBHO, &IID_IHelloWorldBHO, &LIBID_HelloWorldLib, /*wMajor =*/ 1, /*wMinor =*/ 0>, public IDispEventImpl<1, CHelloWorldBHO, &DIID_DWebBrowserEvents2, &LIBID

Problems with naming(lowercase/uppercase) when exporting COM component from C#

↘锁芯ラ 提交于 2019-12-06 13:51:36
I have a C# COM DLL that defines some interfaces/types that I use from a C++ ATL/COM server. From time to time, be it on my machine, or randomly on other machines where I build the same projects (the ATL *.exe and the C# DLL) I get different compile errors related to exported C# struct members that are part of the COM interface. Here is an example: public enum TemporaryPolicyType { UntilTime = 0, ForNextMinutes } [Guid("6F8CD968-DA76-44CA-B4E1-C495AB5003BD")] public struct TemporaryPolicyData { public TemporaryPolicyType Type; public DateTime Timestamp; public DateTime EndTime; public int

Need to Find the COM DLL from an interop dll

南楼画角 提交于 2019-12-06 13:49:31
I have a Interop dll in a c# project, But I am not able to findout the corresponding COM dll associated with it. Please let me know, how to find out the actual COM dll from its interop dll. Got it. One way is to use any one of its class in the project. Then go to definition of it, which will take us to Metadata. we can note down the GUID and then search it in registry, if that is available, like this one. namespace NETWORKLIST { [ClassInterface(0)] [Guid("DCB00C01-570F-4A9B-8D69-199FDBA5723B")] [ComSourceInterfaces("NETWORKLIST.INetworkEvents")] 来源: https://stackoverflow.com/questions/20301820

How to call release from COM server

一个人想着一个人 提交于 2019-12-06 13:20:29
I am writing a Com server and I have wrote code that detect situation when COM client was closed unexpectedly, in this case I should close COM server inside COM server code. How can I do this? UPD: I have situations when COM server is hanged or more correctly I can't attach to COM server from COM client, but application that contains COM server is alive, so I think that COM server can detect that all old COM clients was disconnected/closed/crashed and application will restart because no new clients attached. I have write the following code in COM client in separate thread while(not we are

Is there a better way (besides COM) to remote-control Excel?

折月煮酒 提交于 2019-12-06 12:29:10
问题 I'm working on a regression-testing tool that will validate a very large number of Excel spreadsheets. At the moment I control them via COM from a Python script using the latest version of the pywin32 product. Unfortunately COM seems to have a number of annoying drawbacks: For example, the slightest upset seems to be able to break the connection to the COM-Server, once severed there seems to be no safe way to re-connect to the Excel application. There's absolutely no safety built into the COM

What's the best/easiest way to manipulate ActiveX objects in Java?

我只是一个虾纸丫 提交于 2019-12-06 12:19:20
问题 I want to open and manipulate Excel files with ActiveX. I've had success with Python's Win32 Extensions and Groovy's Scriptom libraries on other projects but need to do this is pure Java this time if possible. I've tried the Jacob Java COM Bridge but that doesn't seem as straightforward or simple to use, and I couldn't get it to retrieve cell values (even though this is the library underlying Scriptom). Are there alternatives? 回答1: Jacob is really the tool for the job here. I recommend that

Akka.net actors in STA

限于喜欢 提交于 2019-12-06 11:55:57
问题 I need to convert thousands of ms office documents in different formats into one common format. To get things faster i would parallelize it using akka.net for. The WordSaveAsActor should: run in Single-Threaded Appartment hold the Word Application instance make COM calls on this instance, like SaveAs(..) with paths from received messages from multiple parallel threads restart itself by any crash Is it even possible to run akka.net actor in STA? Is there any concerns if I use the akka.net this

WUA API unable to uninstall updates

老子叫甜甜 提交于 2019-12-06 11:48:25
I have encountered an issue when using Windows Update Agent (WUA) API. Whenever I try to uninstall an update using IUpdateInstaller.IsForced := True; IUpdateInstaller.BeginUninstall(... i'm getting WU_E_UNINSTALL_NOT_ALLOWED ( The update could not be uninstalled because the request did not originate from a WSUS server ). Does it mean that I can't use WUA API to uninstall updates? In that case, why are BeginUninstall/Uninstall methods there? According to Hey, Scripting Guy! How Can I Remove a Microsoft Update? (and also here ) the WUA API can only be used to uninstall updates that were

How to call a DCOM object from C#?

为君一笑 提交于 2019-12-06 11:34:54
问题 I have a CLSID and I need to instantiate this in a Different server (i.e. DCS ) where as my working machine is (i.e. MWS ). Now, if I use following : var type = Type.GetTypeFromCLSID(new Guid(CLSID), Environment.MachineName, true); var COMObject = Activator.CreateInstance(type); var returnValue = COMObject.GetType().InvokeMember(methodName, flags, null, COMObject, args, argModifiers, null, null); Then I get "COM target does not implement IDispatch" error. Ok, I understand that probably the