|
Determines the file version number of an executable file
|
Total Hit (2902) |
API Declarations
Option Explicit
'Declarations:
Private Declare Function GetLocaleInfoA Lib "kernel32.dll" (ByVal lLCID As Long, ByVal lLCTYPE As Long, ByVal strLCData As String, ByVal lDataLen As Long) As Long
Private Declare Sub lstrcpyn Lib "kernel32.dll" (ByVal strDest As String, ByVa
....Read More |
Rating
|
|
|
|
|
|
|
|
SystemDirectory - The path of the System directory
|
Total Hit (1893) |
«Code LangId=1»
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
' The path of the System directory
Function SystemDirectory() As String
Dim buffer As String * 512, length As Int
....Read More |
Rating
|
|
|
CBitArray - a class for dealing with large arrays of Boolean
|
Total Hit (2425) |
«Code LangId=1»
' ------------------------------------------------------------------------
' The CBITARRAY class
'
' simiulates an array of Boolean values
' saves memory by packing one element in one bit
'
' IMPORTANT: you make make ITEM the default member for this class
' do
....Read More |
Rating
|
|
|
HasDuplicateValues - Check if an array has duplicate values
|
Total Hit (2638) |
«Code LangId=1»' Returns True if an array contains duplicate values
' it works with arrays of any type
Function HasDuplicateValues(arr As Variant) As Boolean
Dim col As Collection, index As Long
Set col = New Collection
' assume that the array contains duplicates
HasDu
....Read More |
Rating
|
|
|
ChangeFileExtension - Modify the extension in a file name
|
Total Hit (2825) |
«Code LangId=1»
' Change the extension of a file name
' if the last argument is True, it adds the extension even if the file doesn't
' have one
Function ChangeFileExtension(FileName As String, Extension As String, _
Optional AddIfMissing As Boolean) As String
Dim i As Long
For
....Read More |
Rating
|
|
|
Fract - The fractional portion of a number
|
Total Hit (1615) |
«Code LangId=1»' The fractional part of a floating-point number
' note that negative numbers return negative values
Function Fract(number As Variant) As Variant
Fract = number - Fix(number)
End Function
«/Code»
|
Rating
|
|
|
NZ - Check whether a value is Null
|
Total Hit (1764) |
«Code LangId=1»' Check if a value is Null. If not it returns the value,
' otherwise it returns the ValIfNull argument, or zero/null string
' if the second argument is omitted
'
' This function is patterned after the Access function with the same name.
Public Function NZ(CheckVar As Varian
....Read More |
Rating
|
|
|
Implement password-protected TextBox that are really secure
|
Total Hit (3038) |
As explained in another tip in this TipBank, users can peek at the contents of password-protected TextBox controls with a simple Spy-like program, or even with a VB program plus some API functions. The problem is that such TextBox controls react to the WM_GETTEXT message and the GetWindowText API fu
....Read More |
Rating
|
|
|
Change the DataSource at runtime
|
Total Hit (3835) |
Visual Basic 6 is the first VB version that lets you programmatically change the DataSource property at runtime, for example to point to another ADO Data control or another ADO Recordset.
However, when you assign the new DataSource property VB immediately checks that the DataField and DataMember
....Read More |
Rating
|
|
|
Add comments to End If and Loop statements
|
Total Hit (2457) |
Here's a little programming tip that will save you hours of headaches later.
Most of us already indent our Ifs, Selects, Do...Loops, etc., and that is good. But suppose you have some fairly complex code with several levels of indentation. Example:
«Code LangId=1»
If A= 0 and B=1 then
'
....Read More |
Rating
|
|
|
|
How to Convert Long File Name to Short File Name...
|
Total Hit (2972) |
API Declarations
«Code LangId=1» ' API Declare
Private Declare Function GetShortPathName Lib "kernel32.dll" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
«/Code»
Module
«Code LangId=1» Public Function ShortName
....Read More |
Rating
|
|
|
|
clsEMF : A class to Create/Play/Save Enhanced Meta File (EMF).
|
Total Hit (6306) |
Internally, a metafile is an array of variable-length structures called metafile records. The first records in the metafile specify general information such as the resolution of the device on which the picture was created, the dimensions of the picture, and so on. The remaining records, which consti
....Read More |
Rating
|
|
|
Update/Delete Bitmap and String resource using API at runtime
|
Total Hit (12310) |
A Resource File is a repository in executable file (exe/dll/ocx) where you can store images, sounds, videos, data, or whatever you like. VB provides addin to modify resource during design time but what if you want to modify it during runtime. Win32 API is the solution to this problem. There are 3 ma
....Read More |
Rating
|
|
|
|
|
Get IP from Host Name.
|
Total Hit (4129) |
This example will show you how to get IP address from host name and also How to retrive all associated IPs to your local machine.
|
Rating
|
|
|
How to open a file with Wordpad or Notepad
|
Total Hit (3010) |
I tried to find sourcecode which allows me to open a file with any extension with Wordpad and Notepad. And finally I came up with this solution.
Happy Programming....
|
Rating
|
|
|
|
Changing the Combo Dropdown Height
|
Total Hit (723) |
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
|
|
|
Displaying Bitmaps as Icons in Windows' Explorer View
|
Total Hit (712) |
As the Visual Basic developer designs more and more apps that utilize tiny bitmaps for toolbars and other things, it quickly becomes apparent that keeping track of exactly what each bitmap looks like is a task in itself.
|
Rating
|
|
|
|
Reading and Writing JPG, PNG, TIF and GIF Files
|
Total Hit (874) |
This article demonstrates using GDI+ to read and write files in multiple formats (JPEG, PNG, TIF, GIF and BMP files are all supported for reading and writing; you can also read EMG, WMF and ICO files).
Using GDI+ is a great alternative to using the Intel JPEG Library that is now no longer distri
....Read More |
Rating
|
|
|
vbAccelerator No Status Bar Control
|
Total Hit (698) |
This article provides a small class which implements all of the StatusBar functionality you're likely to need in an application with none of the distribution headaches associated with a control. The latest version supports XP Style drawing and frankly looks quite great.
....Read More |
Rating
|
|