|
Run Length Encodeing Compression example
|
Total Hit (1772) |
Module
«Code LangId=1»
' Start a new project and add two command buttons to the form and aslo a text box
' Now place the follwing code below in to the general declarations selecion of the
' form and press 5F. Press the Commpress button and see what has happend to the
' string and then press
....Read More |
Rating
|
|
|
|
|
|
|
ForceTextBoxNumeric - Create a numeric Textbox
|
Total Hit (2330) |
«Code LangId=1»
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
....Read More |
Rating
|
|
|
|
|
|
|
Rnd2 - A random value in a range
|
Total Hit (1577) |
«Code LangId=1»
' A random number in the range (low, high)
Function Rnd2(low As Single, high As Single) As Single
Rnd2 = Rnd * (high - low) + low
End Function
«/Code»
|
Rating
|
|
|
IsValidSSN - Check a Social Security Number value
|
Total Hit (3184) |
«Code LangId=1»' Validates attributes of the SSN
' Returns True if valid, False if invalid
'
'Example:
' If IsValidSSN(Value:="333-44-3333", IsRequired:=True) then ...
Function IsValidSSN(ByRef Value As String, Optional ByVal IsRequired As Boolean _
= True) As Boolean
On Error
....Read More |
Rating
|
|
|
Get the exit code of a process
|
Total Hit (4198) |
In a few cases, in particular when running MsDos batch files from within a VB application, you may want to determine the ERRORLEVEL set by an external application. You can't do it with a plain Shell statement, but the job becomes easy with the support of the GetProcessExitCode API function:
«Code
....Read More |
Rating
|
|
|
Check whether a serial or parallel port is available
|
Total Hit (2992) |
The Open statement also supports special device names such as COM1 or LPT2. You can build on this feature and use the Open command to test whether a given serial or parallel port is available. Here are two functions that perform this task:
«Code LangId=1»
' Check whether a given COM serial port
....Read More |
Rating
|
|
|
Play a MIDI file
|
Total Hit (4475) |
If you want to play a MIDI file from VB you have to use MCI functions. The main MCI function is mciSendString, that sends command strings to the system and execute them:
«Code LangId=1»
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal
....Read More |
Rating
|
|
|
|
Evaluate the integer equal or higher than a given value
|
Total Hit (2847) |
The VBA language offers the Int() function, which returns the integer equal or lower than a given value, but lacks a similar function that returns the integer equal or higher than a given value. You can remedy with the following function:
«Code LangId=1»
' Returns the integer equal or higher tha
....Read More |
Rating
|
|
|
|
How to send a specific windows message to all windows ?
|
Total Hit (3435) |
Many times we need to send a specific message to other applications or windows itself to notify regarding some event. Windows provides a function called BroadcastSystemMessage. The BroadcastSystemMessage function sends a message to the specified recipients. The recipients can be applications, instal
....Read More |
Rating
|
|
|
How can I print a preformated file directly to printer?
|
Total Hit (2692) |
«b»Step-By-Step Example«/b»
1. On a Microsoft NT 4.0 system, add a printer with a name that contains a space.
2. Create a text file in the C:\ folder, for example, test.txt.
3. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
4. From the Project menu, select Refer
....Read More |
Rating
|
|
|
Using the ChooseColor Common Dialog API
|
Total Hit (1522) |
Although the API uses a structure to pass parameters to the ChooseColor API, the dialog can be shown by providing just the flags, hwndOwner, lStructSize and lpCustColors members completed. Other options, such as a hook, can be added to provide additional functionality such as positioning, custom cap
....Read More |
Rating
|
|
|
Displaying Modal Form Activity on a Parent Form VB Progress Bar
|
Total Hit (1259) |
This is simple code that demonstrates how to use a normal VB progress bar on a parent form (SDI or MDI) to track the activity being performed in another form, even when that form is modal.
The demo also shows how to call SetParent to embed the progress bar inside the status bar panel.
....Read More |
Rating
|
|
|
How to Determine Re-Ordered Column Positions in a ListView
|
Total Hit (1455) |
Sending the listview extended style message LVS_EX_HEADERDRAGDROP enables repositioning/reordering of a ListView's main and subitem columns.
However, this does not alter the index of the columns to match their new physical locations. VB remains unaware that repositioning has taken place (since it
....Read More |
Rating
|
|
|
Detect when a Combo Box Drops Down or Closes Up
|
Total Hit (1999) |
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.
....Read More |
Rating
|
|
|
Responding to AppCommands
|
Total Hit (1776) |
The WM_APPCOMMAND message was added to Windows 2000 and ME to provide a mechanism to send the events from extended keys on newer keyboards to applications on the system. Extended keys are things like the back, forward and search button. This tip demonstrates how to intercept events from these keys i
....Read More |
Rating
|
|
|
Cellular Automata - Crystal Model
|
Total Hit (1250) |
A cellular automata are a class of mathematical systems which have been used widely in the investigation of complexity. An automaton is simple: an array of neighbouring cells each have a finite number of possible states. Each cell is then set to change its state when an imaginary clock ticks accordi
....Read More |
Rating
|
|
|
Splitting the Easy Way
|
Total Hit (1551) |
The EasySplitter class provided with this download completely automates most of the tasks involved with setting up a split between two objects. All you need to do is tell it which two objects you want to split and which direction to split and it does the rest.
....Read More |
Rating
|
|
|
Adding XP Visual Styles to Your Visual Basic Application
|
Total Hit (2054) |
When you run a Visual Basic application on an XP machine, you will see that although the form gets an XP-style title bar, the controls on the form still draw in the old-fashioned Windows style. However, it doesn't take much to persuade an application to use the new styles. In some cases, you can get
....Read More |
Rating
|
|
|
Drawing Borders and Edges using the API DrawEdge Function
|
Total Hit (2242) |
The DrawEdge function is a useful function provided by the Win32 API. It can draw a variety of the edge styles used to draw buttons, frames and borders around controls and forms. The source code for this article shows you how to:
Use the DrawEdge to achieve a variety of edge styles.
Evaluate the
....Read More |
Rating
|
|
|
Browsing For Folders
|
Total Hit (2099) |
The Folder Browse Dialog is the missing dialog in VB - it can't be called from a run-time function and it is missing from the Common Dialog OCX as well. Whilst a number of code samples demonstrate that calling this dialog is simple, many ignore the most important feature: the ability to initialise t
....Read More |
Rating
|
|