( Index )
Month
 

Brief Information about the March '12 CSIG Meeting

Microsoft MSDN Developer Samples - A Review

Microsoft C++ and Visual Studio

Welcome to the CSIG, a Special Interest Group of the ACGNJ. We will be discussing Windows Programming using Visual C++  from Microsoft.

Microsoft Web Site 

code.msdn.microsoft.com

The Microsoft web site has a wealth of information about Visual Studio and C++ Software.  The above site contains thousands of examples of code in various languages. We will have an informal discussion about the web site and review some of the samples. Here's a partial quote from the Microsoft Code Copyright: "... each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create."

 

Windows Programming with Microsoft Managed code
Microsoft Visual Studio 2008
Debugging
Text and Window I/O
OOP - Object Oriented Programming
Mail, email and SMTP

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 and the "Express" versions are free ! I see also that Microsoft is advertising a still newer version, Visual Studio 2010. Additionally, there are other companies making free and almost free compilers. Here's a link with many compilers: http://www.willus.com/ccomp.shtml

Microsoft .NET Framework

This is a large package, over 24 Megs. Most people running updated versions of Windows will already have it on their computer. If not, it may be downloaded from Microsoft.

Here's the download address for the Microsoft Framework:
Microsoft Software
Or, just look for: Microsoft .NET Framework Version x.x Redistributable Package (x86)

There are a number of ways to refer to this compiler and code.

The beginning of the evening (starting at 7:30pm) will be a RANDOM ACCESS discussion. The main presentation will discuss the program.

Our download site has code and programs from most of our meetings. ( Source Code Files )

Sample Code -

Sample Code
===========
private: System::Void SendButton_Click(System::Object^  sender, System::EventArgs^  e) {
             sender; e;     // Suppress Warning C4100

             String ^server = "smtp.embarqmail.com";
             String ^account = "********@embarqmail.com";
             String ^password = "*****";
             NetworkCredential ^ myCred = gcnew NetworkCredential(account, password);

             // Create a message and set up. (from,to)
             Mail::MailMessage^ message = gcnew Mail::MailMessage("barnold@ieee.org", "********@free.kindle.com");

             message->Body = gcnew String("Kindle message attached.");
             message->Subject = gcnew String("Message Transfer to Kindle.");

             String ^fname = gcnew String("");
             if (SubjectBox->Text->Length > 0)
                 {
                 bool abort = false;
                 String ^bad = "\"*/:<>?\\|"  ;                 // Check for any bad characters since
                 String ^str = gcnew String(SubjectBox->Text);  // this will become the filename.

                 for(int i=0; i<bad->Length; i++)
                     for(int j=0; j<str->Length; j++)
                         if (str[j]==bad[i])
                             {
                             abort = true;   i = bad->Length; break;
                             }
                 if (abort)
                     {
                     MessageBox::Show(bad + " These characters are forbidden in the Subject");
                     return;
                     }

                 fname += Path::GetTempPath();
                 fname += SubjectBox->Text;
                 fname += ".txt";
                 StreamWriter ^sw = gcnew StreamWriter(fname);
                 sw->Write(TransferData->Text);
                 sw->Close();
                 }
             else
                 {
                 MessageBox::Show("No subject has been provided.");
                 return;
                 }

             // Create  the file attachment for this e-mail message.
             Mail::Attachment^ data = gcnew Mail::Attachment(fname, Mime::MediaTypeNames::Application::Octet);

             // Add the file attachment to this e-mail message.
             message->Attachments->Add( data );

             //Send the message.
             Mail::SmtpClient^ client = gcnew Mail::SmtpClient( server );
             client->Credentials = myCred;

             try
                 {
                 client->Send( message );
                 MessageBox::Show(" DATA has been EMAILED to the Kindle.");
                 }
             catch (...)
                {
                MessageBox::Show(" Failed.");
                }

             data->~Attachment();
             client->~SmtpClient();
             }
// ===========



"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