FAQ Database Discussion Community


Stackoverflow on calling native c++ from c#

c#,c++-cli
I am trying to call native C++ code from C# project. To do that I followed the steps from this post. But I get a stackoverflow exception when I create a huge array in the C++ file. Here is the code: //CSharpTest.h using System; using System.Collections.Generic; using System.Linq; using System.Text;...

How to fix this Intellisense error (XContainer::Element)

linq,c++-cli
The code bellow generates an error and I don't know how to fix it: XElement^ root = XElement.Load("data.xml"); String^ location; location = root->Element("location")->Value; This is the error: IntelliSense: no instance of function "System::Xml::Linq::XElement::Element" matches the argument list argument types are: (const char [10]) object type is: System::Xml::Linq::XElement ^ How do...

Is it possible to cast a managed bytes-array to native struct without pin_ptr, so not to bug the GC too much?

c++-cli
It is possible to cast a managed array<Byte>^ to some non-managed struct only using pin_ptr, AFAIK, like: void Example(array<Byte>^ bfr) { pin_ptr<Byte> ptr = &bfr[0]; auto data = reinterpret_cast<NonManagedStruct*>(ptr); data->Header = 7; data->Length = sizeof(data); data->CRC = CalculateCRC(data); } However, is with interior_ptr in any way? I'd rather work on...

When does the C++/CLI compiler create which dispose pattern?

c#,.net,visual-c++,c++-cli,dispose
This may sound like a weird question but depending on something the compiler generates different content for the dispose methods in the case of a C++/CLI class extending a C# class which implements IDisposable. (If you are interested in what the dispose pattern looks like I recommend reading this or...

VS 2008 designer failure: HRESULT E_FAIL has been returned from a call to a COM component

.net,winforms,visual-studio-2008,c++-cli,windows-forms-designer
I am using VS 2008 SP1 with some updates, doing SW development in C++/CLI and Winforms. I have one winforms probject, where the designer shows a failure upon opening: HRESULT E_FAIL has been returned from a call to a COM component bei EnvDTE.CodeFunction.get_FunctionKind() bei Microsoft.VisualC.CppCodeParser.OnTypePopulateMembers(Object sender, EventArgs e) bei System.CodeDom.CodeTypeDeclaration.get_Members()...

C++ Generalize delegates

.net,callback,delegates,c++-cli
i have a similiar situation: ref class Manager { delegate void answer1(String^ Message, int Avalue); delegate void answer2(Object^ Obj, double Something); answer1 ^ Callbackfor1; answer2 ^ Callbackfor2; void RegisterCallback1(answer1 ^ Address); void RegisterCallback2(answer2 ^ Address); } How can i manage that in a better solution? I had to create each...

how to write formatted text into a file

winforms,c++-cli,streamwriter
I was trying to write to a file from textbox input with date: Here is a part of the code: DateTime dt=System::DateTime::Now; System::IO::StreamWriter^ history = gcnew StreamWriter("history.txt"); history->WriteLine(textBox1->Text); history->WriteLine(dt); history->Close(); But the output is like this: text 09/02/2015 23:26:07 But I want it to be like: text 09/02/2015 23:26:07 And...

System::Drawing::Bitmap to cv::Mat (OpenCV c++/cli)

