interop

Sending a struct from C++ to WPF using WM_COPYDATA

I have a native C++ application that, for the time being simply needs to send its command line string and current mouse cursor coordinates to a WPF application. The message is sent and received just fine, but I cannot convert the IntPtr instance in C# to a struct. When I try to do so, the application will either crash without exception ...

Please give opinions on this hypothetical open source license.

I've concocted an open source license in my head that I feel is a good compromise between copyleft and permissive licenses. I think it extracts many of the benefits of copyleft with few of the downsides. Here's a rough draft of it. The spirit of it is that a company should be able to profit by adding value to open source software, but...

How to call win32 CreateMutex from .Net

Hello, I've been successfully creating a .net mutex like this: SingleIns = new Mutex(true, AppName); for a while. It works in XP, Vista, but apparently not in Windows7. So I need to make an interop call to a Win32 library so other Com components can identify the mutex. I found the following code, but the Win32Calls. is not found... is...

C# Outlook interop and OpenSharedItem for opening MSG files

Is there any tutorial or resource I can follow in order to use the OpenSharedItem outlook interop method. My goal is to read MSG files using it (as it can apparently do so). ...

C# Outlook 2007 COM interop application does not exit!

Any ideas why the following code does not exit the Outlook 2007 process created via COM interop? Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); var item = app.Session.OpenSharedItem("C:\\test.msg") as Microsoft.Office.Interop.Outlook.MailItem; string body = item.HTMLBody; int att ...

.NET Interop IntPtr vs. ref

Probably a noob question but interop isn't one of my strong points yet. Aside from limiting the number of overloads is there any reason I should declare my DllImports like: [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam); And use them like this: IntPtr lParam = Marshal...

Microsoft Outlook View Control

I am playing with the Microsoft Outlook View control, trying to understand its capabilities, but I'm not getting very far. It shows up at design time, but at runtime it just gives an "E_CLASSNOTREG" exception. How do I find out what class it is complaining about? I just created a winform project, added the control to the toolbox, and dr...

help: Call C# winforms dll from VB6 project?

I have a VB6 project(windows application) and I have to redevelop a module in the existing VB6 project in C#.net. The module that I develop in C#.net should be a dll and should contain some windows forms. I was able to successfully call a c# console applicaiton dll from my vb6 project but I am facing issues when i try to call a C# clas...

ILockBytesOnHGlobal WriteAt performance decreases over time

I've created ILockBytesOnHGlobal and I write 64k of data repeatedly. What I've noticed is that WriteAt performance decreases over the time. What could be the reason for the performance slow down? Does it have to do with stream growth? Here is what I'm doing (in C#) public override void Write(byte[] buffer, int offset, int count) ...

Hide all windows for a process (ex. Internet Explorer)

I am using WatiN to script actions in Internet Explorer that run in the background of the user's machine. (I know...hacky). I am able through WatiN to make the Internet Explorer window not show. However, during my script, some HTML dialogs are opened. I am able to hide them using the P-Invoke ShowWindow in User32.dll, but they still ...

How do I turn a .NET System.String into a string usable by VBScript?

I'm trying to call a .NET component using interop from a classic ASP page (VBScript). If a .NET function returns a "System.String", is there a way for me to use that as a VBScript string? Is there something I need to do to convert it? ...

How to support linux for my C# project

Hello everyone, I have a project that is an open source application for a specific type of scientific calculation that uses c++ for the backend, and C# for the front end. I'm not doing anything windows specific in the c++ portion, so I'm hoping for a relatively small learning curve there. I have a few specific questions, and I would appr...

C# ULONG_PTR Equivelent

Hi there, I am having to pass a ULONG_PTR in unsafe code in C#. I understand that the reason for ULONG_PTR is to allow for a single codebase for both 32bit and 64bit operating systems. Is this a case for C#'s UIntPtr? Can I be confident when passing a .Net UIntPtr as an ULONG_PTR parameter? Thanks! ...

How to use SafeWaitHandle.DangerousGetHandle?

I have an unmanaged code that calls an asynchronous managed method that returns a handle, and then the unmanaged code use that handle to wait, reading a little documentation I found out that SafeWaitHandle provide 2 other methods (DangerousAddRef and DangerousRelease ). Should I use these methods in order to prevent the Handle from not b...

# of marshalling Performance Counter

I am trying to determine if the COM interop is becoming a bottle neck in my software. This article on MSDN helps http://msdn.microsoft.com/en-us/library/ms998579.aspx#scalenetchapt15%5Ftopic11. But I really do not have have a point of reference for a "normal" or "high" value for # of marshalling to determine if it is impacting performanc...

Problem with Office 2003: Unbale to find Microsoft.Office.Interop.Powerpoint dll

Hi All, I have created a windows application which makes use of Office.dll and powerpoint dll of Microsoft office 2003. At design time, when I am adding referrence of these dlls to my project it refers following path; C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.PowerPoint\ The application runs perfect on the machine where it is de...

Creating a .NET StreamWriter object from classic ASP - constructor parameter problem

I'm trying to create and use a .NET StreamWriter object inside a classic ASP page (VBScript). Normally I would create the object like this: Dim writer Set writer = Server.CreateObject("System.IO.StreamWriter") However, the constructor for StreamWriter takes a Stream object as a parameter, and the call to CreateObject fails. Even if I...

Watchdog win service to watch another win service

Hi, I want to make a windows service that monitors another windows service, and make sure that it is working. sometimes the Win Service that I want to watch stay in the memory (appear in task manager, so it is considered a running service, but the fact is that it is doing nothing, it is dead, its timer is not firing for one reason, which...

Java's CORBA ORB and connecting to a 3rd party Naming Service

Hi all, The Following is from JavaTM IDL FAQ: How do I connect to a 3rd-party Naming Service from Sun's ORB? The recommended way is to use the Interoperable Naming Service (INS) , if this option is supported by the 3rd-party Naming Service. To use the Sun ORB with another vendor's Naming Service, Start th...

WPF Control inside a transparent winform is not displayed

I create a simple WPF UserControl (any control will do) and insert it into a Winform (using an ElementHost). This works fine. The WPF control is embedded in the WinForm and when the WinForm is moved around the WPF control moves with it just like a WinForm control will do. When I change the WinForm to transparent by setting the Tranparenc...