c++-cli

How do I display a standard windows error icon for a custom exception handler?

As the title suggests, I just want to display a standard windows error icon for a custom exception handler. What the easiest way to achieve this using WPF? For example, the red cross in this dialog: ...

C++/cli -> calling c# dll -> calling OpenFileDialog issue

Hello Everyone, I write extensions to a C++ program. I write standard C/C++ dlls and I use IJW to call C# dlls. This has always worked perfectly until I wrote and called a C# dll that in turn called an OpenFileDialog and a SaveFileDialog. Whenever either was called with ShowDialog, the app would freeze. So in making a "Minimum Worki...

.NET assembly not creating as backgrouond process using System.Process

Hello, I am trying to launch background processes using System.Diagnostic.Process API . It launches every process e.g notepad.exe, all native processes and all windows form base processes. But this unable to launch pure managed GUI less assemblies. Task Manager not showing those assemblies listed in its list as seperate process. Niether...

How do I decode a PDEV_BROADCAST_DEVICEINTERFACE::dbcc_name?

I've been trying to watch a USB subsystem to detect when devices are added or removed, but I'm having trouble decoding the PDEV_BROADCAST_DEVICEINTERFACE::dbcc_name field. My code is based on an example over on codeproject. If I right-click in my C++/CLI application in visual studio and go to the declaration in Dbt.h I get: typedef str...

C++/CLI, static constructor outside class declaration

Hello, How do I put body of static constructor of a managed class outside class declaration? This syntax seems to be compilable, but does it really mean static constructor, or just a static (=not visible outside translation unit) function? ref class Foo { static Foo(); } static Foo::Foo() {} ...

How can i enable the intellisense on my c++/cli project?

I am using visual studio 2008 and i have a native c++ project that loads a managed c++ dll, but on the last one, the intellisense doenst work anymore only por the managed code. this project (dll) has a mixed code (native and managed) and if i write only "::" on a clean line, the intellisense gives me the methods inherits from the base c...

What are people replacing the missing C++/CLI Intellisense in VS 2010 with?

I'm about to start a project where I will be likely to use a lot of C++/CLI. I really miss C++/CLI Intellisense in VS 2010. I've heard of some Resharper-like products for C++, but wonder if they provide complete Intellisense. Do they also work with C++/CLI? What are people doing to overcome this limitation? ...

Problem referencing C++ /clr project from C#

Hi. I have compiled a native C++ project using the /CLR switch ("gloox", an XMPP library). The build succeeded and I'm able to reference it from a C# project (ie it shows up in the References folder). The C++ project exposes some classes under the namespace 'gloox'. I can also see the gloox {} namespace in the object browser, along wit...

c++/cli dll problem on Windows 7 without vs2008 installed.

OK, here is my weirdness for today. I create extensions to an existing C++ program that I DO NOT have access to the source code. I write standard C/C++ dlls and I use IJW to call C# dlls. I have not done this in awhile, but now I'm trying to get one to work on Window 7. I get an error (Error 0000036B1 - Not sure if that is an interna...

How to Inherit C++/CLI Interface in C#?

Hello, I have declared an interface in C++/CLI and made it assembly(DLL). Now I want that interface to be implement by C# app. I have added the reference but still my C# assembly does not detecting my C++/CLI interface and says "Could not found: Are you missing some assembly refernce......" How to solve this issue? Regards Usman ...

How do I bind a ListView to an ObservableCollection in C++/CLI?

I've got a small app which will allow the user to select a number of files and then perform some processing. I was thinking I'd collect the files in an ObservableCollection of String^ (and probably expand this to a full class at a later date). The problem is I can't work out how to bind the ListView to the ObservableCollection. I've add...

Using a C# WinForms control in a C++/CLI (WinForms) application

How do I use a WinForms control written in C#, in a WinForms C++/CLI application ? If at all possible. ...

Sharing an enum from C#, C++/CLI, and C++

I have a library that consists of three parts. First is native C++, which provides the actual functionality. Second is a C++/CLI wrapper/adaptor for the C++ library, to simplify the C# to C++ transition. Finally I have a C# library, which invokes the C++ library through the C++/CLI adaptor. Right now there I have two sets of parallel...

How do I use MethodInvoker in C++ ?

I've got a C++/CLI application which has a background thread. Every so often I'd like it to post it's results to the main GUI. I've read elsewhere on SO that MethodInvoker could work for this, but I'm struggling to convert the syntax from C# to C++: void UpdateProcessorTemperatures(array<float>^ temperatures) { MethodInv...

System.AccessViolationException with a .dll I compile

Hi, I am compiling a project into a .dll and trying to use it in another project. For most of the functions I use in this library, I get a System.AccessViolationException exception : System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at nglib.Ng_Get...

Target .Net 3.5 in VS2010 for C++ executables

Is it possible in VS2010 to create a mixed mode executable that targets .Net 3.5? If we try this we get error MSB8009: .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine. If we then change the toolset in the properties to v100, then the resulting executable s...

C++/cli - Native error trap for "Framework not available" Errors?

When creating dlls (Add-ins) for a third party program that loads Native DLLs dynamically, is there a way, in a Mixed Mode DLL (C++/cli) to natively catch the fact that the .Net framework is not available. So that the Parent program that is dynamically trying to consume this DLL does not throw an error? ...

Singleton example in C++/CLI?

I've looked around, I need an example for Singleton class that works across 2 or more C++/CLI files. How do you declare a singleton in C++/CLI, not C# ? How do you share that singleton across two or more C++/CLI files? I keep getting Variable redefinitions when I try to share that singleton. ...

How do I make an custom drawn resizable container?

I have a WinForms gui application which has a number of areas to it which I'd like to custom-draw some graphics. These areas would contain controls and be resizeable. I'm currently thinking of inheriting from a TableLayoutPanel and handling onpaint messages. Does this sound like a good way to go or are there other/better options? ...

"File contains invalid .pdata contributions" when building 64-bit dll

Hi, I currently migrating from 32-bit to 64-bit am encountering a "LNK1223: invalid or corrupt file: file contains invalid .pdata contributions" when attempting to build a 64-bit managed C++ dll that links to an unmanaged C++ .lib file that I also built. So far, I have found that this error should only occur while building for RISC mach...