( Index )
Month

 

Brief Information about the March 2016 CSIG Meeting

Review of Languages Shootout + Other Topics ......    by B. Arnold

NEWS:   http://www.techsupportalert.com/content/microsoft-visual-studio-now-free-non-commercial-use.htm

(General Csig Info)   

                                     

Welcome to the CSIG, a Special Interest Group of the ACGNJ. This group is a "Special Interest Group" of the ACGNJ devoted to discussing programming languages in general and C, C++, and C++ for Windows programming in particular. Each month a small but hopefully useful program (complete with source code) is presented for discussion.

This month's topic will be several reviews plus an update on a discussion that we had several months ago about using a Web Servers as a destination for a C++ or C# logging application. I will present a very tiny application written in C# and PHP for logging.  The C# code is assumed to be contained in a much larger application program that located (let's say) in Nova Scotia on a client's desktop computer. The PHP code is assumed to be on a web server in Montreal, Canada.  I'm here in New Jersey and I want to access the log information on the server. I'll present some code that could do it.  I'll also challenge the audience to come up with other techniques.

  Brief summary of code.


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 4.5
C++ 9.0, etc.
.Net 4.5, etc.
CLI
Common Language Infrastructure





Sample Code from Previous Meetings

namespace Crop
    {
    public partial class Form1 : Form
        {
        public Form1()
            {
            InitializeComponent();
            }

        ////////////////////////////////////////////////////////////////////////////////////////////
        //
        //   Suffix _SC = Screen Coordinates
        //   Suffix _CC = Client Coordinates
        //
        Rectangle cropRectangle_CC;
        Point startPoint_CC;
        bool isDrag = false;
        bool fileChanged = false;

        ////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Drag and Drop step 3 of 3.  The users releases the mouse to drop the image.
        //
        private void Form1_DragDrop(object sender, DragEventArgs e)
            {
            if (fileChanged)   // Prompt user.
                {
                //  Title = Bad Result     //  Default Button = No     //  Message = Caution
                System.Windows.Forms.DialogResult Result;
                Result = MessageBox.Show(this, "Cropped Image will be Disregarded! Continue?", "Drop New File",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (Result != System.Windows.Forms.DialogResult.Yes) return;
                }
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                if (this.pictureBox1.Image != null)
                    this.pictureBox1.Image.Dispose();
                // Get a list of filenames but use only the 1st name.
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                if (files.Length > 0)
                    {
                    files[0] = files[0].ToLower();
                    if (files[0].EndsWith(".jpg"))
                        {
                        try
                            {
                            this.pictureBox1.Image = Image.FromFile(files[0]);
                            imageData.Text = String.Format("{0} x {1}", pictureBox1.Image.Width, pictureBox1.Image.Height);
                            fileChanged = false;
                            this.pictureBox1.Visible = true;
                            }
                        catch (Exception ex)
                            {
                            MessageBox.Show(ex.Message, "E R R O R"); return;
                            }
                        }
                    }
                }
            this.Activate();
            }

        //  Drag and Drop step 2 of 3.  The users drags the image into the program's GUI.
        //    Note: Step 1 is Form1 AllowDrop property has been set to true.
        //
        private void Form1_DragEnter(object sender, DragEventArgs e)
            {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = DragDropEffects.Copy;
            else
                e.Effect = DragDropEffects.None;
            }


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