May 20, 2000

Copy the contents of the screen or the active window

The standard way to copy the contents of the screen or a window to a picture box requires you to use a lot of API functions, such as BitBlt. A simpler approach is possible, though: you just have to simulate the typing of the Print Screen key (or Alt+Print Screen

Rebase compiled DLLs

Many VB developers know that they should specify a DLL Base Address value – in the Compile tab of the Project Properties dialog box – that is different from the base address of any other DLL or OCX used in the project. When you are working with a compiled DLL

Add comments to End If and Loop statements

Here’s a little programming tip that will save you hours of headacheslater.Most of us already indent our Ifs, Selects, Do…Loops, etc., and that is good. But suppose you have some fairly complex code with several levels of indentation. Example: If A= 0 and B=1 then ‘ …(several lines of code)

Understanding the “Allow Unrounded Floating Point Operations” option

The Microsoft manuals preach that all the compiler options in the Advanced Optimization dialog box are to be considered unsafe, in that they might lead to incorrect results (or just program crashes!). This is true for most of them, but often one of such options – namely, the “Allow Unrounded

A better beep

If you aren’t satisfied with the standard Beep command (who is?) you can use the Beep API function instead, that lets you control both the frequency (in Hertz) and the duration (in milliseconds) of the beep. Note that you need an aliased Declare to avoid a name conflict with the

REMark out a group of lines

VB5 and VB6 environments include a pair hidden commands that let you remark and unremark a group of statements. These commands are hidden in the sense that they can be found on the secondary Edit toolbar that isn’t displayed by default. To make these commands available, right-click anywhere on the

Convert a VB6 project back to VB5

If you load a VB6 project file in the VB5 environment you get a warning, even though the project is correctly loaded. The cause of the warning is a VB6 attribute “Retained” (that is, the “Retained in memory” option in the Project Properties dialog box) that isn’t recognized by VB5.

Saving and restoring all IDE settings

At times you’d like to save all the current settings of the Visual Basic environment and restore them afterwards. For example, you may want to alternate between the MDI environment with the code editor using Courier New 12 and the SDI environment with Arial 14. Or you may want to

Persistent breakpoints

When you close a VB IDE session, VB saves the code but doesn’t save the current set of breakpoints. If you need (non-conditional) breakpoints to persist among sessions, don’t use the F9 key. Instead, use the following statement Debug.Assert False The above code will always stop the execution flow when

No more posts to show