How To Use The System Tray In Visual Basic

Visual Basic How-To's No Comments »

The system tray, also called the Notification Area, is the little area of icons next to your system clock. Certain programs, espeically those that are designed to run in the background all the time, look much better minimized to the system tray rather than taking up space in the windows taskbar. Here's a .bas module I created for Visual Basic which allows you to easily minimize your program to the system tray with only a few lines of code. You simply add the module to your project, then copy and paste the code below into your form.

Download SystemTray.bas (March 28, 2009)

Read the rest of this entry »

Visual Basic Virtual Key Codes

Visual Basic Modules No Comments »

I was recently looking online for a complete list of Virtual Key Codes I could use in Visual Basic (these are used with the keybd_event, MapVirtualKey, GetKeyState, and GetAsyncKeyState functions). I couldn't find one so I decided to make my own. Since most of the lists I found online were incomplete I went straight to the source, winuser.h, and converted these line-by-line from their original C declarations. Some additional comments and key descriptions I included are from the MSDN.

Download VirtualKeyCodes.bas (March 25, 2009)

Read the rest of this entry »

Individual Key Counter

Visual Basic Projects No Comments »

I recently received a e-mail from a person asking if I knew of any program that could count how many times per day a certain key on the keyboard was pressed. In her case she wanted to know how many times per day she pressed the F9 key. I told her I didn't know of one off-hand but that I could make one in Visual Basic in about 15 minutes. And so I did, and here is the result. I call it "Key Counter" and I decided to release it publically in case anyone else wants it or can learn something from it.

As you can see from the screenshot below it's a very simple and small program. You simply tell it what key you want to watch (F9 is the default), then you minimize it and go about your work, then when you come back to it it will tell you how many times you pressed that key. There's also a "reset" button you can click to reset the count back to 0. This program will not "record" your keystrokes in any way, it will simply count them. You can download both the Visual Basic source code and the program below to see for yourself.

In the future I may make another program that counts all keystrokes made, not just those from an individual key if there's enough interest.

Download keycounter.zip (March 21, 2009)


Read the rest of this entry »

How to monitor the clipboard in Visual Basic

Visual Basic How-To's 1 Comment »

I've always been fascinated by clipboard monitoring programs, you know those little programs that sit in the background and record everything that gets copied to the windows clipboard. However, sometimes it's difficult to find these types of programs in search engines because they're known by so many different names. After spending a number of hours searching in Google and other various shareware sites I was able to compile this list of windows clipboard monitoring programs:

ClipX
Hamsin Clipboard
CLCL
Ditto
ArsClip
Clipdiary
Visual Clipboard
ClipGuru
Yankee Clipper III
Clipboard Recorder
ReClip
TrayClip
Clip-O-Matic
ClipMate
Clipboard Genie
Clipboard Helper

All of these programs do basically the same thing, they monitor and record the windows clipboard. But how exactly do they do it? I recently looked online for some type of guide or tutorial that could show me how it's done in Visual Basic but I couldn't find anything so I decided to write my own. Before writing this guide, I wanted to find out as much information as I could about the windows clipboard and more specifically how clipboard monitoring works. I found two great books on the subject, Programming Windows by Charles Petzold and Subclassing and Hooking with Visual Basic by Stephen Teilhet for Visual Basic specific information. Both of which are excellent and I highly suggest picking them up.

Here's a simple step-by-step guide that shows how to create your own Visual Basic program that can monitor what gets copied into the windows clipboard.

Download clipboard_monitor.zip (March 11, 2009)

Read the rest of this entry »

Form Size Finder

Visual Basic Projects No Comments »

Here's a simple Visual Basic program I wrote back in June 2005 called "Form Size Finder". I originally wrote this because I wanted to make a program that was the exact same size as another program I was using and I didn't know how to find the original program's width and height. This program is composed of a small form you drag around the screen and resize. As you do so it gives you detailed information about itself including it's width, height, and corner coordinates. To match another program's dimensions, you would simply open it up, overlay it on top of the program you want to know the size of, and then resize it to the other program's exact dimensions. Even if you don't use it for it's intended purpose, I think it still may be useful to Visual Basic beginners to see how "Always on top" works, how to drag a form around by clicking on it's body, how to use the StatusBar and SpinButton controls, and how to use the SetWindowPos, GetCursorPos, GetWindowRect, ReleaseCapture, and SendMessage Win32 API's.

Download form_size_finder.zip (June 06, 2005)


Read the rest of this entry »

Entries RSS Comments RSS Log in