Tips Index


Click for Detecting Windows Settings Changes

Detecting Windows Settings Changes

This tip demonstrates how to detect windows settings changes in your application. You will need to have installed and registered the Subclassing and Timer Assistant (SSubTmr.DLL for VB5 and SSubTmr6.DLL for VB6), available from this site at Subclassing without the crashes to run this sample.

  more...


Last Updated: 18 August 1999


Click for Detecting Display Size or System Colour Depth Changes

Detecting Display Size or System Colour Depth Changes

This tip demonstrates how to detect Windows display setting changes (i.e. screen size and display colour depth) from Visual Basic. You will need to have installed and registered the Subclassing and Timer Assistant (SSubTmr.DLL for VB5 and SSubTmr6.DLL for VB6), available from this site at Subclassing without the crashes to run this sample.

  more...


Last Updated: 18 August 1999


Click for System Internet Connection - Determining How and If Connected

System Internet Connection - Determining How and If Connected

If you are designing a project which can use an Internet connection, it can be useful to know whether the system is connected or not. There are various methods of doing this, however the most informative and reliable method is to use the WinInet.DLL InternetGetConnectedStateEx API call. The only problem with this call is it is only implemented for the WinInet.DLL version shipped with Internet Explorer version 4.0 or higher.

  more...


Last Updated: 17 August 1999


Click for Create an API hFont from a VB StdFont object

Create an API hFont from a VB StdFont object

If you are working with API based controls you will find that to set fonts you need a GDI hFont handle to the font. The StdFont object does not directly supply you with this handle. Although it is possible to cast the StdFont object as an IFont object, which does have a hFont handle property, you still don't get full control over the setting of the font properties, and note that since you cannot call the AddRefhFont method from VB there may be instances in which the handle unexpectedly becomes invalid.

  more...


Last Updated: 17 August 1999


Click for Compact a Long Path Name to fit a given space

Compact a Long Path Name to fit a given space

Often there is not enough room to display all of a long path name. A neat way to format a path name in a given space is to show some of the beginning of the path and the filename itself, whilst missing out some of the central folders and replacing them with ellipses (..) This method is used in many Microsoft applications.

This tip shows how to use the either the DrawText or the PathCompactPath API functions to get this effect.

  more...


Last Updated: 17 August 1999


Click for Set Left and Right Margin of Text Boxes and Combo Boxes

Set Left and Right Margin of Text Boxes and Combo Boxes

This tip demonstrates how to modify the left and right margins of Drop-Down Combo Boxes and Text box controls.

  more...


Last Updated: 21 February 1999


Click for Implementing Unsigned Right and Left Shift Operators

Implementing Unsigned Right and Left Shift Operators

When translating C code to VB, often you come across the Right Shift and Left Shift operators ( << and >> respectively ). There is no inbuilt support for Right and Left Shift in VB, so you have to code your own. One of the main problems with replacing these functions is that C code often uses them in unsigned operations. VB doesn't support unsigned long integers either, so code can often fail if the highest bit of the long value is involved.

This tip demonstrates how to implement unsigned Right Shift and Left Shift operators without overflow.

  more...


Last Updated: 21 February 1999


Click for HiWords and LoWords from Long Values

HiWords and LoWords from Long Values

When translating C code to VB, you quite often come across the HiWord and LoWord operators, used to pack two integers into a long value. A simple translation of HiWord code will run into difficulties when unsigned integer arithmetic is being used in the C code and the highest bit of the long value can be set. Since VB doesn't support unsigned arithmetic we have to strip out the high bit and add it back again later to avoid overflows and misleading results.

  more...


Last Updated: 21 February 1999


Click for Determine whether a file is in the Internet Explorer cache

Determine whether a file is in the Internet Explorer cache

If you are creating a shortcut to an Internet file, you will want to know whether it has been visited or not so you can colour it appropriately. This tip shows you how to determine whether a file is in the cache so you can do this.

  more...


Last Updated: 21 February 1999


Click for Detect when a Combo Box Drops Down or Closes Up

Detect when a Combo Box Drops Down or Closes Up

This tip demonstrates how to detect a Combo Box drop down or close up by using subclassing. You will need to have installed and registered the Subclassing and Timer Assistant, available from this site at Subclassing without the crashes to run this sample.

  more...


Last Updated: 21 February 1999