com

Exposing events from .NET to COM

 ̄綄美尐妖づ 提交于 2020-01-13 06:54:28
问题 recently I have been encountering problems with exposing events from .NET to COM. I have been successful with this example (conceptually taken from http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx): // The delegate type for our custom event. [ComVisible(false)] public delegate void SomeEventHandler(object sender, EventArgs e); // Outgoing (source/event) interface. [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public

Get AutoIt reference working in C#

旧巷老猫 提交于 2020-01-13 05:40:49
问题 I'm pulling my hair out on this one... I have a legacy application I built a few years ago that uses AutoItX - all working fine. The time has come to try and update the app, so I've upgraded it to VS2012/.NET4 and I simply cannot get a reference to the AutoItX library to work. I have installed the application, have registered the dll with regsvr32, tried every combination of property settings on the reference itself (Embed Interop Types / Isolated), but no joy. The error I keep getting

IE web browser control res:// usage

强颜欢笑 提交于 2020-01-13 05:40:11
问题 I'm using the IWebBrowser2 control in my app and I have various html files that are stored as resources in the exe. To load these up I use the "res://" protocol. The problem is that with certain versions of IE the pages no longer load up, and instead just shows "Action Canceled, Internet Explorer was unable to link to the page requested." The pages are referenced in the .rc script like so: stats.html HTML DISCARDABLE "res\stats.html" The res request looks like res://C:\path\To\MyApp.exe/stats

What is the preferred method of marshalling COM interfaces across threads?

不羁的心 提交于 2020-01-13 01:39:11
问题 What are the pros/cons of using the GIT as opposed to CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream for marshalling COM interfaces across threads? Are there strong reasons for preferring one method over the other, or is it more a matter of personal preference? 回答1: From MSDN: If you are unmarshaling an interface pointer multiple times between apartments in a process, you might use the IGlobalInterfaceTable interface. With other techniques, you would have to

GetCPUDescriptorHandleForHeapStart stack corruption

只愿长相守 提交于 2020-01-12 14:58:51
问题 I've stumbled upon a rather unusual problem while programming with DirectX 12.0. No research so far has been insightful. I am programming using C (not C++). It would appear the official DirectX 12 headers support bindings for both C and C++, however writing C equivalent code to do a said task causes a crash whereas C++ does not. I don't believe the error is mine. Here's the details: I have here in my D3D12 device-initialisation procedure the following block of code: /* Get a handle to the

Calling COM object from VBA

拟墨画扇 提交于 2020-01-12 10:16:32
问题 I have a python script which i converted into a COM server. Now i want to call it from VBA (Access). I have tried this: Sub test() Dim PyScript Dim var Set PyScript = CreateObject("PythonDemos.CodeScript") var = PyScript.CodeReader() Debug.Print var End Sub But i get an error at CreateObject(...): Automation error 2147024770 From what i read this means that the module "PythonDemos" can not be found. Here is the python code: class Main: _public_methods_ = ['CodeReader'] _reg_progid_ =

Calling COM object from VBA

a 夏天 提交于 2020-01-12 10:16:07
问题 I have a python script which i converted into a COM server. Now i want to call it from VBA (Access). I have tried this: Sub test() Dim PyScript Dim var Set PyScript = CreateObject("PythonDemos.CodeScript") var = PyScript.CodeReader() Debug.Print var End Sub But i get an error at CreateObject(...): Automation error 2147024770 From what i read this means that the module "PythonDemos" can not be found. Here is the python code: class Main: _public_methods_ = ['CodeReader'] _reg_progid_ =

Using tlbexp.exe on a COM dll

巧了我就是萌 提交于 2020-01-12 08:29:33
问题 I am trying to set up communication between Centura and a COM .dll. (Downloaded from http://download.resip.fr for a database import) Centura requires a .tlb file to be able to communicate to this component. Normally I would use regasm /tlb to generate the .tlb but seeing as it is a COM .dll this is not possible. I found that I could use tlbexp for .NET dll's: http://msdn.microsoft.com/en-us/library/hfzzah2c(v=vs.80).aspx I tried this out, knowing it would probably fail (as I have COM .dll). I

C# interop: excel process not exiting after adding new worksheet to existing file [duplicate]

江枫思渺然 提交于 2020-01-12 05:11:20
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to properly clean up Excel interop objects in C# I've read many of the other threads here about managing COM references while using the .Net-Excel interop to make sure the Excel process exits correctly upon exit, and so far the techniques have been working very well, but I recently came across a problem when adding new worksheets to an existing workbook file. The code below leaves a zombie Excel process. If

Can I add MFC support to an Existing ATL COM project

落花浮王杯 提交于 2020-01-11 13:28:26
问题 I have created a Shell Extension using ATL COM Object . But during creation I haven't added MFC support. Can I change the setting now to add MFC support 回答1: Yes, but I believe that doing this won't auto-add all the required headers and #defines - of course, you could try this first, and check to be sure. If that does not work, you could use 'File->New->Project from Existing Code' to create a new project in your solution that uses both MFC and ATL, using the code in your original project. You