( Index )
Month

Brief Information about the Feb '09 CSIG Meeting

Snap Windows and Registry Handling
B. Arnold

Snap Windows and Registry Handler

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.

This month I will discuss several concepts that can be added to your programs. The first is a program that handles the screen in a manner similar to the popular sound program WinAmp. The similarity is the user interface that allows it to snap into position at the corners of the screen when the user moves the window. It ´ s called SNAP DEMO and the code can be used in any program.

The second snippit is called REGISTRY DEMO. It works like this. A simple window opens with 3 buttons, a listbox, and a textbox. When a folder location is typed into the textbox, and the GET FILES button is clicked, the file listing of that folder is displayed in the listbox. The folder location may then be saved permanently in the REGISTRY by clicking on the PUT REG button. This code was inspired by a user of last months program, Bmailer. The user said that he was tired of entering the smtp server address everytime he used the program.

These programs will provide a means to discuss C++ programming in a Visual Studio enviornment. Here are some of the topics that are included in the discussion.

1. Building an application using Visual Studio 2008 SP1.
2. Building a "CLI" .Net program.
3. Using the Integrated Editor to create Buttons.
4. ... Listboxes and Textboxes.
5. Adding a photo background.
6. Program logic.
7. Handling the Registry.

Additional Topic during Random Access

It has been suggested by members that we also discuss competing products instead of Microsoft. This is not always possible because I try to use products that are available to all members. ie. free. However, I have noticed a development system that is becomming quite popular on other operating systems and has been partially converted or "ported" to windows. It's called MONO DEVELOP. I will present a short demonstration using C#. For more information see:
1. Sun VirtualBox at www.sun.com

2. Ubuntu Linux Operating system at www.ubuntu.com

3. Mono Develop at http://monodevelop.com/Main_Page


There are a number of ways to refer to this compiler 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
CLI
Common Language Infrastructure
Managed

Sample Code

private: System::Void getFilesButton_Click( System::Object^ sender, System::EventArgs^ e) { if (folderName->Text->Length == 0) { MessageBox::Show("Folder ?"); return; } fileList->Items->Clear(); DirectoryInfo^ di = gcnew DirectoryInfo(folderName->Text->ToString()); array<FileInfo^>^fileArray = di->GetFiles(); fileList->Items->AddRange(fileArray); } private: System::Void putRegButton_Click(System::Object^ sender, System:: EventArgs^ e) { String^ userRoot = "HKEY_CURRENT_USER"; String^ subKey = "Software\\Acgnj"; String^ keyName = String::Concat(userRoot, "\\", subKey, "\\", "RegistryDemo"); Registry::SetValue(keyName, "Folder Name", folderName->Text->ToString()); } private: System::Void getRegButton_Click(System::Object^ sender, System:: EventArgs^ e) { String^ userRoot = "HKEY_CURRENT_USER"; String^ subKey = "Software\\Acgnj"; String^ keyName = String::Concat(userRoot, "\\", subKey, "\\", "RegistryDemo"); folderName->Text = (String ^) Registry::GetValue(keyName, "Folder Name", ""); this->Update(); }

Note: typically you will need the MS C++ Redistribution Package to run programs on any computer.


"Random Access" questions start at 7:30 Tuesday night.

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