c++-cli

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

血红的双手。 提交于 2019-11-29 11:04:45
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? Visual Assist X , a commercial addin for Visual Studio developed by Whole Tomato Software Yes, Visual Assist X does support C++/CLI because we make heavy use of it. Its a good product, give it a try. What it doesn't do, however is make browsing or F1 help work. Visual Assist is rumored to

debugging in mixed mode with native C++, managed c++ cli, and c# solution

Deadly 提交于 2019-11-29 10:49:00
问题 I have a multithreaded project im working on and the startup project is set to a c# project that runs my UI. Then there is a whole series of underlying c++ native projects which are connected to the C# by managed C++/CLI projects. I've enabled in the c# start up project 'Enable Unmanaged debug' and when I attempt to debug the native code, I am able to hit break points I set. However, it hangs after I try to run it again and try to hit a break point again. For example, if I have a loop I try

How to use boost::bind in C++/CLI to bind a member of a managed class

为君一笑 提交于 2019-11-29 09:25:35
问题 I am using boost::signal in a native C++ class, and I now I am writing a .NET wrapper in C++/CLI, so that I can expose the native C++ callbacks as .NET events. When I try to use boost::bind to take the address of a member function of my managed class, I get compiler error 3374, saying I cannot take the address of a member function unless I am creating a delegate instance. Does anyone know how to bind a member function of a managed class using boost::bind? For clarification, the following

What is the C++/CLI equivalent to C#'s default(T)?

怎甘沉沦 提交于 2019-11-29 09:17:05
I'm working with some C++/CLI code (new syntax) and am trying to declare a generic type and want to set a member variable to it's default. In C#: class Class<T> { T member = default(T); } What's the equivalent in CLI? generic<typename T> public ref class Class { public: Class() : member(default(T)) // <-- no worky { } private: T member; }; Interestingly enough the syntax makes it looks like this: T() . It does require the addition of a copy constructor. generic<typename T> public ref class Class { public: Class() : member(T()) { } Class(Class^ c) { member = c->member; } private: T member; };

C++/CLI String Conversions

南楼画角 提交于 2019-11-29 08:43:05
I found this really nice piece of code that converts a string to a System:String^ as in: System::String^ rtn = gcnew String(move.c_str()); // 'move' here is the string I'm passing rtn back to a C# program. Anyways, inside the function where this code exists, I'm passing in a System::String^ . I also found some code to convert a System:String^ to a string using the following code: pin_ptr<const wchar_t> wch = PtrToStringChars(cmd); // 'cmd' here is the System:String size_t convertedChars = 0; size_t sizeInBytes = ((cmd->Length + 1) * 2); errno_t err = 0; char *ch = (char *)malloc(sizeInBytes);

Writing data to disk in parallel?

我与影子孤独终老i 提交于 2019-11-29 08:10:59
So I am working on a C++/cli image processing library and am trying to optimize my code. Basically, I am passed a System::Drawing::Bitmap of the image, which I then need to write to disk, perform complex analysis on, and return the results of the analysis. I thought that I could write the image to disk in parallel to speed up things (my algorithm does not modify the image). However, I have not worked with threads much, so I wanted to get your input on what the best way to do this would be. string ProcessImage(System::Drawing::Bitmap ^bmp, System::String^ targetFile) { bmp->Save(targetFile);

Convert a String^ to wstring C++

僤鯓⒐⒋嵵緔 提交于 2019-11-29 08:07:30
I programmed a little Application in C++. There is a ListBox in the UI. And I want to use the selected Item of ListBox for an Algorithm where I can use only wstrings. All in all I have two questions: -how can I convert my String^ curItem = listBox2->SelectedItem->ToString(); to a wstring test? -What means the ^ in the code? Thanks a lot! It should be as simple as: std::wstring result = msclr::interop::marshal_as<std::wstring>(curItem); You'll also need header files to make that work: #include <msclr\marshal.h> #include <msclr\marshal_cppstd.h> What this marshal_as specialization looks like

Writing data to disk in parallel?

笑着哭i 提交于 2019-11-29 08:03:42
So I am working on a C++/cli image processing library and am trying to optimize my code. Basically, I am passed a System::Drawing::Bitmap of the image, which I then need to write to disk, perform complex analysis on, and return the results of the analysis. I thought that I could write the image to disk in parallel to speed up things (my algorithm does not modify the image). However, I have not worked with threads much, so I wanted to get your input on what the best way to do this would be. string ProcessImage(System::Drawing::Bitmap ^bmp, System::String^ targetFile) { bmp->Save(targetFile);

How do i convert const wchar_t* to System::String?

北城余情 提交于 2019-11-29 07:50:34
I need to convert my SHA1 (wchar_t*) to a normal String^ in order to use it in a certain function. Any ideas? I tried Google but all the results were the exact opposite of my question. :\ NOTE: I am using C++.NET framework and Windows Forms Applications Use the constructor; like this: const wchar_t* const pStr1 = ...; System::String^ const str1 = gcnew System::String(pStr1); const char* const pStr2 = ...; System::String^ const str2 = gcnew System::String(pStr2); If you're using the standard C++ string classes ( std::wstring or std::string ), you can get a pointer with the c_str() method. Your

How to port C++ code to C++/CLI in Visual Studio?

有些话、适合烂在心里 提交于 2019-11-29 07:02:16
I have an application written in native C++ which I'd like to get running on the .NET virtual machine. I was thinking of recompiling the C++ code as C++/CLI, using the Visual Studio 2008 compiler. Regrettably, I don't find any documentation on how to do this, so hence my questions: Does this actually make sense? Am I trying the impossible? Where can information on the topic be found? A lot of native C++ code will actually just compile and run on C++/CLI. This is really a kind of hybrid compiler that can call native Win32 functions and use standard C libraries like OpenGL. You can even call COM