interop

C++ Interop: How do I call a C# class from native C++, with the twist the class is non-static?

Hi, I have a large application written in native C++. I also have a class in C# that I need to call. If the C# class was static, then it would be trivial (there's lots of examples on the web) - just write the mixed C++/CLI wrapper, export the interfaces, and you're done. However, the C# class is non-static, and can't be changed to sta...

How to distinguish different types of NaN float in Python

I'm writing Python 2.6 code that interfaces with NI TestStand 4.2 via COM in Windows. I want to make a "NAN" value for a variable, but if I pass it float('nan'), TestStand displays it as IND. Apparently TestStand distinguishes between floating point "IND" and "NAN" values. According to TestStand help: IND corresponds to Signaling NaN ...

CopyFileEx in windows 7

Hi to all. I'm trying to use function CopyFileEx from kernel32.dll in Windows 7 using .NET interop. MSDN says: If lpProgressRoutine returns PROGRESS_STOP due to the user stopping the operation, CopyFileEx will return zero and GetLastError will return ERROR_REQUEST_ABORTED. In this case, the partially copied destination file is left inta...

Adobe AIR application to receive back events from native Windows application

I'm trying to develop a simple mxml Flex application to start Skype from the AIR/Flashplayer runtime. Is it possible to get back events from a native Windows application? In the simple example of Skype, the OS returns control to the Flex app when Skype exits. But what about native applications which have their own event model and wants ...

Passing a const char* character string from unmanaged to managed

I have two communicating components - one managed, the other unmanaged. The managed needs to retrieve a character string from the unmanaged implementation (the same string or just a copy). I tried the following code. // Unmanaged code const char* GetTestName(Test* test) { return test->getName(); } // Managed wrapper [DllImport(DllN...

Can a .Net 4.0 assembly be used in a .Net 3.5 application?

Possible Duplicate: How to reference .NET 4.0 assembly within .NET 3.5 projects Is there any way to ineteroperate a 4.0 assembly (a WPF interface) within a 3.5 application (an MFC Application). This application is giving us no end of trouble attempting to migrate it to 4.0. ...

COM interop and marshaling of a pointer to a pointer to an interface in C#

I'm attempting to use Microsoft's Text Services Framework in a C# app. So far, it's all gone swimmingly, but I've run into something that has me stumped. According to the MSDN docs, the ITfFnReconversion interface publishes this method: HRESULT GetReconversion( [in] ITfRange *pRange, [out] ITfCandidateList **ppCandList ); ...

WiX register assemblies for COM Interop

I'm really struggling with WiX. I have .NET assemblies to install that require registration for COM Interop, AND they must be registered with another framework that requires calling a Register() method in a .NET assembly that's in the GAC. This registration method is a 'black box' with a hidden storage mechanism so I can't perform this o...

Platform Invoke, bool, and string

Hi. suppose a dll contains the following functions extern "C" __declspec(dllexport) void f(bool x) { //do something } extern "C" __declspec(dllexport) const char* g() { //do something else } My first naive approach to use these functions from C# was as follows: [DllImport("MyDll.dll")] internal static extern void f(bool x); [Dl...

getting Jet oledb execption after compiling from Nant.

Hi all, i have a windows application in which i connect to Access database to retrieve the data, when i compile the code from Visual Studio every things works fine, but when i compile the code with NANT using csc task, its give me the following error, System.InvalidOperationException: The 'Microsoft.JET.OLEDB.4.0' provider is not regis...

C# interop to XPCOM

Before asking my question, I should admit that my knowledge of .NET interop is sparse, so I realize that I might be making a newbie error. I am using the GeckoFx library to create a C# application that contains an embedded Gecko (Firefox) browser instance. The app works well using GeckoFx in its original form, but I need to extend it to...

WCF Callback: Is it interoperable with Java?

Currently I implement all my webservices in the "normal" fashion... that is, I create a WSDL file in Eclipse and then use WSCF.blue (A visual studio extension) to auto-generate the necessary code and it is reply/request. However I was hoping to use callbacks instead, so I can have my services become "push" services. Before I jump into r...

Get object extension from AccessibleObjectFromWindow ?

I managed to get the selected file in the current working folder from Windows Explorer using SystemAccessibleObject from http://mwinapi.sourceforge.net/ I want to get the filename with extension but if you enable "Hide extensions for known file types" then there will be only the filename. I'm stuck on this step. My code: SystemAccessi...

How do I call Win32 application functions from a QT DLL ?

i have a Win32 (not MFC-based) application that imports a QT-based DLL. this works great. at this point, i dont need to use the QT_MFC interop library in order to merge the two event loops. however, i would like the QT DLL to be able to call methods in the Win32 application. would anybody have any advice on how i might go about doing t...

How can I do a Custom QueryInterface for .NET 3.5?

I have .NET Assembly exposed to COM, and I want to create a custom QueryInterface, otherwise my Class will have to implement a lot of interfaces. Currently my implementation is like this [ComVisible(true] [ProgId("SomeLib.SomeClass")] [Guid("516E4529-38F1-44EE-B340-ABFA498DC922")] public class MyClass : Interface1, Interface2......, et...

msn plus script read/write memory

hello, I'm writing on a MSN Plus script, which is in fact javascript. For interop with Windows there is a class called Interop. With its static function Call one can call s specified function in a specified dll with up to 12 arguments. My goal is to write a script which gets a process name out of the PID. I've done everything right, but ...

How to get pointer to IUnknown in C#

.NET interop wraps COM objects into .NET objects (runtime-callable wrappers, RCWs), which hide the usual interface querying. In order to register a COM object representing a filter graph with the Running Objects Table, I need the (native) address of its IUnknown interface (see How can I reverse engineer a DirectShow graph?). So the ques...

Cant load interop.PRNADMINLib in c# on Windows 7 64 bit

Hi have a project that uses the functions in prnadmin.dll, in order to the use them I reference the interop.PRNADMINLib.dll It all works fine on 32 bit but I get the following error on 64 bit: Could not load file or assembley 'Interop.PRNADMINLib, version=1......... I have registered the prnadmin.dll on the 64 bit system using regs...

4-bit Enum in C#

I know that its possible to make enums that use signed or unsigned 64, 32, 16, and 8 bit values as their underlying valud type using (:ulong, :uint, :ushort, :byte). But is it possible to create a 4 bit enum? (I'm writing some code that will interop with C++ and the struct that I have in C# for a return type has one field that would be...

memory leak when using COM IDispatch::GetTypeInfo() in C#

I have the following function in a COM dll (C#, .NET framework v2): public void Leak(object jsObject) { Type comType; IDispatch disp = (IDispatch)jsObject; disp.GetTypeInfo(0, 0, out comType); // this line causes the leak Marshal.FinalReleaseComObject(disp); Marshal.FinalReleaseComObject(jsObject); disp = null; ...