Click here to Skip to main content
15,887,334 members
Everything / CLI

CLI

CLI

Great Reads

by Greg Utas
Automating help, validating user input, running scripts...
by paladin_t
A guide about how to mix native and managed code in one solution
by matt warren
How the .NET CLI tooling runs your code
by Fedor Dzjuba
Client and a WebAPI to execute MDX query against SSAS and display a resulted cellset in a pivoted grid form with Axis neatly arranged in a hierarchical and grouped manner.

Latest Articles

by optiklab1
Exploring world of NFTs and blockchain while prototyping wallet CLI application with efficient data structures using C# and .NET Core
by Bhargav Technical Lead
Angular migration to version 16
by Greg Utas
Automating help, validating user input, running scripts...
by Fedor Dzjuba
Client and a WebAPI to execute MDX query against SSAS and display a resulted cellset in a pivoted grid form with Axis neatly arranged in a hierarchical and grouped manner.

All Articles

Sort by Score

CLI 

9 Mar 2022 by Greg Utas
Automating help, validating user input, running scripts...
26 Jan 2012 by paladin_t
A guide about how to mix native and managed code in one solution
21 Aug 2012 by Rahul Rajat Singh
refer these:run-time polymorphism VS compile-time polymorphism[^]http://stackoverflow.com/questions/673721/overloading-and-overriding[^]
21 Oct 2011 by Sergey Alexandrovich Kryukov
Yes, this is well-known problem — C++/CLI is very different. Solution is also well-known, but it might look very unusual: not only you are not allowed to do the check like if(OnCppCliEvent != nullptr), you also never need it!In other words, just delete this check — the code will...
3 Feb 2012 by domace
In your experience, are there any performance differences when using CLI/C++ across different versions of the .NET runtimes? Recently we have upgraded an application to .NET 4.0 and we believe the performance of this layer has been negatively effected. Are there some patterns of programming this...
28 Nov 2013 by CPallini
Yes, it is possible, we call it Inter-Process Communication (IPC)[^].
25 Dec 2011 by arielb
Use this://A_wnd.h#ifndef A_H#define A_H#include "B_wnd.h"class B_wnd;class A_wnd{ public: B_wnd* m_b;};#endif//B_wnd.h#ifndef B_H#define B_H#include "A_wnd.h"class A_wnd;class B_wnd{ public: A_wnd* f;};#endif2 important...
21 Aug 2012 by Sunil Kumar Pandab
Of course Yes dear, Both overloading and overriding achieve polymorphism. And even in c# there is another concept introduced with them, that is Method Hiding.static polymorphism :- overloading dynamic polymorphism :- overriding and Method Hiding
26 Sep 2012 by Kuthuparakkal
I think you are reverse engineer something and used ILDASM to get IL code. My suggestion is to use directly decompile your app or dll using dotPeek(opensource, free decompiler).http://www.jetbrains.com/decompiler/[^]
9 Apr 2014 by Sergey Alexandrovich Kryukov
In the code fragments you show here, you are not redefining anything. Moreover, you don't have the definition of the class N::Class, not even a declaration of it is shown. The class Class is a different class, Usb::Class, it does not create any name clashes. That is, instead of showing two...
10 Sep 2016 by matt warren
How the .NET CLI tooling runs your code
7 Jan 2020 by Fedor Dzjuba
Client and a WebAPI to execute MDX query against SSAS and display a resulted cellset in a pivoted grid form with Axis neatly arranged in a hierarchical and grouped manner.
25 Dec 2011 by #realJSOP
That's a circular reference, and you can't do that. Refactor your code.
25 Dec 2011 by BrainlessLabs.com
#include"B_wnd...
24 Jan 2012 by vaibhavbvp
simply us the getcommandline() function this fucntion stakes the argumnets from the comandline,and acc u could use them.
3 Feb 2012 by Manfred Rudolf Bihy
I've no (well for practical purposes as near to zero as one can get ;)) experience regarding the language CLI/C++, but I can confirm this happening when we moved from .NET 1.1 to .NET 2.0 six years ago. There were some cached DataTables involved and in .NET 1.1 everything worked like a charm....
26 Sep 2012 by Andrewpeter
I need a tool which converts IL code to C# code, where is it? Thanks.
14 Jan 2013 by user_code
Hello,I have a HWND in my C++ MFC code, and I want to pass this HWND to a C# control and get it as IntPtr.What Is wrong in my code, and how can I do it correctly?(I think it's something with wrong using of the CLI pointers, because I get an error that it cannot convert from...
13 Oct 2015 by Sergey Alexandrovich Kryukov
First of all, please see my comment to the question.If those C++ projects are yours and you have the source code, the best way to create a CLI wrapper would be migrating your projects from C++ to C++/CLI. This way, you can create mixed-mode modules (managed+unmanaged) of dual purpose: they...
8 Jan 2017 by OriginalGriff
It's not as simple to do as a console app, but it's possible - a lot of work though.What I'd suggest you start with is by creating a basic WinForms app in C# - one button, one text box: press the button and the text box content goes into a MessageBox. Build it and look at the IL that it...
31 Aug 2017 by CPallini
Some info here: Interactive Console Applications in Java[^].
19 Feb 2018 by phil.o
Your problem does not seem to be in the structure declaration, but rather where you try to use it. The code you showed does not hold any cfg identifier. Find this identifier in your code, you most likely forgot to terminate one of your statements with a semicolon.
2 Jun 2020 by KarstenK
This is a tricky issue and best is to avoid the pitfalls like handling strings not properly. They arise because VB 6 is some legacy language and so to be handled with much care. And: VB.net works completly different, a bit more like C#. I...
18 Jul 2021 by Daniel Pfeffer
Working backwards from the numbers that you give, we get 1 block = 100Mb / 22355 = 4473 bits. This looks close to a 4 Kb (i.e. 512 byte) block size. Adding various header and framing bits make the correspondence even better. I expect that you...
9 Jan 2022 by CPallini
In order to call the path() method in your measure.cpp source file, you need to: include form.h in measure.cpp. call it on a instance to the MyForm class (because it is a method, not a standard function). In order to get better help, you...
30 Aug 2022 by CPallini
Quote: serialPort1->Write(dateS, 0, dateS->Length); cli::array^ byts = gcnew cli::array(dateS->Length); serialPort1->Read(byts, 0, dateS->Length); Just a wild guess (you post omits significant details): you are...
25 Apr 2020 by Member 14686752
I have C# as my front end application and I want to call c++ dll from my c# but I am getting error. I am posting my code here please help me out how to resolve this: Program.cs using System; using System.Runtime.InteropServices; using...
21 Oct 2011 by DLChambers
In C#, one can define an event delegate & handler thusly:class SomeClass{ public delegate void SomeEventHandler(object sender, int n); public event SomeEventHandler SomeEvent; public void RaiseEvent(int n) { if (SomeEvent != null) SomeEvent(this,...
25 Oct 2011 by L_Coelho
Hi, I got a WCF service working with callbacks. Everything works fine when I pass an integer to wcf service, and then the service call back to client another integer.But when I try to pass a complex type, like List to WCF service, the service cannot call back the CLient.Anyone has...
25 Dec 2011 by vaibhavbvp
Hi AllI am facing a problem.let suppose i have two classes.class A and class B.in class A i defines the object of class B,and in class B i defines the object for class A.When i try to run the code it show the error that to place a semicolon before the classA .the code is something like...
19 Jan 2012 by vaibhavbvp
Hi alli am stucked in a problem.i want to pass some variables values from a program to a mfc dialog based exe...the number of arguments that i want to pass is 3.is there any way by which i can pass these three arguments into the mfc based exe..really i am in a urgent need...
3 Feb 2012 by Philippe Mori
First you have to verify what security checks are performed. Generally, the performance of STL or STL/CLI is relatively bad in debug version as a lot of validation is done.That problem also mainly occurs when the application is run under the debugger.In Release version (and the...
3 Feb 2012 by Rajesh Anuhya
See this Discussion alsohttp://journal.stuffwithstuff.com/2009/01/03/debunking-c-vs-c-performance/[^]http://stackoverflow.com/questions/686483/c-sharp-vs-c-big-performance-difference[^]CP articleHead-to-head benchmark: C++ vs .NET[^]Thanks--RA
14 Mar 2012 by RedDk
/*Simple 256 x 3 array with data of type string containing reps of numericalTrying to write to console converted value but filter only one of the inner loop's cycles. Why can't the use of "if(rs = 0)" do the filtering?*/using namespace System;using namespace System::IO;using...
21 Mar 2012 by m0rTu
Anyone knows why methods from a ref class written in CLI actually get "remodeled" when you import the dll in c# ?ManagedFoo FOONET::ManagedFoo::divide(ManagedFoo % ac_OtherFoo)gets changed in :void divide(ref FOONET.ManagedFoo value, FOONET.ManagedFoo ac_OtherFoo)the first is in my...
21 Mar 2012 by S@53K^S
I guess that is due to the language interoperability.I believe that the first one is written in C++ style,so when it comes to C# style of passing parameters it changes accordingly
1 Apr 2012 by Adnan Merter
hi all,i need to find out how i can declare a global object which can be accesible from all functions of the same application.i created a global serialport object :System::IO::Ports::SerialPort^ serialPort = gcnew SerialPort(L"COM4" , 300, Parity::Even , 7, StopBits::One);then,...
1 Apr 2012 by Sergey Alexandrovich Kryukov
.NET does not have a concept of global objects (finally, thanks goodness!). Instead, you can have a static member of some managed "ref" class or structure.Formally, this solves your problem. But even this is not good enough, would be the sign of bad coding style.There are two ways of...
29 Nov 2012 by Qizhong Yang
Currently I need to load a C lib into my CLR project(managed c++/CLI).All the header file and lib file have been added. But when compile the project, there are some errors and warning like below:Errors:error LNK2001: unresolved external symbol "extern "C" int __stdcall...
24 Apr 2013 by Philippe Mori
For readability, you should avoid calling an event handler to execute common code. If same code is used from many place, then declare a function and call that function from both event handlers.That way, you know that an event is called from a "real" event and the expected one. That is, an...
9 Sep 2013 by Zaraki21
Good morning,I am working on a project which use C# code, a C\CLI wrapper and C++ code. Actually, I have to call an managed function inside a C++ function.My function in C++ has this prototype : void TestArray(float** array1, int numRows, int numCols);Inside this function I call...
9 Sep 2013 by E.F. Nijboer
This article with code example may be of interest to you:Unmanaged Arrays in C# - No Problem[^]Good luck!
28 Nov 2013 by RORVI
Would it be possible to use two CMD windows to display a matrix that is inserted by the user from the keyboard without memorizing it ?. What i would like to achieve is to be able to switch between the two CMD windows in the following way : insert data in the first one and display the numbers...
28 Nov 2013 by KarstenK
The eventhandler shoul look like thisstatic void OnSpeechRecognized(object sender, SpeechRecognizedEventArgs e)read here from more information http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognitionengine.speechrecognized(v=vs.110).aspx[^]
17 Jan 2014 by bling
Solution 1 works as long as the child process doesn't manipulate the console API directly.
24 Feb 2014 by Member 2036792
Well, not always. Processes behave differently if they intend to write to console. ftp.exe, for example will just not write anything (except errors) if it can't WriteConsole.
3 Apr 2014 by Member 10722835
Hi Coders,Do you think it is possible for a programmer to write a program/plugin to get an output from a software task. Let me explainFor instance autoruns from sysinternals of microsoft outputs are displayed inside the software's GUI. So what I was thinking is writing and making some kind...
13 Oct 2015 by Maddie from Dartford
I have three C++ projects under one solution file and each project has multiple C++ files. I need to write C++ CLI wrapper so C# application can access functionalities of C++ classes.I have created managed dll project with one class which is mocking all functionalities of one C++...
16 Oct 2015 by Sergey Alexandrovich Kryukov
It's a bad idea to rotate anything in PictireBox. You need to rotate image, not control, which won't help you at all, will only add hassles and waste some resources giving nothing in return. Instead, render the image directly in your control, which could be a custom control or even something...
20 Oct 2015 by Jammes_Ca
Hello i want to create a c++ dll and call it on a c# project. i saw a lot of video and tutorial but i did'nt find the solution.i want to make a dll of this project Joystick Driver Project[^]and use all thos function on a c# project Please help
27 Oct 2015 by KarstenK
You must fetch the image from the camera and display it on a GUI. Here is an outstanding article CXImage which handles a lot of image processing tasks.
27 Oct 2015 by Sergey Alexandrovich Kryukov
I did not see your search, but you either looked in wrong place, and, most likely, used too narrow search criteria. If you are using C++/CLI, the article or answer using any CLI language would suite you; note that most publications are written using C#. Also, you need to understand that...
9 Nov 2015 by Maddie from Dartford
Hello,I have gone through many article but still looking for answer of my question. I have written c++ wrapper class which has one function like this:void ManagedWrapper::ReadFile(String^ licFile){ ReaderClass reader; unsigned char readFile[5000]; reader.readLicFile(readFile);...
10 Nov 2015 by Kornfeld Eliyahu Peter
One of these will do the work for you...https://msdn.microsoft.com/en-us/library/ttyxaek9(v=vs.110).aspx[^]https://msdn.microsoft.com/en-us/library/744y86tc(v=vs.110).aspx[^]
30 Jan 2016 by Member 11856129
I didn't rush anyone. I got an immediate smart-ass reply from Mehdi Gholam. It's obvious you don't want to help me, because you already deleted my question. Take me off your mailing list. I'M THROUH WITH THIS WEBSITE.
30 Jan 2016 by OriginalGriff
Sorry to hear that - but you might have got an answer if you had had a little patience, as I suggested when I deleted your question that consisted of:Recently submitted question IS IMPORTANT, TO ME. But all the times I have asked for help, I have not gotten any replies with the answer. Maybe...
1 Feb 2016 by Member 10657083
How does one implement the background worker in C++, for something like a cpu meter that runs constantly.
1 Feb 2016 by CPallini
Let me search for a tutorial... "C++ Tutorial: Using of BackgroundWorker Component in C++/CLI | Free source code, tutorials and articles"[^].
29 Mar 2016 by Sergey Alexandrovich Kryukov
Please see my comment to the question.C++ is unique language in this respect. You can use regular P/Invoke .NET API, but it's really beneficial to use mixed-mode projects where you can freely mix managed + unmanaged. Please see:Calling Native Functions from Managed Code[^],Using C++...
11 Aug 2016 by ricksmitchina
Hi... I'm new in the world of c++, im creating a c++ CLI form with a listview on which is populated at runtime in the "Load" event... now i hav come so far as to make the list able to show a message box when i double click the listview item...but heres my question....How do i get the message...
11 Aug 2016 by Richard MacCutchan
See ListView.SelectedItems Property (System.Windows.Forms)[^].
31 Aug 2017 by Member 13387945
I was hoping someone could introduce me to a Java Graphic User Interface Command Line library. Something like nano,vi or a typical (windowsXP/RedHat no GUI install) sort of frame work. Colors and everything. I can use arrows keys to change values etc. I don't want to System.out.println() and...
31 Aug 2017 by Member 13387945
GitHub - mabe02/lanterna: Java library for creating text-based GUIs[^]
19 Nov 2017 by Maximilien
I have a ref class to hold data in a Managed C++ DLL. The type (Stuff::Manager) is from a 3rd party .NET DLL. Question is in the comment in the code block. ref class MyDataClass { public: static Stuff::Manager^ m_Manager; /// ... } With pseudo-code ... void f() { Stuff::Manager^...
6 Nov 2017 by KarstenK
When it is in the same app than you best use C# interop and make a call by using the jason as string parameter. Read my article and code Calling all stations. If it are different apps it gets a bit difficulter. Writing an temporary file or shared memory is best for on the same machine.
19 Nov 2017 by Mikhail Semenov
manager is a pointer and since it's managed .NET code you don't have to worry about disposing it. It will be done automatically.
24 Jan 2018 by VR Karthikeyan
Hello, I hope the following discussions will help you, 1. Is there a performance difference between WPF and Winforms? - Stack Overflow[^] 2. Performance | Microsoft Docs[^] 3. WPF vs Windows Forms | Tales from a Trading Desk[^]
19 Feb 2018 by Vishal Bhatia0112
Hello All, It's an C++/CLR project. I have below structure in my header file: value struct CONFIG { System::String^ Exch_Feeds; System::String^ Exch_Type; System::String^ Feeds_Type; int Feeds_port; int Max_Users; int IML_port; System::String^ Interface_IP; System::String^...
13 Mar 2018 by ashish121095
I am new to C++/Cli so bare with me. so, I have node class (page3_node.h), page3.h (form page) and page3.cpp which consists implementation of page3_node.h. my problem is I am trying to access methods of page3_node.h into page3.h but I am not able to do it. Any help is greatly appreciated. ...
7 Aug 2018 by Member 13703287
C++/CLI Function I am generating Hash key using C++/CLI and Sending Data and Hashkey Over network to Other Application which is Java But Java Application HashKey Generated is different. Any Idea where i am going wrong? Thanking in Advance. char* EncodeData(char* ap_key, char* ...
4 Apr 2019 by Member 14150165
I'm new to managed C++, dealing now with a C++/CLI project which involved function calling from native DLL for results to be displayed via WinForm. An expected exception is encountered when calling function from native DLL due to missing equipment for the project. However, instead of...
5 Dec 2019 by LorenzoGorza
Issue to link c++ opencv project with c# console app. What I have tried: I try to develop a wrapper to link a library of c++ class of image processing methods to a c# console project. In the c++ console app one I've create a class with the opencv include in its header #include...
16 Dec 2019 by SIDHARTH S
Is it possible to call the function int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("Window"); glutDisplayFunc(display); ...
16 Dec 2019 by Rick York
No, one should not call main from anywhere. It is the designated entry point for CLI programs. For GUI programs in windows the entry point is WinMain. This is a bit confusing. How is it you have a button in a window with a CLI program? If you want to learn how to use OpenGL in a WinForms...
14 Jan 2020 by Piraisudan
I have a win32 project, I am calling my exe using following command in command prompt. "MyApp.exe /Print" If I execute above in command prompt, I want to display "Welcome to MyApp" in the same command prompt window. I am able to get the given command line using CWinApp, but I cannot able to...
14 Jan 2020 by W Balboos, GHB
If cout fails you, take the extreme route. Do a stream write to stderr. I haven't done the above since my DOS days but the typical rule was that both stdin and stdout (and thus, possibly cin and cout, for you) can be redirected but stderr could not.
14 Jan 2020 by _Asif_
It's easy and a good example can be found here Visual C++ Enable Console - Stack Overflow[^] Do a little search and you will find plenty of examples more.
14 Jan 2020 by Richard MacCutchan
I just tried your code and it works fine. You need to provide more details of your exact code and environment.
25 Apr 2020 by OriginalGriff
The first problem is that DisplayHelloFromDLL is an instance method of the test class - which means that just like the C# equivalent: public class test { public void test() { printf("This is default constructor"); ...
25 Apr 2020 by KarstenK
Your import statement is missing some important details. And dont use the full path for the import but locate the dll in the directory of the app. Read my article and code about C# interoperbility Calling All Stations and compare the difference...
6 Jan 2021 by Demetri K.2
I've got a test task that requires to write a basic app with CRUD functionality (a list of visitors), but all the user input and app output has to go through the command-line interface. Everything has to be done in raw php. If anyone could...
6 Jan 2021 by Richard MacCutchan
You can learn about readline at PHP: readline - Manual[^]. Search from there for the print command to send your output to the console.
2 Apr 2021 by wifinut
I'm looking for a method to obtain my provisioned ISP bandwidth via shell script. To be clear, I'm not looking to do a speed test. My goal is the following: 1. Get my provisioned bandwidth (up/down) 2. Run a test to obtain the percentage of...
2 Apr 2021 by Dave Kreskowiak
The only way to get your bandwidth is a speed test. There is no information stored on your machine or any standard method on the internet to get your provisioned bandwidth.
1 May 2021 by dj4400
I am looking for an example or a walkthrough for creating a c++/cli wrapper for a c# dll to be used (loaded statically/dynamically) in an unmanaged c++. I found examples of a wrapper for the other way around (c++ dll to be loaded in c#) but none...
1 May 2021 by OriginalGriff
See here: Calling C# .NET methods from unmanaged C/C++ code[^]
16 Jun 2021 by Member 15248812
Hi guys, my aim is to capture the screen of a windows form using c++/cli. Below is the code to capture the window, however, it is in C#. What changes do I have to make to the code for it to work in c++? Graphics myGraphics =...
16 Jun 2021 by OriginalGriff
You are treating the class name as a pointer by using the -> operator to dereference a static member method. Try this: Graphics^ memoryGraphics = Graphics::FromImage(memoryImage); If you had gone to the MS documentation and selected C++ as the...
18 Jul 2021 by wifinut
I'm trying to add a speed test to my BASH script. I know you can install speedtest-cli on the host, but this is not an option. I'm looking for options perhaps using the CURL command. What I have tried: I tried using a CURL command to obtain the...
16 Sep 2021 by sam_lima10@yahoo.com.br
My regards to all: Does anyone around here know if it's possible to use some Win32 functions in C++ CLI? I'm interested in using them, mainly this one: TextOut ( hdc, 140, 10, L"Help if possible", 20 ); What I have tried: ...
16 Sep 2021 by CPallini
Have a look at Calling Native Functions from Managed Code[^].
9 Jan 2022 by WantToLearn1
Made a GUI with Visual Studio. Trying to pass a string to another cpp file but it's difficult. I have tried extern std::string but it's always empty for the measure.cpp file. Extern int is working fine. Then I tried to make function inside to...
12 Mar 2022 by k5054
You need to give a command for sudo to execute: # sudo with no command given [k5054@localhost ~]$ sudo -S usage: sudo -h | -K | -k | -V usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user] usage: sudo -l [-AknS] [-g group] [-h host]...
7 Jun 2022 by gsegria
I am investigating how to find out physical address from start offset to end offset. For example: 1) There is a 70GB storage. (F:\) 2) There are four 17GB files. 17GB-1.bin, 17GB-2.bin, 17GB-3.bin, 17GB-4.bin 3) copy 17GB-1.bin, 17GB-2.bin,...
28 Jun 2022 by code_pop
Hi all. I'm using the C++/CLI dll on the C# WinForm project. To pass from the native code's exception message to C#, I have written the code as below. #include "pch.h" #include "ClassLibrary1.h" using namespace ClassLibrary1; void...
30 Aug 2022 by Richard MacCutchan
Your code assumes that the remote device will send all its data in a single burst according to your read command. However this is not how serial I/O works. It is an asynchronous process and characters need to be captured as they are received in...