Forms & Windows Library
Updated Monday December 26, 2011
   
Category
Topic
Backgrounds
vb6
vb5
vb4-32
FillRect: Gradient Form Backgrounds
Using APIs, create a horizontal, vertical or diagonal gradient background for your form.

GradientFill: Gradient Form Backgrounds
Using APIs, create a horizontal, vertical or diagonal gradient background for your form.  Feb 17.2003

GradientFill: Triangular Gradient Form Backgrounds
Using GradientFill with GRADIENT_TRIANGLE to create a triangular form or picture box fill.  Feb 17.2003

Pure VB: Tile an Image as a Form Background
How to tile an image across the background of any form (except MDI parents). No APIs needed.


Buttons
vb6
vb5
vb4-32
Killing the Form's Close Menu Option and 'X' Button 
Prevent users from attempting to close an application by disabling the system menu options. July 8.1998

Killing Any Form's Close Menu Option and 'X' Button - SDI, MDIParent or MDIChild
One routine to handle removal/disabling of any form's system menu Close command and form 'X' button. August 15.1999



Controlling
vb6
vb5
EnumWindows: Enumerate (and Restore) a Window via Callback
Using EnumWindows to obtain window information, and provide a means to restore the window regardless of its window position. Mar 01.2000

EnumWindows: Enumerate Windows via a Callback
Another Enumxxx API, this one enumerates system windows using AddressOf. June 17.1998

EnumChildWindows: Enumeration of Parent and Child Windows via Callbacks
Using EnumWindows and EnumChildWindows. Jan 26.2000

GetWindowThreadProcessId: Obtain the hWnd of an App Started with Shell()
Use GetWindowThreadProcessId to obtain the handle to an application started with Shell. May 12.1999

SetWindowPlacement: Restore and Activate a Window via its hWnd
Use the APIs to restore any window on-screen. July 17.1999



Effects
vb6
vb5
vb4-32
Pure VB: Vertical Splitter Bar
How to add a vertical splitter bar to resize 2 controls, like in Windows Explorer window. No APIs needed!

DrawText: Adding Title Text to the Fake TitleBar (for DrawFocusRect: Simulating Non-Client Form Movement below)
Using the application developed in DrawFocusRect: Simulating Non-Client Form Movement, this page adds a title to the fake title bar using the DrawText API.

Pure VB: Customizable PhotoShop-Style ProgressBar
Create a fully-configurable flood panel.

Pure VB: Customizable PhotoShop-Style ProgressBar in a MDI App
Use the flood panel from Creating a Custom PhotoShop-Style Flood Panel to create a status flood on an MDI parent window flood, exposed through common routines.

SendMessage: Creating a Scrollable Viewport to Simulate a Scrollable Form
Based on the MSKB article, how to create a scrollable viewport to simulate scrolling forms. July 18.2004

Pure VB: Easily Add a Raised or Etched 3D Line Beneath a Menu
A two-liner to add a 3D line beneath a menu (or anywhere on the form). Mar 4.2003

InflateRect: Highlighting External Windows
How to use DrawFocusRect and InflateRect to highlight main and child windows anywhere on the screen, and capture the window to a picture box (print screen). Oct 25.2004

GetSystemMetrics: How to Create a Popup Colour Selector 
Code to create a small popup colour selector you can assign to any toolbar button, or modify to become a floating selector. No APIs needed!

ClipCursor: Restrict the Mouse to a Form's Client Area
How to prevent the cursor from moving outside the form's client area. Feb 12.2000

Manifests: Make the VB IDE use Windows XP Styles
How to add a manifest to cause the IDE to utilize XP-style controls Mar 4.2003

Manifests: Make the VB IDE use Windows Vista Styles
How to add a manifest to cause the IDE to utilize XP-style controls Sept 7.2008

DrawFocusRect: Simulating Non-Client Form Movement
API code to create a drag rectangle to move a form with no title bar. Useful for Toolbar windows, or dragging by simply clicking the form itself.

GetSystemMetrics: Resizing a Form to Fit an Image
How to cause a form to resize to the size of a loaded image. Updated Nov 17.2008

SendMessage: Move Controls to Simulate Form Scrolling
Simple code to move controls on a form in response to a scroll bar movement to simulate the appearance of a scrollable form. July 16.2004

