interop

Keyboard Interop in MFC - DELETE key not working

Hi, Im using C# Dll in MFC.So for keyboard entering.I didnt get any alphabets.So i add this follwing code. BOOL CToolTab::PreTranslateMessage(MSG* pMsg) { return System::Windows::Interop::ComponentDispatcher::RaiseThreadMessage( *reinterpret_cast<System::Windows::Interop::MSG*>(pMsg)); } By this code i get my wo...

Marshal a C++ class to C#

I need to access code in a native C++ DLL in some C# code but am having issues figuring out the marshaling. I've done this before with code that was straight C, but seem to have found that it's not directly possible with C++ classes. Made even more complicated by the fact that many of the classes contain virtual or inline functions. I...

I need a library to store/load files to/from iPhone

The only thing that I found was Manzana but it crashes while I start the test executable. Can someone tell me some library which can I use to copy/delete files from and to iPhone? Or maybe a console tool which I can use as a back-end. ...

COM Exception 0x800A11F9 - Cannot activate application.

I have a C# 2.0 (WinForms) project in which I try to activate word 2003 (word is installed on the system). By using the following code: private void ActivateWord() { this.Activate(); if (m_WordDocument != null) { try { m_WordDocument.Activate(); if (m_WordDocument.Application != null...

How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?

hi I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project. Visual Studio creates an IStream defin...

C++/CLI Mixed Mode DLL Creation

I've got a native C++ DLL that I would like to have a C++/CLI wrapper layer for. From what I understood, if you simple added a C++/CLI class to the project, VS would compile as mixed mode, but I was apparently wrong as VS doesn't seem to be even touching the managed code. So, given a pre-existing native code-base what exactly, step-by-...

How to speed up dumping a DataTable into an Excel worksheet?

I have the following routine that dumps a DataTable into an Excel worksheet. private void RenderDataTableOnXlSheet(DataTable dt, Excel.Worksheet xlWk, string [] columnNames, string [] fieldNames) { // render the column names (e.g. headers) for (int i = 0; i < columnNames.Len...

Saving Excel Spreadsheet using Interop C#

static void Main() { Application excelapp = new Application(); Workbook book = excelapp.Workbooks.Open(@"C:\HWYFAB.xlsx", 0, false, 5, "", "", false, XlPlatform.xlWindows , "", true, false, 0, true, false, false); Worksheet sheet = (Worksheet)book.Sheets[1]; Range cell = (Range)sheet.Cells[3, 2]; Console.WriteLine(cel...

Open XML document ContentControls problem with signed id's

I have an application that generates Open XML documents with Content Controls. To create a new Content Control I use Interop and the method ContentControls.Add. This method returns an instance of the added Content Control. I have some logic that saves the id of the Content Control to reference it later, but in some computers I've been ...

Why can't set cast an object from Excel interop?

Trying to get a reference to the worksheets (using Excel interop): Excel.Application xl = new Excel.ApplicationClass(); Excel.Workbooks xlWorkBooks = xl.Workbooks; Excel.Workbook xlWorkBook = xlWorkBooks.Open(fileName, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,...

How can I tell when a screen's WorkingArea changes (i.e. task bar is moved)?

I have some windows docked to edges/corners of the working area, and I need to know if/when the WorkingArea of the screen changes so I can update the position of those windows. I've attempted to tackle this before to no avail, as I recall. ...

Not able to instantiate PDF browser control from AcroPDF.dll using COM and .NET interop

When I try to instantiate a PDF browser control like this in C#: AcroPDFLib.AcroPDFClass acrobat = new AcroPDFLib.AcroPDFClass(); I get a COMException with this message: Creating an instance of the COM component with CLSID {CA8A9780-280D-11CF-A24D-444553540000} from the IClassFactory failed due to the following error: 80004005. ...

Passing a string from C# to cpp with COM

I have a C# COM server which is consumed by a cpp client. One of the C# methods returns a string. In cpp the returned string is represented in Unicode (UTF-16), at least according to the memory view. Is this always the case with COM strings? Is there a way to use UTF-8 instead? I saw some code where strings were passed between cpp an...

Add 64 bit offset to a pointer

In F#, there's the NativePtr module, but it seems to only support 32 bit offsets for its’ add/get/set functions, just like System.IntPtr does. Is there a way to add a 64 bit offset to a native pointer (nativeptr<'a>) in F#? Of course I could convert all addresses to 64 bit integers, do normal integer operations and then convert the resu...

More efficient way to find media item in WMP media library?

Hello, all. I am messing around with the WMPLib component provided by Windows Media Player 12 (wmp.dll) in VB.NET with .NET Framework 3.5 SP1. I am trying to retrieve a media item from my media library based on its name (assuming there are no duplicate names). At the moment, I'm grabbing the entire media library, and looping through ev...

Sending data from a PHP script to a C# applicaiton.

When C# app is ran, it POSTS a request to the PHP server, which wants to return an array. What's an easy way to load this array's contents into C# for using with there. For clarification, this array is a PHP stdClass object that contains strings, floats, and other stdClass objects. I want to get a similar data structure on the C# end ...

Producing Mini Dumps for _caught_ SEH exceptions in mixed code DLL

I'm trying to use code similar to clrdump to create mini dumps in my managed process. This managed process invokes C++/CLI code which invokes some native C++ static lib code, wherein SEH exceptions may be thrown (e.g. the occasional access violation). C# WinForms -> C++/CLI DLL -> Static C++ Lib -> ACC...

WTSVirtualChannelRead Only reads the first letter of the string.

I am trying to write a hello world type program for using virtual channels in the windows terminal services client. public partial class Form1 : Form { public Form1() { InitializeComponent(); } IntPtr mHandle = IntPtr.Zero; private void Form1_Load(object sender, EventArgs e) { mHandle = NativeMet...

Opening a huge .csv file with Excel Interop

I have an application that write huge .csv files about the size ranging from 1 GB to 2 GB. I need to color code the file and save it as .xlsx. So I have tried using Excel Interop and it works great for small files, but when I try to open a 1.3 GB .csv file with Excel, I get an Hresult error. Any ideas as to how I could accomplish this...

How do I get the intellisense in FoxPro 8 to work with .net COM objects?

Hi, I'm at my wit's end with this. What I'm doing is making a C# dll file that needs to have some methods exposed to FoxPro 8. This guy here http://www.west-wind.com/presentations/VfpDotNetInterop/DotNetFromVFP.asp says that you can put [ClassInterface(ClassInterfaceType.AutoDual)] in front of the (C# in my case) class, and then intell...