c++,opencv,bitmap,c++-cli
I'm trying to convert a System::Drawing::Bitmap into a cv::Mat for what will eventually be a wrapper for c# (can't use EMGU in this case). I've seen lots of examples of how to construct a cv::Mat using a pointer to the Bitmap's data but my cv image is junk (a few...

C++ Using System::String::Split

string,c++-cli
I am trying to split a System::String at ":" using System::String::Split in my C++ code. The string to be split is called "responseString". It is a System::String. I have: char id[] = { ':' }; return responseString->Split(id); However, it errors at the "->" saying that no instance of the overloaded...

C# Namespace not found for DLL

c#,dll,c++-cli,wrapper
Ok, I will preface this by saying I did do a look up and read a lot of similar questions and answers on here before posting this. Background Info Using Visual Studio Professional 2013 Goal: This project is for my own amusement and to try to learn as much as...

Multithreading in Windows Forms

multithreading,winforms,assembly,time,c++-cli
I wrote app, Caesar Cipher in Windows Forms CLI with dynamic linking libraries(in C++ and in ASM) with my alghorithms for model(eciphering and deciphering). That part of my app is working. Here is also a multithreading from Windows Forms. User can chose number of threads(1-64). If he chose 2, message...

How to return data from a BackgroundWorker in c++?

c++-cli,backgroundworker
I've got a BackgroundWorker continually reading data from a USB device. I want to parse that data, then feed it back to my main GUI thread to update a plot and save it to a file. I suspect the way to do this is using ReportProgress, but I'm not sure...

C++/CLI unhandled exception passing 3 or more parameters to delegate

visual-studio-2013,c++-cli
Just stumbled upon strange behavior. I have an unmanaged class (actually wrapper around some native lib): //.h class Wrapper { private: void(*pCallback)(int, int /*, int*/); public: void SetCallback(void(*callback)(int, int /*, int*/)); void InvokeCallback(); }; //.cpp void Wrapper::SetCallback(void(*callback)(int, int /*, int*/)) { pCallback = callback; } void Wrapper::InvokeCallback() { pCallback(0, 0...

C++\CLI - How to set a member function as a handler to xmlDocument::Schemas::ValidationEventHandler

c++,xml,c++-cli
I'm trying to set a member function as a handler to a XmlDocument data member in C++/CLI in Visual Studio 2012. The handler function looks like this... void Validate ( System :: Object ^ sender, System :: Xml :: Schema :: ValidationEventArgs ^ xmlException ) { switch ( xmlException->Severity )...

How to use typeid() on structs

.net,c++-cli
In a CLI project I have a function that takes an Object^ and has to know which type is stored in the Object. My code works well for classes but how to use it for structs ? using namespace System::Drawing; void AddObject(Object^% o_Object) { Type^ i_Type = o_Object->GetType(); if (i_Type...

Simple convert C++/CLI int^ to unmanaged int*

c++-cli,native,managed
This is so basic it should be easy to find. In my searches all I get is more complex solutions. Converting strings, marshaling, pinning objects. How do you simply convert from a c++/CLI int^ pointer to a native int* in C++/CLI. The body of my function is void Open(int ^Hndl)...

Immediate Access Violation when debugging Windows.Devices.Sensors project in Windows 7

c++-cli,interop
I have a large solution with 50+ unmanaged projects in it. I have recently added a project with managed code in it to the solution. The managed code accesses Windows.Devices.Sensors in a .NET dll. This dll is eventually wrapped by unmanaged code and called from another unmanaged project. My problem...

C++/CLI: return a reference to unmanaged object

c#,c++,c++-cli
I'm looking for a way to return the reference to another object that is a member of a managed object. This can be easily achieved in C++, but is a challenge for C++/CLI wrapper to be used with C#. Below is reproducible scenario (it's a lot of code, but it's...

Calling methods in one c++ program from another (Inter Process Communication)

c++,c++-cli
I would like to call methods from one of my c++ programs from another. These methods would have objects that I would pass back and forth. What is the easiest way to accomplish this? It is pretty complex data back and forth. One possible way I was thinking would be...

Array not allowed in class in C++/CLI?

arrays,class,c++-cli
I am getting a C++/CLI array type is not allowed here error when using array type in a class. First I have created a Console application in Visual Studio 2013 and added a new class "MainClass". Then I added a new method. The thing is that I used array in...

basic setup of C++/CLI code so that it can be consumed by unmanaged C/++

visual-studio,c++-cli
I am trying to learn C++/CLI, with the plan of writing a DLL which will be consumed by (unmanaged) C code. However, I cannot get the most basic example to build, as is reproducible below: I am working in Visual Studio Express 2013. Create new project -> CLR ->class library...

C++ check which checkbox is checked in panel

c++,checkbox,c++-cli,panel
can someone please help me with the following problem. When I push the button I need to check which checkbox are checked in the panel. By default all checkboxes are checked. The idea is to have a vector that I store order number of the checkbox that is checked. Code...

Writing a Stream with FileStream without a BOM?

c++-cli,filestream,byte-order-mark
Is there a way to write a Stream with FileStream without a BOM? What I am doing here is first converting an XmlNode to a Stream and writing the stream to a file at some point later. I need it to be in the form of a Stream for it...

NULL undeclared identifier in C++/CLI

c++-cli
In my C++/CLI library, I am getting the compiler error: error C2065: 'NULL' : undeclared identifier Why is this happening? Note: I am setting the value of an unmanaged pointer to NULL, not a managed clr object pointer. I know that I could just define NULL as 0, but that...

c++ clr with ZeroC Ice 3.5.1

c++-cli,ice
I have a need to compile an existing message library generated using ZeroC's ICE with c++ clr. I've been at this for a while and I'm having no luck. I have a very simple .ice message file defined. Upon generating the cpp and h files for this, I try to...

C++/CLI: “ Button^ button1; ” what is ^ meaning here? [duplicate]

class,visual-studio-2012,c++-cli,operator-keyword
This question already has an answer here: What does the caret (‘^’) mean in C++/CLI? 7 answers I created a WindowsForm class in C++/CLI with one button and onClick event. I looked into the source code and saw this: public ref class MyForm : public System::Windows::Forms::Form { public: MyForm(void)...

How to initialize a String^ *

c++,visual-c++,c++-cli
I'm using VS2010, a Visual C++ project. I've declared my var to store some options to be shown in a control: System::String^ * operaciones; Now, in my void InitializeComponent(void), I'm trying to load to this var the options I want to load later. I tried several ways and no one...

Reader only select empty Fields from MySQL-Database - Error Message: The Value cannot be NULL Paramter: Item

mysql,nullpointerexception,c++-cli,database-connection
If I try to select the Database from a MySQL Database I get a Error Message: The Value can not be NULL. Paramter: item (In German its: Der Wert darf nicht NULL sein. Parameter: item) So that means the Reader only select empty fields - he "selects NULL" - but...

Passing by refference from C++\CLI to C++

c++,c++-cli
I have a C++\CLI wrapper to a C++ API of a commercial program. A certain wrapper function looks like this: int ReleaseObject(WDataObject^ object) { return (m_api->ReleaseObject(object->m_object)); }; On the previous version of the API, the C++ side was: m_api->ReleaseObject(const api:DataObject *object) And in the current API version the function has...

Non-managed referenced code strangely, “magically” changes its state for no reason when wrapped in managed

c++,vb.net,visual-c++,c++-cli
I have a very strange problem: My unmanaged third-party library has a class, let's call it Foo which has a method bar() which returns an object of type Bar, like: Foo* foo = new Foo(); Bar bar = foo -> bar(); Now, this Bar has a method which is supposed...

Transmitting/receiving a bitmap with .NET Sockets C++/CLI

.net,sockets,tcp,c++-cli
Im programming for my Schoolproject an Internet/Multiplayer based Drawing Game. So now i need to Program a PictureBox which is always actual with the Servers one. First of all im using a .net TCP Client and Listener which already works(Im sending and receiving some strings). I have 2 static classes...

VS 2013 winform application: how to convert generic object to button type

winforms,c++-cli,visual-c++-2013
i am designing windows calculator on visual studio 2013 using winform application.i want to write a single button handler for the numeric buttons on a WinForms application that simulates a calculator keypad.but in order to do this i must first convert the object^ sender to button type have . already...

Using form and controls variables in not managed class

visual-studio-2010,visual-studio,class,c++-cli,managed-c++
i have a question, how can i use this variables in standart class? Sample ref class test { Button ^x; }; works good, but i need not managed class.. and this not work class test { Button ^x; }; maybe anybody have a solution?...

How to add simple static RTF to a .NET RichTextBox in C++CLI

.net,c++-cli,rtf
I am having trouble adding some basic RTF text to a RichTextBox object I have in my .NET C++CLI Windows Forms application. All I need to do is fill my RTF box with two or three "paragraphs" of STATIC text with some text bold, some italic, and some regular and...

msclr is not being used

c++-cli,clr
So for some reason, msclr is not being used at runtime, I think, for some reason. This is the code: #include <stdlib.h> #include <string.h> #include <msclr\marshal.h> #include "stdafx.h" using namespace System; using namespace msclr::interop; int main() { const char* message = "Test String to Marshal"; String^ result; result = marshal_as<String^>(message);...

Linq in C++ CLI

xml,linq,visual-c++,xpath,c++-cli
I need to get details from a xml file. I wrote code in C# but not able to rewrite in C++/CLI. Code in C# class cROI { public Int16 iX { get; set; } public Int16 iY { get; set; } public Int16 iWidth { get; set; } public Int16...

C# code not catching SEHExceptions

c#,visual-c++,c++-cli
I have a C# application that invokes a managed C++ DLL that deliberately accesses to an invalid address; I enabled SEH Exceptions in my C++ project, I added a _se_translator_function into my C++ code and I also added a signal handler when a SIGSEGV occurs. Using my C++ code from...

Allowing a function to see listbox in another form

c++-cli
I have all my code in my .cpp file. I have a function in there: void funct1 (void) { ... if (num_fields) { for (ix = 0; ix < num_fields; ix++) if (status == OK) checkedListBox1->Items->Add(gcnew String(buffer)); } else checkedListBox1->Items->Add("No available extra data fields"); } However my function cannot see...

Which is the correct form for a C++-CLI copy constructor?

c++-cli,copy-constructor
I have some code like this: MyClass::MyClass(MyClass^ objToCopyFrom); Which is producing an error: 'type' : ref class does not have a user-defined copy constructor When I look up the error, it suggests my code should look like this: MyClass::MyClass(MyClass% objToCopyFrom); My question is therefore, which version is correct or are...

.NET deterministic disposal of a shared object

.net,c++-cli,dispose
When multiple independent queues may hold references to the same managed object, what is a good method of deterministically disposing of that object when all the queues have finished referencing it? Assume the object in question has both managed and unmanaged resources. Note: Calling the Find() function to test all...

Marshal to std::string from System::String^ member of struct handle

.net,c++-cli,marshalling
I am trying to marshal to a std::string from a System::String^. Usually this can be done with the marshal_as<T> template i.e. System::String ^managedString = "test"; std::string stdString = marshal_as<std::string>(managedString); But if the String^ is part of a struct that is accessed by reference i.e. value struct SomeStruct { String ^managedString;...

explicit typecasting of a C# class in C++/CLI

c#,.net,struct,c++-cli,explicit-conversion
I have a "JulianDate" struct that I've written in C#, and it has a custom explicit operator to DateTime from the .NET Library. I've used this explicit operator several times in my C# code and it works with no issues. I now want to use the same explicit operator in...

Hide some methods in ref class

c#,c++-cli,managed,ref
I've a class in Managed C++ which is exposed to .NET environment (i.e. class is declared as ref class and therefore is visible to C# project). And I need one of the public methods of this class to be hidden from C# user. This method will be used to access...

C++/CLI namespace does not exist error

c#,c++-cli
I have a problem with my code writed in C++/CLI. I have an 'WidowsFormApplication': a namespace with this name does not exist error in file Database.h. I tried almost everything, and searched in web for an answer, but i can't. What is wrong with my code? Code is down below....

Developing C++/CLI project for Windows 8 Tablet on Windows 7

visual-studio-2010,windows-7,c++-cli,windows-8.1
I have a code base of native C++. Recently I incorporated a Windows 8 tablet into the system that we deploy to. I have a .NET managed DLL that accesses the Tablet orientation sensor. This managed code is wrapped by an unmanaged class that I can access from the native...

How to return class from c++ code to c#

c#,c++-cli,dllimport
I'm calling C++ method from C# code. Everything works fine except returning multiple parameters back to C#. In my case those parameters are: int x, y, width, height; What I want to do is to return a class or struct from c++ code to c#. I have provided an example...

Should I use a reference or an instance of C# objects in a C++/CLI class?

c++-cli
In a managed c++ class, should I be using a reference or an instance of a C# class that I've implemented in another library? Consider this example: // MyManagedClass.h #pragma once using namespace System::Collections::Generic; using namespace My::Namespace::MyCSharpLib; namespace My::Namespace::MyManagedLib { public ref class MyManagedClass { public: MyCSharpClass myInst; // i...

Is FreeHGlobal() required to free unmanaged string passed in a function?

.net,string,c++-cli,unmanaged
If I have the following piece of code : void foo (String^ v) { WCHAR someString[256]; _tcscpy_s(someString, (LPCTSTR)Marshal::StringtoHGLobalUni(v).ToPointer()); } Would I still need to use FreeHGlobal() in this case? And if so, why? Would the copy function not take care of this global allocation?...

What is the difference between interface and class?

class,interface,c++-cli
In C++ I can make interface and class declarations. However, in contrast to C# the interface here is very likely to be a class so why is it there ? interface Interface { }; And class Class { }; ...

How to return a value from Windows Form

winforms,c++-cli
I created a windows forms application named Project08. It has the files Form1.h, Form2.h and Project08.cpp with some other files. My usage scenario in short is this: When program starts Form1 is displayed. User enters his/her name and clicks a button. When the button is clicked, Form1 closes and user's...

How to find given content of node and modify xml file using C++/CLI

xml,c++-cli
LoginsAndPasswords.xml looks like this: <?xml version="1.0" encoding="Windows-1250"?> <AllUsers> <User> <id>2</id> <login>a</login> <password>a</password> </User> <User> <id>5</id> <login>b</login> <password>b</password> </User> <User> <id>7</id> <login>c</login> <password>c</password> </User> </AllUsers> At first I insert some login name into loginBox. Then before I add...

Typecasting a dynamic type to a static type in C++/CLI

c#,dynamic,casting,c++-cli,type-conversion
I have a function in C++/CLI that accepts a static object, which contains a dynamic field. I would like to use this dynamic field. If the real type of the dynamic field is known during compile time, is it possible to typecast it to the known type? How would I...

Changing the text of a C++ CLI label

c++,c++-cli,label
I am trying to change the text of a label in a C++ CLI program. I need to take a value the the user entered in a textbox, insert that into a short string, then change a label to that string. I have no problem constructing the string, but I...

Creating a Managed C++ interface to use in C#

c#,.net,com,c++-cli,dcom
We have a collection of Native C++ business rules wrapped in C++/CLI and then by a C# layer so we can expose it via DCOM. The Native C++ business rules are in a DLL and are easily invoked in C++/CLI which is in a COM visible DLL. We then add...

C++/CLI and C#: object returns itself

c#,c++-cli
Given a class Object, it's possible in C++ to return a reference to the object itself like: //C++ class Object { Object& method1() { //.. return *this; } Object& method2() { //. return *this; } } And then consume it as: //C++ Object obj; obj.method1().method2(); Is it possible to achive...

Why is destructor for a form called twice?

winforms,c++-cli
This code with entry point calls form's destructor twice. void Main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); MyApp::MyForm form; Application::Run(%form); } I have changed it to void Main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); Application::Run(gcnew MyApp::MyForm); } The second version calls destructor one time only. Why initially was it called twice? ...

Calling C# function from a C++/CLI function

c#,c++,c++-cli,interop,marshalling
My project requires me to use C# to provide a user interface to C++. One of the C++ function I call does a bunch of work and provides periodic progress updates through another "object." Here's a example of what I mean. C++ class AppDelegate : public ProgressDelegate { void AppDelegate::UpdateStatusText(const...

Debug Assertion Failed with rgbConverted.cpp

c++-cli
First saying, It's a duplicate question, but not the same problem. When I run my code, this message is showing, but no error. #pragma once using namespace System::Drawing; ref class rgbConvert { private: System::Drawing::Bitmap^ grayImage; System::Drawing::Bitmap^ bainaryImage; System::Drawing::Bitmap^ rgbImage; int xsize; int ysize; bool **BArray; int **GrayArray; int **binary; FILE...

Static linking does not work with C++/CLI (unresolved external symbol) despite correct options

c,visual-studio-2010,linker,c++-cli
I have 2 projects: a native C project, and a C++/CLI wrapper which will be used to allow the C project to interop with a C# program. Both projects are located in the same Visual Studio 2010 solution. In order to allow for interop, I was planning to have the...

Passing Arguments Through Threads in Windows Form C++/CLI

multithreading,winforms,arguments,c++-cli
I´m really having a lot of trouble to do something that is probably quite simple. Basically, I´m trying to write a Windows Form C++/CLI program to read an arduino stream from a serial port and, at least initially, add each value to a listBox. The Arduino Code is ok and...

Windows Forms C++: Replace dot with comma in textbox input

c++,winforms,input,textbox,c++-cli
I try to tackle very trivial part of problem with autocorrecting users' input to the textbox. I managed to detect whether or not user typed number (as necessary) and control its range. Now I need to autoreplace dots with commas any time user types it into textbox. I expected the...

C# code calling C++/CLI class method - new instance still has old instance values

c#,memory-leaks,c++-cli,marshalling,destructor
I am a newbie in terms of working with both C# and C++/CLI code together. In my C# code, I am creating a new instance of a class FooClass and running a method FooClass:ParseCmdArgs, which takes in a System::String, converts to a std::string, and then pushes to a vector "bars"...

cannot use 'new' on the reference type; use 'gcnew' instead

winforms,visual-studio,c++-cli
I'm trying to use this code: private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { // Displays an OpenFileDialog so the user can select a Image. OpenFileDialog^ OpenFileDialog1 = new OpenFileDialog(); openFileDialog1->Filter = "Images|*.jpg"; openFileDialog1->Title = "Choose Image"; // Show the Dialog. // If the user clicked OK in the dialog and...

VC++/CLI: How to prevent an unmanaged object from being destroyed when it goes out of scope?

c++,.net,visual-c++,c++-cli,interop
I have a third-party unmanaged C++ library which has two classes, let's call them ClassA and ClassB. ClassA has a method, let's call it getTheB(), which returns an instance of ClassB - it does not return a pointer to the instance, but the instance itself. I now wrote a managed...

How to properly store an HWND in a ref class?

c++-cli
I'm working on a C++/CLI library to be used with C#. I have a ref class (for use directly within managed code, so it has to be compatible) that stores an HWND, but I don't think I'm doing it right: public ref class MyClass { protected: HWND hWnd; } Should...

How to declare multiple local variables as empty string of String^ in VC++

c++,string,c++-cli
I have many local variables for example : String a1,a2,a3,a4,a5,a6,a7,a8,a9,a10; I need to declare them as empty string in String^ format. If this string is in C#, It is possible to assign them as below :- string Camnr, Klantnr, Ordernr, Bonnr, Volgnr;// and so on. Camnr = Klantnr = Ordernr...

How to use c/c++ struct in C# code?

c#,c++-cli
I'm using some service that send me byte array using UDP. This service application was developed in C - and this this byte array is a C struct. I know that i can redefine this struct on C# and using the StructLayout attribute to have the same alignment of a...

C++ meaning of String^

c++,string,printing,c++-cli
I'm trying to make a getter for a Label (Windows Form). In myForm.h : public: String^ getLabel1() { return label1->Text; }; But when I try to print it, it won't compile! In myForm.cpp : void Main(array<String^>^args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); Test::MyForm form; Application::Run(%form); form.setLabel1(); std::cout << form.getLabel1() << std::endl; } I...

Ways of generating a digital signature with .NET Framework

.net,visual-c++,c++-cli,smartcard,sign
What's the other way of creating a digital signature using a private key (that's on a smart card, with certificate installed in local certificate store) in .NET Framework other than this one, for I have no clue as to how to find out the key container name (and it seems...

How to read next line in csv file on button click

c++-cli
I have a windows form with two butttons and a text box. My start button reads the first line in the csv file and outputs the data I want into a textbox: private: System::Void StartBtn_Click(System::Object^ sender, System::EventArgs^ e) { String^ fileName = "same_para_diff_uprn1.csv"; StreamReader^ din = File::OpenText(fileName); String^ delimStr =...

Using C callback in C++/CLI

visual-c++,c++-cli,c-api
What I have I'm using Vimba C API, in my C++/CLI application. It's known to work since my mate has it done and running without errors. I've all the imports/include done. I'm using the API without errors, except one. The Manual Says In the manual of the API, there's some...

How to correctly do operator overloading in C++/CLI?

c++-cli
In my class, I have something like this: public ref class Something { public: // some methods operator double(); } Something wraps something from a third-party DLL which has exactly the same operator double() in its header. The compiler now complains about an unresolved token: MyNamespace.Something::op_Implicit How do I have...

Accessing private C++ methods within C++/CLI wrapper

c++,c++-cli,private
Given a class method in C++ that has to be private there, how to make C++/CLI access it. Example: C++ class has a private constructor that shouldn't be exposed to the external user, C++/CLI managed code has to have similar private constructor, but internally it must access private C++ constructor...

Counting time in C++/CLI

c++,timer,c++-cli
I have app, where i must count time of executing part of C++ function and ASM function. Actually i have problem, times which i get are weird - 0 or about 15600. O ocurs more often. And sometimes, after executing, times looks good, and values are different than 0 and...

Find and replace particular words from a Textbox in Visual Studio Express 2013

c++,string,c++-cli,str-replace
Hey guys I just wanted to write a program where I can find and replace words written in an old orthography. For example I have the text: "ads eajifajefaeof daß" and want it to change it to "ads eajifajefaeof dass". So I have 2 textboxes and 1 button. And I...

How to create a folder that contains the current date and time instead of name

winforms,visual-studio-2013,c++-cli
I use C++ Windows Form application in Visual Studio 2013 for one project. I wonder how to create a folder that contains the current date and time instead of name? It is possible to make such folder?? DirectoryInfo^ directory = Directory::CreateDirectory("C:\Users\Desktop\" + ??); ...

C++ int main(int argc, char* argv[]) arguments transform to integer values

c++-cli
The common language runtime support is set to (/clr). When I try to use the argument ( argv[1] ), it returns "true", which is actually not true, as I have a path passed into it as an argument. Can someone kindly help me, as how should I avoid this happening....