( Index )
Month

Brief Information about the June '13 CSIG Meeting

Also, discussions about ... bitcoin

RGBpick and Visual Studio 2012 - Introduction to the latest C++/CLI Compiler


Visual Studio 2012 Experss Demo

Year 2021.. Info for Visual Studio


Note: Application has been compiled with the free Visual Studio Express 2012 compiler.
The source/project may be converted back to an older compiler with this PROCEDURE.
Also, check out this web site for a possible solution to the Form Applicaton issue:
c-cli-template-of-windows-form-application-in-visual-studio-express-2012

Welcome to the CSIG, a Special Interest Group of the ACGNJ. This is an exciting time for the C Language programming since Microsoft now has 4 different language compilers: C++, C++ Express, C-Sharp, and C-Sharp Express. These are all capable of creating Windows (tm) programs. (Some are FREE!)

Here's a brief synopsis of this month's meeting:

The first part of the meeting (after Random Access) will discuss some of the features of the latest Microsoft C++ compiler called Visual Studio 2012 Express. Of course the application will be demonstrated. Next, we will add the missing Template Forms function discussed in the above link. Finally, I will present a small program created with the compiler. The program is called RGBpick. The object is to decipher RGB color values as the cursor is moved around the screen. For example, with a photograph on the screen in any application, the color under the cursor will be identified in the utility as shown below.

Csig1305

The program uses a number of DOT NET Library functions including the following:

C++/CLI Forms Timers Labels
Cursor Position Screen Bounds
Bitmap Graphics Color GetPixel
String Format BackColor delete
Point FromImage CopyFromScreen ToString

There are a number of ways to refer to Microsoft's latest compilers and code. Here's what Wikipedia says:
The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework. The specification defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.

Microsoft .Net Framework 3.5, etc.
C++ 9.0, etc.
.Net 3.5, etc.
CLI
Common Language Infrastructure
Managed


Here's what Nishant Sivankumar (C++/CLI in Action) says:
The role of C++/CLI C++ is a versatile programming language with a substantial number of features that makes it the most powerful and flexible coding tool for a professional developer. The Common Language Infrastructure (CLI) is an architecture that supports a dynamic language-independent programming model based on a Virtual Execution System. The most popular implementation of the CLI is Microsoft’s .NET Framework for the Windows operating system. C++/CLI is a binding between the standard C++ programming language and the CLI.


Sample Code

#pragma once // RGBpick ----------- Color picking application by B.Arnold 5/2013 // // Object: To display the color and the color numeric values wherever // the mouse points. The display is updated ever quarter of a second. // // // timer1 tick ------- land here every quarter second. // Display color sample chip and RGB values. // private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { sender; e; Point p1 = Cursor->Position; this->rgbValue->Text = p1.ToString(); // Display position as fallback. try { // Create an empty bitmap. int xx = Screen::PrimaryScreen->Bounds.Width; int yy = Screen::PrimaryScreen->Bounds.Height; Bitmap ^bmp = gcnew Bitmap(xx, yy, Imaging::PixelFormat::Format32bppArgb); // Fill bitmap from Screen. Graphics ^g = Graphics::FromImage(bmp); g->CopyFromScreen(0,0,0,0,bmp->Size); // Get the pixel color value and display numbers. Color clr = bmp->GetPixel(p1.X, p1.Y); this->rgbValue->Text = String::Format(" {0} {1} {2}", clr.R, clr.G, clr.B); // Change the background color of the chip display. this->ChipSample->BackColor = clr; // Clean up memory issues. delete g; // Dispose of any memory used. delete bmp; // Dispose of any memory used. } catch(...) { ; // Ignore any errors. } }

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page