( Index )

Brief Information about the September '09 CSIG Meeting

Tphoto - Photo Title Creator
B. Arnold


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 the coming meeting:

Object Oriented Programming (OOP) languages like C++ have special characteristics. Two very important ones are "Inheritance" and "Polymorphism". We discussed Inheritance at the June meeting. We will get back to the subject at future meetings, but for September I plan to start with something simpler. It's a graphic program that displays a photograph and a small text based data file containing photo titles.

The program developed because I was creating a slide show with 846 photos. A simple text file called "Subject.txt" contained the titles of each photo. (You can see the text file at the left side of the screen shot.) I used notepad to edit the text file but quickly became exhausted when I constantly had to correlate the photo filename with the title. Hence, the new application called Tphoto. We will discuss the code for this program at the meeting. It uses Microsoft Visual C++ 2008.

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
C++ 9.0
.Net 3.5
Common Language Infrastructure

Sample Code

             // Show the image on the screen.
private: System::Void Photos_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
             e; sender;
             if (Photos->SelectedIndex < 0) return; // avoid crash!
             String ^lineBuff = gcnew String(Photos->SelectedItem->ToString());
             String ^ imagefile = gcnew String("");
             CurrentString = lineBuff;                              // Global Memorize new data, filename + tltle
             array ^delims = {'\t'};
             array^ token = lineBuff->Split(delims);
             CurrentIndex = Photos->SelectedIndex;                  // Global Memorize new index.

             if (token->Length == 0)
                pictureBox1->Image = nullptr;
             if (token->Length > 1) title1->Text = token[1];        // Initialize Text Box
             else title1->Clear();

             imagefile = CurrentPath + token[0];
             pictureBox1->Image = Image::FromFile(imagefile);
             pictureBox1->Image = nullptr;

		 // OK button pressed. Copy the new title into the listbox.
private: System::Void button_ok_Click(System::Object^  sender, System::EventArgs^  e) {
             e; sender;
             String ^lineBuff = gcnew String(CurrentString);
             array ^delims = {'\t'};
             array^ token = lineBuff->Split(delims);
             CurrentString = token[0];
             CurrentString += "\t";
             CurrentString += title1->Text->ToString();
             Photos->SelectedIndex = CurrentIndex;
             dbDirty = true;

	// The SAVE button was pressed.  Save the file to the hard drive.
private: System::Void Save_Click(System::Object^  sender, System::EventArgs^  e) {
             e; sender;
             Save->BackColor = Color::Blue; Save->Update();
             Save->BackColor = Save->DefaultBackColor; Save->Update();

         String ^CurrentString;
         String ^CurrentPath;
         int CurrentIndex;
         bool dbDirty;


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