com

How to get an ActiveX component's registered path

你。 提交于 2019-12-07 12:35:19
问题 I've got a registered ActiveX component which I'm referencing in a C# project. However, I'd like to know the original path to the actual component being run. This is not the execution path per se. Is there something saner than searching the registry by hand? The component is registered with a simple /regserver command, if that's relevant. 回答1: Search under the HKEY_CLASSES_ROOT\CLSID with the name of your EXE file. It should be used as value of "LocalServer32". 回答2: Here's a function that

Is it possible call a COM object from within R, if the COM object is exposed from a .NET assembly?

笑着哭i 提交于 2019-12-07 12:16:19
问题 I'm wondering if it is possible to call .NET functions from R, via a COM call. The library rcom allows calls to COM objects, so this should be possible, in theory, for any .NET assembly that is exposed as a COM object. To keep it simple, I'll see if I can call the .Reverse() function in System.Text , which is exposed by default as a COM object from the .NET framework. This is what I have tried so far: I obtained a list of ProgID's in my system (see link to C# code). Here is a list of the

how to connect to an open window of internet explorer using c#?

点点圈 提交于 2019-12-07 12:08:41
问题 Can you use COM/OLE in a C# program to connect to a running instances of internet explorer? Ideally I'd like to find the URLs of all webpages open in IE. 回答1: I found the answer here and the code excerpt is: public class Form1 : System.Windows.Forms.Form { static private SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass(); public Form1() { InitializeComponent(); foreach(SHDocVw.InternetExplorer ie in shellWindows) { MessageBox.Show("ie.Location:" + ie.LocationURL); ie

How to better initialize a reference counter for a non-creatable COM object?

雨燕双飞 提交于 2019-12-07 11:22:15
问题 I have a COM interface with a method that returns an object: interface ICreatorInterface { HRESULT CreateObject( IObjectToCreate** ); }; The key is that calling ICreatorInterface::CreateObject() is the only way to retrieve an object implementing IObjectToCreate interface. In C++ I could do it this way: HRESULT CCreatorInterfaceImpl::CreateObject( IObjectToCreate** result ) { //CObjectToCreateImpl constructor sets reference count to 0 CObjectToCreateImpl* newObject = new CObjectToCreateImpl();

Not getting event arguments in IHTMLElement event handler

孤者浪人 提交于 2019-12-07 10:57:09
问题 I've added a callback to an IHTMLElement instance but when the IDispatch::Invoke is called for the event, there are never any arguments (i.e. the pDispParams->cArgs and pDispParams->cNamedArgs are always 0). For example, I add a callback for an onmouseup event. From what I can tell, a callback for this event is supposed to receive a MouseEvent object. Is that correct? If so, what do I need to do to ensure this happens? This is using the MSHTML for IE 6 sp2 (or better) on Windows XP SP2. 回答1:

Exposing C# struct to COM breaks for VB6 app

雨燕双飞 提交于 2019-12-07 10:12:58
问题 Last Updated: 2009-08-11 2:30pm EDT A few days ago I posted this question about some very strange problems. Well, I figured out what specifically was causing a build on one machine to not run on others and even came up with a work-around, but now it leaves me with a nice, specific question: Why? To reproduce the problem, I create a new InteropUserControl and do the following: Add a new public struct MyStruct : Give it a GUID and ComVisible attributes Add a GetMyStruct member to the

Powershell: Using jQuery through InternetExplorer.Application

社会主义新天地 提交于 2019-12-07 09:55:28
问题 I followed this article, explaining how to spice up an Internet Explorer COM-Object with jQuery. While the author used Python, I want to do something similar in Powershell. Right now I have this code: function addJQuery ($browser) { $url="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" $document = $browser.document $window = $document.parentWindow $head = @($document.getElementsByTagName("head"))[0] $script = $document.createElement("script") $script.type = "text/javascript"

Can a managed ref-class directly implement a COM interface?

匆匆过客 提交于 2019-12-07 09:49:26
Is there a built-in way to allow a managed ref-class to implement and expose a COM inerface that is safely callable from native code? Looking at the C# side, this is easily done by decorating the target interface with the proper COM-interop attributes, for example: Native Interface interface ISampleGrabberCB: public IUnknown { virtual STDMETHODIMP SampleCB( double SampleTime, IMediaSample *pSample ) = 0; virtual STDMETHODIMP BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen ) = 0; }; static const IID IID_ISampleGrabberCB = { 0x0579154A, 0x2B53, 0x4994, { 0xB0, 0xD0, 0xE7, 0x73, 0x14,

Debugging .Net4 COM registered assembly from Win32 caller in Visual Studio 2010

大憨熊 提交于 2019-12-07 08:56:54
问题 This is a very simple setup, I can't believe but I didn't find anybody with the same problem so far... Create a .Net4 class library in VS2010. Create a simplest possible COM object: [ComVisible(true)] [Guid("CD157EBC-C89D-40b6-B531-E85FF4B3AE9A")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAcorn { bool Foo(string moo); } [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [Guid("854B7690-C1C4-40c4-8059-B4F3450B30D0")] public class Acorn : IAcorn { public

Would adding a new function to the existing COM interface break its binary compatibility?

旧街凉风 提交于 2019-12-07 08:45:57
问题 I want to add a new method to a COM interface with all the existing one unchanged, will this break its compatibility for the consumer before this update? 回答1: It depends: if this is an internal unpublished interface, you are free to change it at will so long as you control all the code that interacts with that interface. Once published, however, the rules are strict: every interface has its own IID. You change that interface in any way - by modifying, adding or removing methods - it's a whole