ReleaseCapture: Simulating a Working Size-Grip on a VB Form
A label is all that's required! Jan 21.2003

Pure VB: Simulating Owned Windows for MDI Children
Handy routine for providing each MDI Child window with the ability to show its own copy of a non-modal non-MDI form. Oct 2.2001
 



Enumeration
vb6
vb5
EnumWindows: Enumerate (and Restore) a Window via Callback
Using EnumWindows to obtain window information, and provide a means to restore the window regardless of its window position. Mar 01.2000

EnumWindows: Enumerate Windows via a Callback
Another Enumxxx API, this one enumerates system windows using AddressOf. June 17.1998

EnumChildWindows: Enumeration of Parent and Child Windows via Callbacks
Using EnumWindows and EnumChildWindows. Jan 26.2000

GetWindowThreadProcessId: Obtain the hWnd of an App Started with Shell()
Use GetWindowThreadProcessId to obtain the handle to an application started with Shell. May 12.1999

SetWindowPlacement: Restore and Activate a Window via its hWnd
Use the APIs to restore any window on-screen. July 17.1999



Fading
vb6
vb5
SetLayeredWindowAttributes: Fading a Form In/Out
Code to fade a window in or out (Windows 2000 or later). Can also be used to create semi-transparent forms as well as forms containing a knock-out.
 May 10.2004


Form Notifications
vb6
vb5
Shell_NotifyIcon: Animate the System Tray Icon
Creating a system tray icon with timed animation. Jan 29.2002

Shell_NotifyIcon: Display Systray Balloon Tips
How to add Balloon Tips to a systray application running under Windows 2000 or Windows XP.  Jul 07.2002

FlashWindowEx: Extended Window Notification (Flashing) Options
Customize window and task bar flashing via the enhancements provided in FlashWindowEx. Oct 30 2002

FlashWindow: Timing Window Notifications using SetTimer
How to flash a window on-screen or in the taskbar using FlashWindow and an API-created timer. Oct 30 2002

FlashWindow: Timing Window Notifications using VB's Timer Control
How to flash a window on-screen or in the taskbar using FlashWindow using a VB timer. Oct 30 2002



keybd_event
vb6
vb5
vb4-32
keybd_event: Navigate Form Controls using Enter
Replace SendKeys to move through controls using Enter. Jan 01.2003

 



MDI Apps
vb6
vb5
vb4-32
Pure VB: Simulating Owned Windows for MDI Children
Handy routine for providing each MDI Child window with the ability to show its own copy of a non-modal non-MDI form. Oct 2.2001

Creating a Custom PhotoShop-Style MDI App Flood Panel
Use the flood panel from Creating a Custom PhotoShop-Style Flood Panel to create a status flood on an MDI parent window flood, exposed through common routines.



Scrolling
vb6
vb5
vb4-32
SendMessage: Creating a Scrollable Viewport to Simulate a Scrollable Form
Based on the MSKB article, how to create a scrollable viewport to simulate scrolling forms. July 18.2004

SendMessage: Move Controls to Simulate Form Scrolling
Simple code to move controls on a form in response to a scroll bar movement to simulate the appearance of a scrollable form. July 16.2004



Subclassing
vb6
vb5
WM_SYSCOMMAND: Change and Respond to a Customized System Menu
Modify and react to new items added to a System Menu. April 17.1999

WM_SIZING: Maintain Form Aspect Ratio During Resizing
Detecting form resizing and changing the window rect to assure aspect ratio is maintained.  Jan 25.2002

Subclassing Form Messages: WM_ACTIVATEAPP: Detect Application Activation State
Detecting when an application gains and looses focus to another Windows app. June 6.1999

Subclassing Form Messages: WM_NCHITTEST: Simulating a Non-Client Action to Move a Form
Click anywhere on the form to reposition it on screen. July 1.1998

WM_GETMINMAXINFO: Restrict Form Resizing
Code to restrict resizing of a form to a size you specify. July 1.1998

WM_HOTKEY: System-Wide Keyboard Trapping
Create and respond to a system-wide hotkey hook.  July 16.1999



Transparency
vb6
vb5
SetLayeredWindowAttributes: Fading a Form In/Out
Code to fade a window in or out (Windows 2000 or later). Can also be used to create semi-transparent forms as well as forms containing a knock-out.
 May 10.2004


 

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter