interop

32 and 64 bit interoperability on 64-bit Windows

六眼飞鱼酱① 提交于 2019-12-12 08:43:54
问题 Is there a good thorough authoritative reference that discusses interoperability between 32-bit and 64-bit processes? Based on googling I have deduced that: A 32-bit DLL can only reside in a 32-bit process, and a 64-bit DLL only in a 64-bit process. 32 and 64-bit processes can only communicate using loosely coupled message systems, such as network communications, which means they can communicate using COM/DCOM. 32 and 64-bit COM components have different registry entries. A component is

Determine if an open WPF window is visible on any monitor

霸气de小男生 提交于 2019-12-12 08:38:58
问题 Is there a way to determine if an open WPF window is currently visible in any of the desktop's connected monitors? By visible I mean that the window's bounds rectangle intersects with the desktop rectangle of any of the monitors. I need this functionality to determine if a window needs to be repositioned because the monitor configuration (working areas bounds, monitor count) changed between restarts of my application (which saves window positions). I have come up with the code below and it

Using Wrapper objects to Properly clean up excel interop objects

▼魔方 西西 提交于 2019-12-12 08:24:16
问题 All of these questions: Excel 2007 Hangs When Closing via .NET How to properly clean up Excel interop objects in C# How to properly clean up interop objects in C# struggle with the problem that C# does not release the Excel COM objects properly after using them. There are mainly two directions of working around this issue: Kill the Excel process when Excel is not used anymore. Take care to explicitly assign each COM object used to a variable first and to guarantee that eventually, Marshal

How can I pass a binary blob from C++ to C#?

旧时模样 提交于 2019-12-12 08:18:09
问题 I'm primarily a C# dev (not much C++ since college), but working on integrating a large collection of existing C++ code into an application. I have a C++/CLI assembly that is buffering the two worlds and have communication from C# through to C++ working fine. The question I have, is that the C++ class has a method call that generates a binary blob (think array of byte s in C# world) that I need to get in C# and process (pass around like a solid bag). What I'm looking for is advice on how to

.tlh generated on 2 machines is different

扶醉桌前 提交于 2019-12-12 08:03:54
问题 I have a .NET dll which has some interfaces\classes which are exposed to com. during the build procedure a .tlb file is generated and this tlb is referenced by some c++ code. As a result the compiler generates a .tlh file for the tlb. When I run the build locally one of the properties in one of the interfaces ends up with a corresponding method in the tlh which does not have the same name. The property in the .net code is called PropertyA end up being called get_propertyA, while PropertyB

How to dynamically load a C# dll from a C++ DLL

試著忘記壹切 提交于 2019-12-12 07:58:15
问题 I have a C++ application. This supports users' C++ plugin DLL's, it will dynamically load these DLL's and then be able to create and use the user's types dynamically. These user types derive from base types and interfaces defined in the main application's core library, so I hold user's objects as pointers to the base class and call the user's virtual functions to make their magic happen. Now I want to extend the plugin DLL's to allow managed DLL's (I care about C# mostly). I want all of the

Marshalling BSTRs from C++ to C# with COM interop

末鹿安然 提交于 2019-12-12 07:26:51
问题 I have an out-of-process COM server written in C++, which is called by some C# client code. A method on one of the server's interfaces returns a large BSTR to the client, and I suspect that this is causing a memory leak. The code works, but I am looking for help with marshalling-out BSTRs. Simplifying a bit, the IDL for the server method is HRESULT ProcessRequest([in] BSTR request, [out] BSTR* pResponse); and the implementation looks like: HRESULT MyClass::ProcessRequest(BSTR request, BSTR*

Graph.Chart interop in Word

痞子三分冷 提交于 2019-12-12 05:31:21
问题 I'm having massive problems when trying to update a chart through MSWord interop. All I want to do is set the values on a chart in a word document so the graph can update to values in my app. I've done the following (after importing Microsoft.Office.Interop.Graph.dll): InlineShape chartShape = WordDocument.InlineShapes[2]; chartShape.Activate(); // for opening Chart in edit mode // Convert the InlineShape into Chart type which is a part of Microsoft.Office.Interop.Graph Microsoft.Office

Simulate User Input in 3rd Party Application

让人想犯罪 __ 提交于 2019-12-12 05:15:14
问题 Not sure where to start with this one ... I'm thinking about creating a small little application to automate some repetitive text entry. I would like to be able to define snippets of text, and inject them into other applications when I want. What would be the best way to approach this problem? I have stumbled across UI Automation, as well as SendKeys. Any suggestions? I don't mind if I have to "point out" the input controls for the application (like how Mac's native screenshot tool asks you

VBA Equivalent to List<T> in C# [duplicate]

孤人 提交于 2019-12-12 04:52:36
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: VB6 equivalent to a List<T> Duplicate of: Access VBA equivalent to a List<T> I posted this question with the wrong information before, so I am reposting it in the hopes of getting a correct answer. I have a COM-visible object written in C# that accepts a list of string arrays. Could I send a Collection of string arrays from Access 2000 to this object and it work? If not, then what is the best way to send