|
|
|
|
|
|
|
BubbleSort - Sort Arrays using the BubbleSort Algorithm
|
Total Hit (3104) |
«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 (1986) |
«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 (3413) |
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 (3401) |
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
|
|
|
Saving and restoring all IDE settings
|
Total Hit (2355) |
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
|
|
|
Passing Public class variables by reference
|
Total Hit (3002) |
Under VB4 Public variables in form and class modules were implemented in the same manner as variables in BAS modules, that is, as direct references to memory locations. This allowed VB programmers to create procedures that modified values passed by reference, as in:
«Code LangId=1»
'--- the CIn
....Read More |
Rating
|
|
|
Provide a short description of the menu item being highlighted
|
Total Hit (2396) |
Visual Basic lacks of the capability to display a short description of the menu command being highlighted with the mouse or the keyboard, a feature that all professional applications should have. To add menu descriptions to your program, you must subclass the form and trap the WM_MENUSELECT message.
....Read More |
Rating
|
|
|
Catch user's attention with a flashing caption
|
Total Hit (3348) |
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
|
|
|
Print an Image contained in a Picture Box or a Form
|
Total Hit (2448) |
Module
«Code LangId=1» 'Print the Picture contained in a PictureBox or a Form
Public Sub PrintImage(p As IPictureDisp, Optional ByVal x, Optional ByVal y, Optional ByVal resize)
If IsMissing(x) Then x = Printer.CurrentX
If IsMissing(y) Then y = Printer.CurrentY
If IsMissing(resiz
....Read More |
Rating
|
|
|
|
Realtime Clipboard viewer (Subclassing technique)
|
Total Hit (15922) |
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 change printer port using API ?
|
Total Hit (4501) |
«code LangId=1»Option Explicit
Private Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As Long 'DEVMODE
DesiredAccess As Long
End Type
Private Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Long
....Read More |
Rating
|
|
|
Working with string APIs
|
Total Hit (2423) |
«code LangId=1»Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" ( _
ByVal lpString1 As String, _
ByVal lpString2 As String) As Long
Private Declare Function lstrcmp Lib "kernel32" Alias "lstrcmpA" ( _
ByVal lpString1 As String, _
ByVal lpString2
....Read More |
Rating
|
|
|
How to check whether your program is running on Windows NT/2000 ?
|
Total Hit (2114) |
This simple code will tell you whether your program is running on NT/2000 platform or Win9x/ME.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add the following code in the form1 code window
«b»Form1.frm«/b»
«code LangId=1»' Types, constants and functions for OS version d
....Read More |
Rating
|
|
|
|
Creating a Common Control Status Bar via API
|
Total Hit (980) |
In this second article written for VBnet by Brad Martinez, Brad works out the magic behind the Win32 Status Bar common control (window) exposed by the common control library Comctl32.dll without the use of Comctl32.ocx. Subsequent pages will introduce more functionality in creating the control.
T
....Read More |
Rating
|
|
|
Substituting a Tabbed ListBox for a Combo's Dropdown List
|
Total Hit (776) |
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 (1208) |
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 (2585) |
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 (3264) |
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 (1377) |
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
|
|