interop

Foreach fails with a marshalled COM interface

We have a 32-bit COM component written with ATL in C++. When there's a need to use it from 64-bit .NET, we create a COM+ application and everything works allright. Recently we noticed strange behaviour on Win2k8. The COM object in our component fires an event and we process it in .NET code. The event has a parameter also passed from the...

Powerpoint Interop fails in a Windows Service but works fine in a Windows Form application

I've written an application to watch a folder, and whenever a PowerPoint document is dropped into it, it goes through the slides within it and generates png images of each slide. This works fine in a windows forms application but I've put exactly the same code in a windows service, used the same test file and it fails to open it with the...

How to marshal C++/CLI array of struct to unmanaged C++

I'm searching for the correct syntax to pass a struct array to an unmanaged C++ dll. my dll imports are called like this #define _DllImport [DllImport("Controller.dll", CallingConvention = CallingConvention::Cdecl)] static _DllImport bool _Validation(/* array of struct somehow */); In my client code I have List<MyStruct^> list;...

P/Invoke tutorials?

Does anyone know of a good tutorial/e-book that goes in depth on the System.Runtime.InteropServices namespace? I just got through reading this tutorial on how to make the UAC shield show up in a button and now I really want to learn this. P.S. How do look in the windows system files to know that a method exist to show a UAC shield in a...

How to make a Java client for a WCF service secured with X.509?

I have a WCF service that uses X.509 certificates for authentication. What's the best method of creating a Java client that can use that service? I've heard of Axis, CXF, Tango, and WSS4J, but I'm not sure which supports X.509 and which one is a good way of working with WCF. ...

Call function from DLL with non-static path

I have a DLL that I need to access methods from. In most cases like this I just use [DllImport] to access methods from unmanaged assemblies, but the problem with that in this situation is that it requires the path to the DLL at instantiation time, so a constant string. This particular DLL is one that gets installed with my application ...

Which mechanism may be used to access Java methods which conflict with JavaScript keywords?

I've a Javascript source that uses a Java class that defines a "delete" method (using jdk6 scripting). Since delete is a keyword, I cannot invoke that method. In JavaFX script any sequence of characters enclosed in <> is treated as a lexical identifier. So you can use "insert", that is a keyword, as an identifier: var textField = new ...

dll files created in Visual C++ be used in C#?

I am creating a dll file in visual C++ through Dynamic Link Library project. I know i can import this dll thorugh object browser in C#. I want to know whether i can use those functions without any issues, since i am programming in 2 different languages. ...

How to list available video modes using C#?

I've found nice examples using C++ (http://www.codeproject.com/KB/tips/resswitch.aspx), but not in C#. Can someone help, please? Edit: The exact function that list the video modes is: BOOL CVideoModes::GetAvailableVideoModes(CAvailableVideoModes& modes) { modes.SetSize(0, 5); int i=0; DEVMODE dm; while (EnumDisplaySettings(NU...

Better way to cast object to int

Hi, This is probably trivial, but I can't think of a better way to do it. I have a COM object that returns a variant which becomes an object in C#. The only way I can get this into an int is int test = int.Parse(string.Format("{0}", myobject)) Is there a cleaner way to do this? Thanks ...

Close MS Office C# Console

Hey Everyone.. I'm writing an automated test to determine whether or not rtf files are successfully opened by MS Word. So far I looping through all the rtfs within a given directory and opening them. Later I will have to catch exceptions to generate a report (log the file name that crashed word). I am processing a large number of files...

wrapping an MFC Gui app into a DLL(or something else) for .NET interop

sound like a terrible idea? Yeah I thought so too. Needless to say im told I have to do it. Situation: Old MFC-based C++ gui application that reads and processes a whole lot of data sources into an internal datastructure, before displaying it to the user. Problem: I need that datastructure in .NET, in XML will do. Solution: Make a f...

Does the SaveAs method in Microsoft.Office.Outlook.Interop have a maximum file size?

Is there some type of undocumented file size limit when using this method to save to a UNC path? http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._mailitem.saveas.aspx I made an Outlook add-on that copies the currently selected email(s) to a network server. Works great until you try to save an email that has man...

C# Powershell Interop

The Sys Admin guy is writing some common housekeeping Power Shell scripts. Predominantly for AD management (updating exchange details, moving people around security groups etc.) I'd like to use these scripts from C# (I intend to write it as a library, consumed by a web site). I've seen this code project article which looks interesting ...

Open Word Documents using Interop DLL without opening Word?

Hello Everyone, I have written an automated test which loops through a large volume of Word Documents and opens them individually in a single Word instance. My question is.. can I perform the OpenDocument() without an ApplicationClass instance? What I would like to do is run my test without having a visible instance of Word open. Possi...

Trouble using .NET DLL in Borland C++ Builder 4

I have created a COM callable DLL in C# .NET 2.0 and created a TLB from the assembly using the .NET regasm tool. In Borland C++ Builder 4.0 I go to Project->Import Type Library-> and find my DLL's type library there and click "Ok" to import it. BCB creates an HardwareCheck_TLB.cpp & HardwareCheck_TLB.h file. In a cpp file of the ...

How to reference ADO RecordSet object in C#?

I am using a COM DLL, a function call which returns an ADO RecordSet object and want to refer to it in my C# application. Have added the reference, put the msado15,interop.adodb dll in the bin directory and debug directory, added assembly key in web.config but still get the following error: The type 'ADODB.Recordset' is defined ...

Testing RSS feeds

I am looking to test an RSS Feed I have created and I am looking for some good RSS Feed applications to test with. ...

Interop with Office 2003 and 2007

I would like to have my application function with both version of Office (as well as Outlook within those). I understand I can't install them full in parallel (Outlook being the fight really). In specific, our application opens up Outlook, fills some information and loads up the contacts (so they can select who to send it to), and some ...

firefox 3 address bar auto-complete dependency

Background: Those of you who use FF3 may be familiar with an interesting new attribute of the address bar. It allows you to do sub-string auto-complete in order to filter through URLs that you have viewed previously. Therefore, if you want to open the following URL: http://longservernamehere.thatyou.nevercanremember.com/support/asdf12...