Questions tagged [c++-cli]

C++/CLI is based on C++, modified to allow compilation of a mixture of native code and code for Microsoft's Common Language Infrastructure (CLI). It replaces Microsoft's Managed Extensions for C++, which aimed for stronger C++ conformance.

Filter by
Sorted by
Tagged with
-4 votes
0 answers
26 views

Connect MySQL with winform c++

Good day. I connect a database to the project, but a strange error occurs. In the settings, everything seems to be registered. //includes #include"pch.h" #include <iostream> #include&...
RedToni's user avatar
-1 votes
1 answer
14 views

Unable to serialize and set DebuggerDisplayAttribute(s) for container class

I'm doing a vector implementation for a project with a custom memory manager with pre-allocated memory chunks, and I have pretty much succeeded in making said vector perform the basic functionalities ...
Herman's user avatar
  • 19
-1 votes
1 answer
28 views

Displaying opencv cv::Mat format in a picturebox (when width is not multiple of 4)

I searched Displaying webcam feed in cv::Mat format in a picturebox and wrote a simple c++ code for display 24bit RGB format in cv:Mat to a pictureBox such as: void ui_DrawPicture(PictureBox^ pbOut,...
user727062's user avatar
-2 votes
1 answer
31 views

Add a external project in CMake, and in the file have a reference to internal projects

I try to run SoftHSMv2 and I want to make this in external project https://github.com/opendnssec/SoftHSMv2 this is the link in git that i download, and I want to add project CLI under src folder. this ...
yael's user avatar
  • 5
-2 votes
1 answer
22 views

Microsoft.CodeCoverage.Console.exe not working for C# code which calls C++

I have a C# project which is calling libraries for C++ projects via C++/CLI. With Microsoft.CodeCoverage.Console.exe I am able to get code coverage for underlying C++ code, however, I can't get the ...
ben yu's user avatar
  • 3
2 votes
0 answers
36 views

GCHandle Allocation in C++/CLI Application with .NET6 causing memory of variable to be corrupted (overwritten)

I have an application which is using an native library (via a C++/CLI Wrapper). I updated this application to .NET6 and suddenly it was behaving strange. I narrowed it down to a rather simple looking ...
JonasH's user avatar
  • 21
-1 votes
0 answers
19 views

Put template functions of a class in separate cpp files in C++/CLI

I have a reference class C defined in header file C.h. It has a function A and a template function B: // C.h public ref class C { public: void A(); template<class T> static void B(...
Haoshu's user avatar
  • 860
-2 votes
0 answers
16 views

C++/CLI: How do I create a delegate?

I have a problem regarding calls from C++ into a .NET assembly. The use case: I have a Windows application written in C++. I want to give users a chance to extend its functionality by writing a .NET ...
h.s.'s user avatar
  • 135
-2 votes
0 answers
75 views

Winforms C++/CLI Icon Resource Not Found

My C++/CLI winforms application is having issues with linking external resorce files. When setting the icon it throws this error: System.Resources.MissingManifestResourceException HResult=0x80131532 ...
ChaoticGooose's user avatar
-2 votes
0 answers
10 views

how to bring up another form if i click one of the buttons in visual studio with C++

private: System::Void signin_Click(System::Object^ sender, System::EventArgs^ e) { if (usernamebox->Text == "admin" && passwordbox->Text == "admin") { ...
arya's user avatar
  • 1
-1 votes
1 answer
26 views

Sorting the SortedDictionary keys using for each

Good afternoon. I have a strange problem. When iterating through the list, SortedDictionary does not recognize the key. Namely, it gives out that the key was not found. System.Collections.Generic....
RedToni's user avatar
-2 votes
0 answers
22 views

One of my projets is .net 4.8 the other claims 4.7 but is not set anywhere

I have a DLL that was made based on 4.8 .net. And I have a project I download from Microsoft a sample (SimpleController) that is confused. In this project I added a DLL as reference and when I build ...
user2144480's user avatar
  • 1,083
-2 votes
1 answer
50 views

How to pass a char *** from C# to native function in DLL

In a C++ dynamic library there is an export method defined as shown below int __declspec(dllexport) __stdcall TCPGetConnectionNames(char *** ConnectionNames) I am looking for an answer on what input ...
steve's user avatar
  • 23
-1 votes
0 answers
28 views

Targeting both .Net Core and Framework for C++/CLI project

I have a C++/CLI project for which I want to target both .Net Framework (net472) and .Net Core (net6.0) with a single project file. But as per the documentation https://learn.microsoft.com/en-us/...
advocateofnone's user avatar
-4 votes
1 answer
30 views

ListBox DataSource Automatic Resetting Doesn't Work With List in C++/CLI

I have a WinForm project in C++/CLI. I use List as a Datasource of Listbox. I defined myList as Datasource of Listbox in mainForm(void). And in UI when user click button1, program add textbox->text ...
Hansov's user avatar
  • 1
-1 votes
1 answer
25 views

Error C3352 (the specified function does not match the delegate type)

I know there are tons of answers to this error message out there, but I failed to find a solution for my problem. I am playing with a function call from unmanaged C++ through C++/CLI into C#. The ...
h.s.'s user avatar
  • 135
-3 votes
1 answer
35 views

C++/CLI projects(compiling fine under .Net v4.7.2 & CLR, giving "Error C3699 '^': cannot use this indirection on type", under /clr:netcore & .Net 6

I'm new to Microsoft Environment, so please accept my apologies if I've posted wrong queries or tags. I've a set of C++/CLI projects that are working fine with .net framework v4.7.2 and /CLR support, ...
user22331912's user avatar
-1 votes
1 answer
37 views

Azure development : Query from storage table can be sorted?

Using Azure Data Table (Azure::Data::Table in C++ CLR) and Microsoft.Azure.Cosmos.Table using TableEntity, I can query the table storage using lines such as this: Azure::Pageable<TableEntity^>^ ...
user2300947's user avatar
1 vote
0 answers
52 views

Passing an ostream for text output from C# to C++ through CLI

I have a function in C++ that writes text into an std::ostream void foo_cpp(std::ostream* log) { (*log) << "foo" << std::endl; } The C++ code is called from C# code using a ...
SIMEL's user avatar
  • 8,745
-2 votes
1 answer
51 views

Managed pointers in .NET 6+

I'm trying to port an existing c++ library to .net 6. I have set the framework version and CLR support flag: <TargetFramework>net6.0</TargetFramework> ... <CLRSupport>NetCore</...
Slack Groverglow's user avatar
0 votes
2 answers
163 views

Use newer dotnet sdk than TargetFramework when building C++/CLI

Is it possible to use a newer dotnet SDK building C++/CLI vcxproj than their target framework? We have a large solution containing C#, C++ and a handful of C++/CLI projects. The target framework is ...
Voo's user avatar
  • 29k
-1 votes
1 answer
71 views

Unable to assigned a member function from a managed class (C++/CLI) to C++ unmanaged class

Unable to assigned a member function from a managed class (C++/CLI) to C++ unmanaged class Hi, I have been working on a project where I developed a ClassA in C++ has a function pointer (...
AlexChan's user avatar
-3 votes
1 answer
30 views

How to return managed this pointer

This is probably a simple noob user-error, And I feel dumb not figuring this out myself. I have some old unmanaged code that I need to convert to managed c++ .net, because I want to Serialize the ...
Natural Number Guy's user avatar
-2 votes
1 answer
49 views

Error when including <msclr/marshal.h> for Winforms project

Good day. I am making a project using Winforms C++/CLI. As of now, I am aiming to write a function that will convert the input of the user from a textbox. And from what I could gather, I am basically ...
Salt StillWaters's user avatar
-2 votes
1 answer
20 views

if (fi->Attributes & System::IO::FileAttributes::Normal),Having bitwise problem

I not sure is CLI support or incomplete. Having bitwise problem. #include "pch.h" #include <Windows.h> using namespace System; using namespace System::IO; int main(array<System::...
teerayut d's user avatar
0 votes
0 answers
24 views

ServicePointManager not initialised when in CLR class library?

I've inherited a CLR class library (.NET Framework 4.7.2) that provides a function which queries table storage in Azure. The function, called from a native C++ executable, is currently failing because ...
Eleco Martin's user avatar
0 votes
0 answers
188 views

Calling C++/CLI code from unmanaged C++ code

I have a C++/CLI unit test project, containing Google tests. I build this project as a dll. I am exporting the following method from the dll: int runTests(int argc, char* argv[]) { ...
advocateofnone's user avatar
0 votes
0 answers
131 views

migrate c++/cli project to .NET 7

There is a C++/Cli solution that contains C+/CLI and some WPF projects. They target .NET Framework 4.8. It's been working for years. We've tried to migrate it to latest .NET 7, but not successed. ...
JhonMalk199's user avatar
1 vote
2 answers
650 views

Changing .NET framework 4.7.2 to .NET Core 6.0 for a C++/CLI project

I have a Visual Studio C++/CLI project which contains some Google unit tests, and the configuration type of the project is Application (an executable). I am trying to build the project by changing ...
advocateofnone's user avatar
-1 votes
1 answer
40 views

return array of system::string

Trying to return an array of system::string I'm new to c++ and I'm trying to return an array of string but seems a little hard. public: array<String^>^ getData() { return {tb1-&...
yes's user avatar
  • 11
1 vote
0 answers
32 views

Why is the address of System::String not changing despite GC running its cycle?

I have the following code that I am using to see the functioning of GC (Garbage Collector). #include <stdio.h> ref class CData { public: System::String^ str; int age; CData(System::...
Marshall Lighter's user avatar
-3 votes
1 answer
24 views

How to return to the begining of file in C++/CLI?

I don't know how to return to start of a file. In C++ I can just close and then open file again. But there is no "read_file->Open()" StreamReader^ read_file = gcnew StreamReader(path + &...
Mefisto1029's user avatar
0 votes
1 answer
61 views

C++/Cli value disposed outside of function

public :void foo() { LPCWSTR bar = stringToLPCWSTR(gcnew String("xddd")); std::wcout << bar; //prints nothing } LPCWSTR stringToLPCWSTR(String^ s) { msclr::interop::...
SussusAmongus's user avatar
-1 votes
1 answer
129 views

Compatibility issues with C++/CLI project when integrating third party dotnet API

I have a third party provider who provide me a set of DLL files as part of their .NET API. They enclose a Python and C# example. I have been using their API via Python (using pythonnet) for a while. ...
Cheeku's user avatar
  • 833
-1 votes
1 answer
167 views

Threading in C++/CLI, CLR

Faced a problem. Need to call a class member method on a separate thread C++/CLI .h: ref class BgWorker { private: void MainLoop(); public: void Start(); }; .cpp: void BgWorker::MainLoop() { ...
Andrii Derevianko's user avatar
-3 votes
1 answer
78 views

Why is this managed array initialization wrong?

I want to declare a managed array because I need to do a search on a ListView but this declaration is wrong and I get these errors: array<ListViewItem^, 128> searchedItems = gcnew array<...
randomizzatore's user avatar
-1 votes
1 answer
128 views

Visual studio 2022 VC++ class wizard new class has a managed option

I am using visual studio 2022 with c++, and I wanted to use the class wizard feature to add a class, when I noticed that in the add class menu there is an unselectable option titled "Managed"...
Tomer Trashman's user avatar
1 vote
0 answers
111 views

List-to-Vector C++/CLI Conversion Function (left of '::' must be a class/struct/union)

I have these dummy C++ classes, which I want to expose in C#: // include/my_lib/Container.hpp #pragma once #include <vector> namespace my_cpp { struct EntryOne { EntryOne(...
Phil-ZXX's user avatar
  • 2,379
0 votes
1 answer
172 views

Converting Managed String to std:string using marshal context

I am aware of the post: Converting managed System::String to std::string in C++/CLI for the required conversion. But I came across the following code which uses marshal_context instead. I am trying to ...
advocateofnone's user avatar
-1 votes
1 answer
59 views

Rotate image in Winforms with C++/CLI

The main task is to make roulette wheel image spinning on a given angle. It does not matter whether it is a plane, picture box or something else, the main thing is that it is possible to turn at a ...
L0mTiCk's user avatar
  • 31
-2 votes
1 answer
66 views

C++ Windows forms function need to accept string value from the TextBox and then return the string value to the label [closed]

In Windows Forms I use 2 textBox. Information from the textBox1 have to become one of the parameters to function encrypte(), that accepts two string parameters and return string value. std::string ...
Sefora Abigail's user avatar
-3 votes
1 answer
136 views

Loading a C# assembly (compiled to a .dll) in VBA

I have an existing codebase of C++/CLI calling C# and want to drive both of these from VBA. The C# code is called from the C++/CLI and works great if I run it all using a simple C++ exe. The problem ...
puredopamine's user avatar
0 votes
2 answers
360 views

How can I build a managed C++/CLI DLL library using CMake?

I need to build a C++/CLI DLL as part of a larger CMake build. I found no preferred way to do this when I checked the documentation. I tried to set up the CMake file for building a regular shared ...
Flovdis's user avatar
  • 2,945
0 votes
0 answers
65 views

C++ CLI lambda expression with handle to managed object

I'm trying to convert he following C# code to C++/CLI // create the output bitmap var bitmap = new SKBitmap(); SKImageInfo info = new SKImageInfo(); info = new SKImageInfo(input.Width, input.Height, ...
MrEighteen's user avatar
-1 votes
1 answer
49 views

Mfc invokes onsize event of embedded wpf control

I embedded a wpf control to an mfc app using Hwndsource and c++cli technology. SiteToContent was setted to WidthAndHeight. A wrong resize occures on different computers. When mfc control is created, ...
Vitaly's user avatar
  • 5
-2 votes
1 answer
215 views

Call nested .NET dll from C++/CLI Visual Studio project

I'm trying to call a DLL-method from my C++/CLI code in Visual Studio a .NET-DLL (v4.5) called "LicenseCheck.dll". This works fine until this DLL is trying to access another .NET-DLL called &...
Felix D's user avatar
  • 33
-1 votes
1 answer
172 views

Call .NET dll from C++ code failes when calling GetProcAddress(...)

I want to call a method of .NET dll (v4.5) from C++ code. This dll uses a third party dll (SKCLNET .NET v1.0) I build a simple C++ code for that (see below). The problem is that GetProcAddress(...) ...
Felix D's user avatar
  • 33
2 votes
1 answer
108 views

Forward C++ Exceptions from CLI to C#

I am wrapping a C++ library via CLI into C#. File from C++ Library: /* cpp_lib/Date.hpp */ namespace cpp_lib { struct Date { Date(int year, int month, int day) { ...
Phil-ZXX's user avatar
  • 2,379
1 vote
1 answer
532 views

C++20 support in C++/CLI and alternatives

I was wondering if anyone knows about a timeline or expected release for C++20 support in C++/CLI. According to this answer in the microsoft developer community support is in development, but i couldn'...
user avatar
-2 votes
1 answer
52 views

pass a control name as a variable and then hide a control using that variable

I'm building a function that will receive the name of a (in this case) FlowLayoutPanel as variable showme and I want to use this variable to set that particular panel visible. ps I am new to c++ ! Any ...
Mark Seddon's user avatar

1
2 3 4 5
124