c++-cli

Creating C# and C++/CLR projects in the same solution using CMake (CMake targeting visual studio)

微笑、不失礼 提交于 2021-01-28 14:00:36
问题 I want to create a solution in MSVC using CMake that has two projects (in CMake vocabulary one C# executive and one C++/CLR library). How can I do this? All examples that I found are about one type of project in a CMake (all C++ or C#). To clarify: If I want to create a C++/CLR project using CMake, I can write code like this: cmake_minimum_required (VERSION 3.5) project (TestCppClr) if (NOT MSVC) message(FATAL_ERROR "This CMake files only wirks with MSVC.") endif(NOT MSVC) ADD_EXECUTABLE

Creating C# and C++/CLR projects in the same solution using CMake (CMake targeting visual studio)

放肆的年华 提交于 2021-01-28 14:00:06
问题 I want to create a solution in MSVC using CMake that has two projects (in CMake vocabulary one C# executive and one C++/CLR library). How can I do this? All examples that I found are about one type of project in a CMake (all C++ or C#). To clarify: If I want to create a C++/CLR project using CMake, I can write code like this: cmake_minimum_required (VERSION 3.5) project (TestCppClr) if (NOT MSVC) message(FATAL_ERROR "This CMake files only wirks with MSVC.") endif(NOT MSVC) ADD_EXECUTABLE

.NET draw over fullscreen games

青春壹個敷衍的年華 提交于 2021-01-28 04:45:28
问题 Now I can draw over games but only if they are in window mode, i just draw on TopMost form and set it clickable-through: //C++ .NET 4 private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { int initialStyle = GetWindowLong(this->Handle, -20); SetWindowLong(this->Handle, -20, initialStyle | 0x80000 | 0x20); } But I am not able to do it if the game runs in fullscreen :( Can I do something with fullscreen games? (with C++ if possible) 回答1: You just can't (at least that

How to declare the default indexed property in C++/CLI interface

浪子不回头ぞ 提交于 2021-01-27 20:31:01
问题 how is it possible to declare the default indexed property in an C++/CLI - Interface. (Please excuse the repeating, full qualified notation with namespaces because I'm just learning C++/CLI and want to be sure that no acciential mixup of language primitives between C++ and C# happens) Code is public interface class ITestWithIndexer { property System::String ^ default[System::Int32]; } Compiler always throws "error C3289: 'default' a trivial property cannot be indexed". Where is my error? PS:

Any reason to prefer CefSharp over CefGlue (or vice-versa)?

我与影子孤独终老i 提交于 2020-11-30 04:34:25
问题 In the realm of providing a decent implementation of the Chromium Embedded Framework (CEF) for .Net, the two leading options appear to be CefSharp and CefGlue. They differ in approach (CefGlue uses P/Invoke to call into the CEF unmanaged code, CefSharp uses a mixed-mode C++/CLI wrapper around the CEF libraries). Is there some reason that a mixed-mode assembly is better than P/Invoke calls? All other things being equal, it seems like CefGlue (the P/Invoke lib) provides a "thinner" wrapper

WSAEWOULDBLOCK handling

放肆的年华 提交于 2020-08-27 21:25:39
问题 I have written a socket for a server in C++ CLI that is using winsock. The sockets are using async methods for sending, receiving and accepting connections. After implementing my socket in the production environment, the send function stops working giving me the error WSAEWOULDBLOCK. Out from my research on the net, this means the network buffer for socket IO is full or the networking is too busy to do my operation at this moment. However, I have not seen any specific solution which can

c++ CLI Export void return __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention

我怕爱的太早我们不能终老 提交于 2020-07-10 08:18:11
问题 I'm trying to export some void/functions from a C++ Cli that wraps C# .Net Functions. In this moment I can properly export methods that return integer value, but when I try to export a Void, I get the error: Error C3395 'Test2': __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention ClassLibrary1 This is the full code: #pragma once using namespace System; using namespace System::Reflection; using namespace RobinHoodLibrary; namespace ClassLibrary1 { public

std::array or std::vector from pointer

我的未来我决定 提交于 2020-07-10 07:17:17
问题 I have an array of data in a C++/CLI array that I can pass to a native function using pin_ptr<T> , no problem so far. Now, however, I need to pass the array on to a C++/STL function that expects a container such as std::array or std::vector . The easy way of doing this (which I did first), is to copy element by element. The second-easiest way is to call std::copy() , see the answer to this question: convert System::array to std::vector. However, I want to skip the entire copying step and just

std::array or std::vector from pointer

痞子三分冷 提交于 2020-07-10 07:16:04
问题 I have an array of data in a C++/CLI array that I can pass to a native function using pin_ptr<T> , no problem so far. Now, however, I need to pass the array on to a C++/STL function that expects a container such as std::array or std::vector . The easy way of doing this (which I did first), is to copy element by element. The second-easiest way is to call std::copy() , see the answer to this question: convert System::array to std::vector. However, I want to skip the entire copying step and just

What is the most efficient way to convert a std::vector<T> to a .NET List<U>?

≯℡__Kan透↙ 提交于 2020-07-05 02:39:09
问题 What is the most efficient way to convert a std::vector to a .NET List? To give some context, I am wrapping an unmanaged C++ class with C++/CLI. The C++/CLI class holds a pointer to the C++ class and I have a wrapper for each public method. One method returns a std::vector, so in my wrapper I was going to return the .NET class List. I.e. // unmanaged class class A { public: std::vector<int> runList(); } // managed class public ref class A { public: // the below is obviously extremely