|
|
|
|
|
|
|
|
|
|
 |
GetFiles - Returns all the files in a directory
|
Total Hit (1754) |
«Code LangId=1»' Returns a collection holding all the filenames that
' match a given filespec and search attributes.
Function GetFiles(filespec As String, Optional Attributes As VbFileAttribute) _
As Collection
Dim filename As String
Set GetFiles = New Collection
....Read More |
Rating
 |
|
|
 |
Dec2Any - Convert a decimal number to any other base
|
Total Hit (3361) |
«Code LangId=1»' convert a number to any base
' BASE can be in the range 2-36
Function Dec2Any(ByVal number As Long, ByVal base As Integer) As String
Dim index As Long
Dim digits As String
Dim digitValue As Long
' check base
If base < 2 Or base > 36 Then Err.Raise
....Read More |
Rating
 |
|
 |
Setting the off-line mode
|
Total Hit (3952) |
You can programmatically set the Internet Explorer off-line mode with the InternetSetOption API, as this code snippet demonstrates:
«Code LangId=1»
Const INTERNET_OPTION_CONNECTED_STATE = 50
Const INTERNET_STATE_CONNECTED = 1
Const INTERNET_STATE_DISCONNECTED = 2
Const INTERNET_STATE_DISCONNE
....Read More |
Rating
 |
|
 |
Always ensure that a printer is installed
|
Total Hit (2976) |
Many developers incorrectly assume that a printer is always installed on their customers' machines, and therefore omit to check that this is actually the case. The following function, deceiptively trivial, returns False and displays an error message if no printer has been installed:
«Code LangId=
....Read More |
Rating
 |
|
 |
Don't pass Private objects to client applications
|
Total Hit (3011) |
Under some circumstances, an ActiveX DLL can pass private objects to its client application, for example a reference to a control that belongs to a form in the DLL. While this approach can be useful, and can work under some circumstances, you should absolutely avoid avoid to do so, because it might
....Read More |
Rating
 |
|
 |
Better type checking in Variant properties that can accept objects
|
Total Hit (3012) |
As explained in the Mistake Bank you need all three flavors of Property procedures to correctly implement a Variant property that can take either an object or a non-object value. Surprisingly enough, in this case you don't need that the argument of the Property Set procedure be declared As Variant.
....Read More |
Rating
 |
|
 |
Change the width of the dropdown portion of a ComboBox
|
Total Hit (3435) |
The ComboBox control doesn't expose any property that lets you to control the width of its list area, but this can be easily accomplished by sending it the CB_SETDROPPEDWIDTH message, and passing the new length in pixel in wParam:
«Code LangId=1»
Private Declare Function SendMessage Lib "user32"
....Read More |
Rating
 |
|
 |
REMark out a group of lines
|
Total Hit (4512) |
VB5 and VB6 environments include a pair hidden commands that let you remark and unremark a group of statements. These commands are hidden in the sense that they can be found on the secondary Edit toolbar that isn't displayed by default. To make these commands available, right-click anywhere on the m
....Read More |
Rating
 |
|
|
|
 |
How To Print Using Custom Page Sizes on Windows NT and Windows 2000
|
Total Hit (6913) |
Have you ever tried to set custom paper size using VB inbuilt Printer object ??? You can set custom papersize by setting Printer.PaperSize = 256 and then Printer.Height = 4500 , Printer.Width = 7500 but unfortunately this wont work under NT/2000 because in NT each paper size is considered as a "Form
....Read More |
Rating
 |
|
|
 |
How to Obtain the Serial Number of a Drive...
|
Total Hit (1731) |
API Declarations
«Code LangId=1»
'API Declarations
Private Declare Function GetVolumeSerialNumber Lib "kernel32.dll" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponent
....Read More |
Rating
 |
|
|
 |
Creation of an Access database from an XML file
|
Total Hit (1188) |
This class was originally part of a larger project to extract data from a mainframe and present it to Crystal Reports. I selected XML as the data format because it is so flexible and yet easy to generate from COBOL. The code to transport the data from the mainframe and generate the reports has been
....Read More |
Rating
 |
|
 |
Obtaining AVI File Information via API
|
Total Hit (2579) |
This routine shows a couple of things. First and foremost, it details how to retrieve AVI file information from the AVI file using the AVIFileOpen the AVIGetFileInfo APIs. It also shows how to populate a ListView with this information, how to determine the Time Scale for the AVI, and how to use this
....Read More |
Rating
 |
|
 |
Force an area of a Window to Repaint
|
Total Hit (2278) |
This sample shows how to force an area of a window to repaint. Sometimes this is necessary, particularly when you're experimenting with owner draw control techniques, or when using the LockWindowUpdate API call to improve the speed at which a control fills with data.
....Read More |
Rating
 |
|
 |
vbAccelerator Office Docking Bar Control
|
Total Hit (2067) |
This control provides a new container for the vbAccelerator Toolbar and CoolMenu control which allows controls to be docked and undocked to the side of any form. It emulates the style of the Office XP toolbars and provides full support for saving and restoring the layout of the toolbars. It can also
....Read More |
Rating
 |
|
 |
Detecting when another application is activated
|
Total Hit (1074) |
In a form, there is a Deactivate event. Exactly what this method is for is hard to determine, because it hardly ever seems to fire. Ok, that's perhaps a little unfair - it never fires. One thing you certainly can't detect without a bit of additional work is when the user Alt-Tabs to another applicat
....Read More |
Rating
 |
|