|
|
|
Changing Display Settings on the Fly
|
Total Hit (3825) |
«Code LangId=1»'Place this code in a Module:
'Place this code in a Module:
Option Explicit
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpString1 As _
Any, lpString2 As Any) As Long
Const CCHDEVICENAME = 32
Const CCHFORMNAME = 32
Private Type DEVMODE
dmDevi
....Read More |
Rating
|
|
|
|
|
|
|
ArrayShuffle - Randomize the order of elements in an array
|
Total Hit (3428) |
«Code LangId=1»
' Shuffle the elements of an array of any type
' (it doesn't work with arrays of objects or UDT)
Sub ArrayShuffle(arr As Variant)
Dim index As Long
Dim newIndex As Long
Dim firstIndex As Long
Dim itemCount As Long
Dim tmpValue As Variant
firs
....Read More |
Rating
|
|
|
ReplaceWord - Replace whole words
|
Total Hit (1722) |
«Code LangId=1»' Replace a whole word
Function ReplaceWord(Source As String, Find As String, ReplaceStr As String, _
Optional ByVal Start As Long = 1, Optional Count As Long = -1, _
Optional Compare As VbCompareMethod = vbBinaryCompare) As String
Dim findLen As Long
Dim rep
....Read More |
Rating
|
|
|
Reduce activation delays by sorting DCOM protocol list properly
|
Total Hit (1883) |
When the client and the server machine have different communication protocol lists you can experience serious delays when the client tries to instantiate an object on the server, and you can even get an error if the two protocol lists don't have any protocol in common.
For best response times, us
....Read More |
Rating
|
|
|
The status of shift keys
|
Total Hit (2870) |
Visual Basic lets you test the state of the Shift, Alt and Ctrl keys only within the KeyUp, KeyDown and all the mouse-related event procedures. If you want to test the state of these keys from within another routine, you can resort to the following functions:
«Code LangId=1»
Private Declare Fun
....Read More |
Rating
|
|
|
Find out the Windows version a program require
|
Total Hit (3655) |
Not all programs may run on all the Windows platforms. Often programs require at least a certain version of Windows. In most cases, this is due to the lack of specific functions in the SDK.
Anyway, to detect yourself whether a given EXE file can run under the current version of Windows (without r
....Read More |
Rating
|
|
|
Suppress TreeView's tooltips
|
Total Hit (3476) |
By default, all TreeView controls whose version number is 4.70 or higher display the text of the node under the cursor if the node itself isn't completely visible. You can turn off and on this feature by resetting a bit in the control's style, using the following code:
«Code LangId=1»
Private
....Read More |
Rating
|
|
|
Don't stop timers when a MsgBox is active
|
Total Hit (2076) |
Not all developers know that Timer controls in compiled VB5 and VB6 applications aren't stopped by MsgBox statement, so the Timer's Timer event procedure is regularly executed even when the message box is being displayed on the screen.
However, inside interpreted applications under all VB version
....Read More |
Rating
|
|
|
Load a text file in one operation
|
Total Hit (2826) |
The fastest way to read a text file is using the Input$ function, as shown in this reusable procedure:
«Code LangId=1»
Function FileText (filename$) As String
Dim handle As Integer
handle = FreeFile
Open filename$ For Input As #handle
FileText = Input$(LOF(handle), handle)
....Read More |
Rating
|
|
|
Polymorphic array procedures
|
Total Hit (2262) |
You can create "polymorphic" routines that work with any type of array (except arrays of fixed-length strings, or UDTs) by using Variant parameters. Take for example the following code:
«Code LangId=1»
Function Sum(arr As Variant) As Variant
Dim i As Long
For i = LBound(arr) To UBound(
....Read More |
Rating
|
|
|
How to display Error Line Number in VB
|
Total Hit (2716) |
In VB you can display error line number. Its little tedious job but it works fine. you have assign numbers to lines where you want to track error line number. These line numbers should be unique within function or sub.
|
Rating
|
|
|
How to Encode/Decode URL using API
|
Total Hit (5190) |
Sometimes you might need to Encode/Decode URL programatically. This article will show you how easy it is using 2 undocumented APIs.
Encoding URL means convert any unusual character into escape code (e.g. space will be replaced by %20).
Decoding URL means convert escape code into actaul charac
....Read More |
Rating
|
|
|
Extract and Play individual record stored in WMF/EMF file
|
Total Hit (6937) |
A metafile is a collection of structures that store a picture in a device-independent format. Device independence is the one feature that sets metafiles apart from bitmaps. Unlike a bitmap, a metafile guarantees device independence. There is a drawback to metafiles however, they are generally drawn
....Read More |
Rating
|
|
|
Working with Region API
|
Total Hit (4502) |
A region is a rectangle, polygon, or ellipse (or a combination of two or more of these shapes) that can be filled, painted, inverted, framed, and used to perform hit testing (testing for the cursor location).
From this article you will learn
- Creating regions of different shapes (i.e rectangl
....Read More |
Rating
|
|
|
How to resize window accurately to get desired client area ?
|
Total Hit (7430) |
Sometimes you might get unexpected window size when you resize or assign different height or width. To resize or change window height/width accurately based on required client area you can use AdjustWindowRect or AdjustWindowRectEx api. You can pass required client area as a RECT parameter to Adjus
....Read More |
Rating
|
|
|
|
How to Set a Flat ListView Header Style
|
Total Hit (1185) |
There may be occasions where a flat-looking listview column header suits the design of your application more that the standard default button-style. By obtaining the handle to the header portion of the listview, and toggling its HDS_BUTTON style bits, the header takes on a flat appearance. Setting
....Read More |
Rating
|
|
|
Definitions of the ListView API Members
|
Total Hit (1002) |
This method is intended for Visual Basic 5 or Visual Basic 6 where the Common Control library used is the MSComCtl 5 version (comctl32.ocx). Because the VB6-specific mscomctl.ocx (Common Controls 6) is a complete implementation of comctl32.dll and not reliant on the version of comctl32.dll installed
....Read More |
Rating
|
|
|
Substituting a ListView for a Combo's Dropdown List
|
Total Hit (1038) |
Once the methods to trap the display of a combo's default dropdown list had been coded, substituting another control in place of the dropdown list is as easy as modifying the basic routine to point to the new control. Based on the code listed above, the only changes needed to support a listview cont
....Read More |
Rating
|
|
|
Enumrate Local or Remote Disks
|
Total Hit (1653) |
VB example of using the NetServerDiskEnum API call from within VB. It returns a list of disk drives on a machine (local or remote).
Author: Michael S. Jones
|
Rating
|
|
|
Create a VB Picture from a GDI Picture Handle
|
Total Hit (2681) |
This tip shows you how create a VB Picture object from an GDI bitmap handle (hBitmap). This is useful if you are trying to provide VB users with a picture they can use from a GDI class.
|
Rating
|
|
|
|
Secrets of FTP
|
Total Hit (2539) |
Read our practical introduction to the File Transfer Protocol for Visual Basic developers. You'll find out how to retrieve listings of FTP directories, download and upload files, and how to resume broken file transfer. FTP Quick Reference will help you to learn all the FTP commands and server reply
....Read More |
Rating
|
|
|
Tutorial: Setting data transfer options
|
Total Hit (3337) |
In this tutorial you will learn how to define the method of the data connection establishment and how to specify the data transfer type. For each of these options the CFtpClient class provides separate properties: PassiveMode and TransferMode respectively.
....Read More |
Rating
|
|