|
|
|
|
|
Flashing Form Caption
|
Total Hit (2996) |
«Code LangId=1»'Ever wanted to get the users attention without one of those annoying BEEPs, or just have a 'little fun? Here is a good way to do it. Flash the caption of your Form. That should get 'their attention!
'Place this code into a Module:
Option Explicit
Declare Function FlashWindow L
....Read More |
Rating
|
|
|
|
|
BubbleSort - Sort Arrays using the BubbleSort Algorithm
|
Total Hit (3014) |
«Code LangId=1»
' Bubble Sort an array of any type
' BubbleSort is especially convenient with small arrays (1,000
' items or fewer) or with arrays that are already almost sorted
'
' NUMELS is the index of the last item to be sorted, and is
' useful if the array is only partially filled.
'
'
....Read More |
Rating
|
|
|
|
InStrRev - A replacement for VB6's InStrRev under VB4 and VB5
|
Total Hit (1870) |
«Code LangId=1»' A replacement for the InStrRev function under VB4 and VB5
'
' NOTE: uses the StrReverse function
Function InStrRev(ByVal Text As String, Search As String, _
Optional ByVal Start As Long = -1, Optional ByVal CompareMethod As _
VbCompareMethod = vbBinaryCompare) As Long
....Read More |
Rating
|
|
|
Use Currency instead of LARGE_INTEGER values
|
Total Hit (3306) |
A few API calls require that you pass one or more LARGE_INTEGER arguments. These are 64-bit integer values, defined as follows:
«Code LangId=1»
Type LARGE_INTEGER
lowpart As Long ' lower 32-bit value
highpart As Long ' higher 32-bit value
End Type
«/Code»
Unfortunately, wor
....Read More |
Rating
|
|
|
The status of mouse buttons
|
Total Hit (3291) |
Visual Basic lets you test the state of mouse buttons only inside a MouseDown, MouseMove, or MouseUp event procedure. To determine the current state of mouse buttons you can use one of the following functions:
«Code LangId=1»
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As
....Read More |
Rating
|
|
|
Format a drive using an undocumented function
|
Total Hit (4108) |
SHFormatDrive is an undocumented but simple API function that allows you to format a drive. This function simply opens "Format Drive" diaolog window. Being undocument you won't find its Declare with the API Viewer utility:
«Code LangId=1»
Private Declare Function SHFormatDrive Lib "Shell32.dll"
....Read More |
Rating
|
|
|
Saving and restoring all IDE settings
|
Total Hit (2276) |
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 dock a different se
....Read More |
Rating
|
|
|
Set tab stop positions for a multiline TextBox control
|
Total Hit (2434) |
By default, multiline TextBox controls insert a tab stop position every 8 characters; in other words, if you press the Ctrl+Tab key while the focus is inside a multiline TextBox control, the caret advances to position 8,16,24, etc. (If the TextBox is the only control on the form that can receive the
....Read More |
Rating
|
|
|
Catch user's attention with a flashing caption
|
Total Hit (3257) |
If you want to draw user's attention but you don't want to force the form to move to the foreground, you can simply flash its caption (and its icon in the taskbar), using the FlashWindow API function. To do so, just add a Timer with a suitable Interval property (for example, 1000 milliseconds) and t
....Read More |
Rating
|
|
|
Retrieve information on all available drives
|
Total Hit (3025) |
You can retrieve information about all the available drives using calls to Windows API, if you like the hard way of doing things. A much simpler solution is offered by the Microsoft Scripting Runtime library, that exposes a Drive object that lets you get all those info by querying a property:
....Read More |
Rating
|
|
|
Quickly clear a portion of an array
|
Total Hit (2774) |
The fastest way to clear an array is to ReDim (if the array is dynamic) or Erase it (if the array is Static). However, if you want to clear a portion of an array, it seems that you must code a For-Next loop.
If you are dealing with numeric arrays, there is a faster alternative, based on the ZeroM
....Read More |
Rating
|
|
|
Create all the sub directories of specified path.
|
Total Hit (2179) |
Sometimes we need to create a directory if it doesn't exist. It is easy to create directories using VB. You can use «b»MkDir«/b» function. But what if we need to create all directories of specified path if none of them exists? Well, if you are running Win2K or higher then its easy. You can use follo
....Read More |
Rating
|
|
|
|
Realtime Clipboard viewer (Subclassing technique)
|
Total Hit (15633) |
The clipboard is a set of functions and messages that enable applications to transfer data. Because all applications have access to the clipboard, data can be easily transferred between applications or within an application. In this article you will learn various techniques to develop fully function
....Read More |
Rating
|
|
|
How To Use the ADO SHAPE Command
|
Total Hit (3208) |
This article describes the ADO SHAPE command syntax for producing hierarchical recordsets, and explains how to traverse hierarchical recordsets. VBA sample code is also provided.
|
Rating
|
|
|
Invoking Chkdsk using WMI
|
Total Hit (1209) |
Besides returning system information, the Windows Management Instrumentation classes also expose methods that can be called from VB. In addition, the WMI supports the executing of SQL-style calls to retrieve specific information.
|
Rating
|
|
|
Substituting a Tabbed ListBox for a Combo's Dropdown List
|
Total Hit (722) |
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
|
|
|
|
Get Disk Information for any Machine In the selected Domain
|
Total Hit (1060) |
This is a project that enumerates drive details on remote NT systems, but is not limited by GetDriveSpace's 2.0 GB limit. It uses GetDriveSpaceEx and the Currency Data Type (multiplied by 10000) to accurately return large drive sizes. It enumerates all NT workstations and servers and propagates a se
....Read More |
Rating
|
|
|
Alpha DIBSections
|
Total Hit (2492) |
This article provides an enhanced DIBSection class which allows you to create and draw images with per-pixel alpha. The alpha component of a pixel allows you to determine how transparent you would like a pixel to be. This concept is being increasingly used in the Windows UI to enhance the user exper
....Read More |
Rating
|
|
|
Creating a new GDI Bitmap from a VB Picture or DC
|
Total Hit (3178) |
If you're creating some code which works with VB but draws with the more powerful GDI functions, it's often very handy to be able to create a new bitmap handle from a VB StdPicture object or from an area of a DC. This article demonstrates how to do this with a few lines of GDI code.
....Read More |
Rating
|
|
|
Counting Colours in an Image
|
Total Hit (1315) |
Counting the number of distinct colours in an image doesn't sound like a particularly hard thing to do until you try it on a large 24-bit image. This article demonstrates one technique for counting the colours quickly.
|
Rating
|
|
|
Using ecdClientDrawOnly with the Owner Draw Combo List Box Control
|
Total Hit (2470) |
This article demonstrates how to use the ecdClientDrawOnly mode of the vbAccelerator Owner Draw and Combo List Box control to draw completely customised Combo Boxes (note that exactly the same technique applies for List Boxes as well). The sample provides three useful implementations - a line picker
....Read More |
Rating
|
|