Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Server Explorer Summarized

The number of ways Server Explorer can reduce coding time is impressive. For example, I used to rely on text logs because working with the Event Log proved time-consuming. Now I regularly create custom logs for my applications and even create network-wide monitors to alert the administrator to specific Event Log occurrences. As with the other examples in this article, all you need to do is drag the Event Log you want to use from Server Explorer to a form and add a little code. Note that, in this case, you must also set the eventLog1 Source property to the name of your application. Listing 5 shows typical code for adding an entry to the event log.

Listing 5: Adding an Event Log Entry

private: System::Void button1_Click(System::Object * sender, 
         System::EventArgs * e)
   {
   // Write the event log entry.
   eventLog1->WriteEntry("This is a test message.",
         EventLogEntryType::Information,
         1001,
         1);
   }

};

It's important to understand that Server Explorer is an exceptional tool, but just one of many in your toolkit. Although Server Explorer can reduce coding time and the amount of code you write, it doesn't eliminate coding—you still have to understand the objects the Server Explorer creates for you.

  • + Share This
  • 🔖 Save To Your Account