|
Enumerating and Restoring Windows Using Callbacks
|
Total Hit (1471) |
Here's a quick routine that will enumerate all top-level windows and provide a Restore feature to restore the app to the foreground. Once again the venerable EnumWindows API forms the base for this demo, with supporting roles going to GetWindowPlacement, BringWindowToTop, and friends.
....Read More |
Rating
|
|
|
Enumerating Windows Using Callbacks
|
Total Hit (1298) |
Windows offers VB programmers the 'EnumXXX' APIs providing callback data for specific tasks.
This page demonstrates using the EnumWindows() API to enumerate all windows on the system, and populate a listbox with their class name, hwnd and window text if available.
....Read More |
Rating
|
|
|
EnumWindows and EnumChildWindows Callbacks
|
Total Hit (1681) |
Many Windows' Enum APIs provide callback data for specific tasks.
This project demonstrates using both EnumWindows and EnumChildWindows APIs and their respective EnumWindowProc and EnumChildProc callbacks. The main form in the demo enumerates all top-level windows on the system populating ListView
....Read More |
Rating
|
|
|
|
Disabling the Combo Edit Box
|
Total Hit (1435) |
OK, so you have a combo (Style 0) where you want to allow the user the ability to copy the contents, but not change the text. Setting the combo's locked property will do the trick, but the right-mouse context menu is still available. This shows how using FindWindowEx and SendMessage with the EM_SETR
....Read More |
Rating
|
|
|
Killing the Default Combo Box Context Menu
|
Total Hit (1202) |
For this to work we have to borrow from the combo method that deals with retrieving the handle to the edit portion of the control (see related topics above). The edit handle is stored, where it is compared to the hWnd passed by the WindowProc procedure. If the handle is that of the edit control, the
....Read More |
Rating
|
|
|
Obtaining the Combo Box Edit Window Handle
|
Total Hit (1499) |
This method shows how you can obtain the handle to the edit portion of a combo box using the FindWindowEx API. Unlike the GetComboBoxInfo method linked above, this method will work with all versions of Windows 95/98/NT4/2000/XP so far released.
As a further check against the handle returned, you c
....Read More |
Rating
|
|
|
|
Substituting a Tabbed ListBox for a Combo's Dropdown List
|
Total Hit (770) |
Creating a tabbed list is a painless procedure when dealing with VB's intrinsic ListBox control. However when using a ComboBox, the ability to format both the list and portions of the control is lost, as is shown in illustration 1.
List boxes have the LBS_USETABSTOPS style bit set, whereas combo b
....Read More |
Rating
|
|
|
Substituting a ListView for a Combo's Dropdown List
|
Total Hit (1130) |
Once the methods to trap the display of a combo's default dropdown list had been coded, substituting another control in place of the dropdown list is as easy as modifying the basic routine to point to the new control. Based on the code listed above, the only changes needed to support a listview cont
....Read More |
Rating
|
|
|
Displaying a Balloon Tip in a Combo Box
|
Total Hit (1201) |
Note: In order for EM_HIDEBALLOONTIP to function correctly users must not have disabled the "Enable balloon tip" setting on the system. Using TweakUI for XP, this is located under the Taskbar group of options. It is also directly accessible as a registry entry under HKEY_CURRENT_USER \ Software \ Mi
....Read More |
Rating
|
|
|
|
Changing the Combo Dropdown Height
|
Total Hit (705) |
The Visual Basic combo box dropdown - unlike its C counterpart - is limited to displaying only eight items. This page shows how to change the dropdown height to any number greater than eight.
|
Rating
|
|
|
Changing the Dropdown Width of a Combo Box
|
Total Hit (1194) |
This routine demonstrates using the API to change the width of the dropdown portion of a combo box. The combo list width is manually set in the accompanying text box.
|
Rating
|
|
|
Changing the Dropdown Width of a Combo Box, Advanced
|
Total Hit (715) |
Like the routine in Changing the Dropdown Width of a Combo Box, this routine performs the same functionality but adds the ability to resize the list at runtime. By calculating the average width of a character in the listbox based on the current font, the dropdown width can change to accommodate the
....Read More |
Rating
|
|
|
|
Duplicating List Contents to Another List or Combo Using SendMessage
|
Total Hit (1595) |
You may encounter the need to quickly duplicate the contents of a listbox to another listbox, or to a combo box (or vice-versa). While there is no non-looping method available the use of SendMessage can speed up the copying, especially in situations where a large amount of data is to be duplicated.
....Read More |
Rating
|
|
|
Filling a Combo with Files, Directories and Drives
|
Total Hit (1159) |
This routine demonstrates using SendMessage to populate a combo box with any combination of files, directories and drives. Although this demo uses the wildcard *.*, the method is valid for any mask.
|
Rating
|
|
|
Creating the Common Control Initialization Module
|
Total Hit (992) |
This file will be required to be added to the existing project for all common control API methods detailed here that use the API to actually create the common control (as opposed to using the Visual Basic Common Control). The BAS module will provide the mechanism to initialize the comctl32.dll, rega
....Read More |
Rating
|
|
|
Creating a Common Control Header via the API
|
Total Hit (958) |
If you're like myself, you've probably wished that some of Visual Basic's other controls provided the look (and functionality) of a ListView's header. In this example, we'll use the API to create a real header control and position it overtop a list or textbox.
....Read More |
Rating
|
|
|
|
Adding a VB Progress Bar to a VB StatusBar
|
Total Hit (1463) |
Normally, to calculate the position the progress bar should occupy in the status bar panel, one would calculate the panel position relative to the top left corner of the form, and adjust the coordinates appropriately. However, I found this can be circumvented by temporarily changing the status bar
....Read More |
Rating
|
|
|
Changing Colours of a VB ProgressBar
|
Total Hit (1473) |
Here's a quick SendMessage method to change the bar and / or backcolours of both a VB5 or VB6 progress bar, or an API-created progress bar. Note that on XP, using the 'Silver' theme, the default bar colour is grey, not the usual blue.
|
Rating
|
|
|
Creating a Custom PhotoShop-Style ProgressBar
|
Total Hit (977) |
The routines on this page were originally developed to overcome display limitations of the original VB3 SSPanel FloodPercent control, namely use of and justification of text and the positioning the control as a member of a status panel. The routine was originally developed in VB3 and has been update
....Read More |
Rating
|
|
|
Creating a Custom PhotoShop-Style ProgressBar in a MDI App
|
Total Hit (1012) |
The routine here is based on code originally developed to overcome some of the display limitations of the original VB3 SSPanel FloodPercent control, namely justification of text and positioning as a member inside a status panel. The routine was originally developed in VB3, and has been updated for u
....Read More |
Rating
|
|
|
Creating a Common Control Progress Bar - Overview
|
Total Hit (1510) |
The following is an explanation of the messages and structures used by the Windows Progress Bar common control, written by Brad Martinez and provided for distribution on VBnet.
The Windows Common Controls API continues to grow as more features are added. Currently, comctl32.dll contains the follo
....Read More |
Rating
|
|
|
Creating a Common Control Progress Bar via API
|
Total Hit (954) |
The advantages of this implementation are obviously beneficial. First and foremost the need to distribute Comctl32.ocx with an application is eliminated, reducing distribution size. Also an application's memory footprint is significantly reduced by not loading an ActiveX control. And finally, there
....Read More |
Rating
|
|
|
Populating a Font Menu and Splitting a Long Menu into Columns
|
Total Hit (1378) |
In attempting to display a font selection menu on a system with many installed fonts, the menu, due to the number of installed fonts, often exceeds the screen height truncating the font list. This page is an extension of the code in How to Split a Long Menu into Columns. Here, we'll use the EnumFont
....Read More |
Rating
|
|
|
Sorting ListView ListItems Using Callbacks
|
Total Hit (1526) |
Sorting numeric values with the ListView control's built-in sort mechanism has always left much to be desired. Because the ListView stores the item and SubItem data as strings, the default sorting algorithm sorted numbers in string format. This meant that instead of a sort of 1, 2, 3, 20, 35, the Li
....Read More |
Rating
|
|
|
Enumerating the Installed and Supported System Locales
|
Total Hit (1676) |
In addition to locale information pertaining to the current system setting, the EnumSystemLocales API provides the means to enumerate via callbacks all supported or installed national language support for a given system. Armed with the country LCID's returned by the call, an application can retrieve
....Read More |
Rating
|
|