|
|
|
|
|
|
GetTreeViewNodeHandle - The handle of any node in a TreeView
|
Total Hit (3268) |
«Code LangId=1»
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Const TVM_GETNEXTITEM = &H110A
Private Const TVGN_CARET = 9
' The handle of any node in a TreeVie
....Read More |
Rating
|
|
|
GetFileVersionData - Retrieve file versioning information
|
Total Hit (2264) |
«Code LangId=1»Private Declare Function GetFileVersionInfoSize Lib "version.dll" Alias _
"GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, _
lpdwHandle As Long) As Long
Private Declare Function GetFileVersionInfo Lib "version.dll" Alias _
"GetFileVersionInfoA" (ByVal lptstr
....Read More |
Rating
|
|
|
VolumeLabel - Read the label of a disk volume
|
Total Hit (1750) |
«Code LangId=1»' Return the volume label of a disk
' Pass a null string for the current disk
Function VolumeLabel(drive As String) As String
Dim temp As String
On Error Resume Next
temp = Dir$(drive, vbVolume)
' remove the period after the eigth character
VolumeLabel =
....Read More |
Rating
|
|
|
|
InstrTbl - Search a string for any character in a table
|
Total Hit (1690) |
«Code LangId=1»
' If INCLUDE is True or is omitted, return the first occurrence of a character
' in a group
' or zero if SOURCE doesn't contain any character among those listed in TABLE.
' If INCLUDE is False, return the first occurrence of the character in SOURCE
' that does not appear in TAB
....Read More |
Rating
|
|
|
Disable the Ctrl-Alt-Del key combination (Windows 9x only)
|
Total Hit (3808) |
In Windows 95 and 98, when the screen saver is currently active (and the screen is blanked) the Ctrl-Alt-Del key combination doesn't work, in order to force the user to enter her password. You can take advantage of this feature and programmatically disable this key combination, by making Windows bel
....Read More |
Rating
|
|
|
Extract RGB components from a Long value
|
Total Hit (3093) |
You can extract RGB values out of a 32-bit color value by using the integer division and the MOD operators, but there is a much more effective way, based on the LSet. You can convert from a long to rgb bytes and vice versa with the following code:
«Code LangId=1»
Private Type RGBWrapper
Red
....Read More |
Rating
|
|
|
Quickly build a simple About form
|
Total Hit (2303) |
If you need a quick-and-dirty About dialog box for your application, that maintains a consistent look with other Windows applications, look no further than the ShellAbout routine in SHELL32.DLL. Using this function you have little control on what the dialog displays, and you can only customize the P
....Read More |
Rating
|
|
|
Don't use SetFocus on invisible controls
|
Total Hit (2091) |
In the Show event of a form you might be tempted to use SetFocus to select which field the end user should begin working with. However, this method raises an error 5 when applied on a control that is currently invisible.
If the logic of your application should give the focus always to the same c
....Read More |
Rating
|
|
|
Get a reference to a form given its name
|
Total Hit (1970) |
In some cases you might want to activate a form given its name, but VB doesn't let you do it directly. However, it is easy to create a function that does it by iterating over all the forms in the current project:
|
Rating
|
|
|
Always use "$-typed" string functions
|
Total Hit (2876) |
VB official documentation seems to encourage you to use "$-less" string functions, e.g. Left, LTrim or UCase, instead of their time-honored Left$, LTrim$ and UCase$ counterparts. If you do so, however, you should be aware that the former ones return a variant value that, when used within string expr
....Read More |
Rating
|
|
|
Short-circuit evaluation with Select Case
|
Total Hit (3957) |
Short-circuit evaluation is an optimization technique automatically adopted by most modern compilers, including all flavors of C++, Borland Delphi and many others. Unfortunately, the Visual Basic compiler is not in this group. This optimization cuts down the time needed to evaluate a boolean express
....Read More |
Rating
|
|
|
|
|
High quality image scaling
|
Total Hit (2812) |
Have you ever tried to use StretchBlt to resize image. Yep its easy to use with VB but if you use it without setting correct "Stretch Mode" it wont be a high quality image. To get high quality stretched image you can call SetStretchBltMode and set HALFTONE mode for highest quality image resizing. Fo
....Read More |
Rating
|
|
|
Get CPU name using low level machine instructions (Assembly!) in VB!
|
Total Hit (4114) |
Here is the most advanced technique probably you have ever seen in VB. Haven't you been told by the "experts" that you can't do low level programming stuff in VB which you can do in C/C++/ASM ? But here I shall prove them wrong. This little code will demonstrate how to execute low level Machine inst
....Read More |
Rating
|
|
|
|
|
How to Set Item Indentation in a ListView
|
Total Hit (782) |
Many people erroneously believe that the 'control' used in displaying hierarchical data such as Outlook Express' news reader view is a treeview control with columns. Actually, the control is a ListView taking advantage of the comctl version 4-specific Indent member of the LV_ITEM structure. This pag
....Read More |
Rating
|
|
|
Determining Free Disk Space on a Fat32 (or NTFS) Drive
|
Total Hit (1837) |
The routine presented here will return the correct free and used disk sizes on volumes over 2 gigabytes as supported by the FAT32 partitions implemented in Windows95 OEM Service Pack 2, aka OSR2, and in Windows 98 where the Fat32 drive conversion has been made, or on NTFS partitions on NT4, Windows
....Read More |
Rating
|
|
|
ListView Demo 1 - Obtaining the File Path
|
Total Hit (1078) |
This page details the code required to construct the base form, and the code necessary to retrieve the user's selection using the Windows Browse dialog.
When the demo is completed, the final app will retrieve the users selection and populate the listview with selected files from that folder, comp
....Read More |
Rating
|
|
|
Displaying a Balloon Tip in a Combo Box
|
Total Hit (1209) |
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
|
|
|
Blend Two Colours Together Using Alpha
|
Total Hit (1539) |
If you're not using GDI+ for drawing, then there isn't an easy way to determine what colour you would get if you blended two colours together with a specified alpha amount. This article provides a routine that allows you to do it using straight VB code.
....Read More |
Rating
|
|
|
|
Scale, Rotate, Skew and Transform Images using GDI+
|
Total Hit (1761) |
GDI+'s image rendering is considerably more powerful than the basic bitmap transfer functions provided under GDI. You can perform high-quality rotation, scaling and skewing with no additional lines of code: and better still the functions run very fast on half decent machines.
....Read More |
Rating
|
|