January 13, 1999

Taking a Form in Front of Another Form

When building a floating toolbar, you might need to keep it in front of the main form of your application. This took time to do in VB3 and VB4, because you had to resort to API functions. In VB5, you can take advantage of a new, optional argument of the

Yeah, But Which Common Controls?

This fragment of code from the VB standard module shows the GetComCtlVersion function that retrieves the major and minor version numbers of the Comctl32.dll installed on the local system. Use this function when you subclass toolbar or listview controls from Comctl32.ocx and implement hot-tracking toolbar or full-row select in the

Custom Menu Accelerators

To set the shortcut key of a menu item to something other than what the VB menu editor displays, use this code in the Form_Load event of a form: Private Sub Form_Load() mnuExit.Caption = mnuExit.Caption & vbTab & “ALT+F4″ End Sub This adds the text “ALT+F4” to the caption of

Disable Easily

You can easily give your check-box control a Locked property without making your own custom control. First, create a frame large enough to contain your check boxes. Clear the caption and set the border style to None. Put as many check boxes as needed on this frame, setting their captions

Rotate an Object About a Point

You can rotate any object about a center using polar coordinates. Simply define your center Xo and Yo, which in this case is the center of a form. The amount of rotation is determined by direction, one degree: Private Direction As LongPrivate Xo As Long, Yo As LongPrivate Sub Form_Click()

Use OLE Automation to Call 16-Bit DLLs From VB5 (or VB4 32)

First, create a VB4-16 project and call it VB16Project. In the project, create a class module that includes a function that calls your 16-bit DLL in the usual way. Name the class VB16Class and the function VB16DLLCall. In your VB4-16 project, remove the default form and add a standard module

Determine List Item by Coordinates

I wanted users to be able to get a definition for each item in a list box by right-clicking on the item. Unfortunately, right-clicking doesn’t automatically select the item, so you need some other way of knowing your location in the list box. Simply reading the Y value from the

Menu Properties Shortcut

You can set the properties of any menu item by selecting the menu item in the Properties window drop-down list. This is often faster than selecting the Menu Editor menu choice and has the added benefit of showing you the changes to the menu choice immediately. It’s also the only

Redirecting to a Frame Set

Question: How can you tell whether a Web page that a user loads is in a frame or not? If the page is not in a frame, I want to redirect the user to a frame. Answer: If you have access to JavaScript, testing if a Web page is in

No more posts to show