Sunday, January 5, 2014

Turning to VB .NET

I might have a new job pretty soon! Finally, I will be saved from the world of retail!

The new job is a VB .NET developer position and as you might know already, I write most of my software in C#, Java, or C++. But I'm definitely not new to the VB world.

But I did need a refresher, so I decided to write a couple of applications today. The main one I developed is a system monitor. It's pretty standard. There's a thread running in the background that calls a thread-safe subroutine which updates the list of running processes. I used a SortedDictionary to sort the processes by PID, and the list is checkable, so you can check multiple processes and kill them with the "Kill" button. I also give the option to open the directory of the selected (not checked) process in explorer. But I'm not sure about how to select the file when explorer is opened at that location. On the left-hand side of the form is a list of changes occurring in the file system. Using FileSystemWatcher, I can see changes occurring all throughout the file system, and save the results to a log file. The log file begins with the current date and time, machine name, and current user name, followed by the list of changes found and the list of running processes at the time. And finally, in the menu, you can go to Tools>Run and choose one of the menu items (Command Prompt, Task Manager, Registry Editor, Notepad).

I already knew VB, but writing in it again felt amazing. Like the feeling you get when writing Python after you haven't used it in awhile, without wishing that all languages were like it (nerd humor that probably only I will understand). Anyway. Check out my source code, it's well documented in case you don't know VB. I also use a little Boolean trick (line 136) which I've used in C-style languages forever. It works in VB as well and you might find it useful if you don't use it already.

Here is a screenshot!

VB isn't so bad. The source code is at my github.

No comments:

Post a Comment