|
How to Calculate the Amount of Free Disk Space Available...
|
Total Hit (1867) |
API Declarations
«Code LangId=1»
'API Declarations
Private Declare Function GetDiskFreeSpace Lib "kernel32.dll" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As L
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
|
|
CompareFiles - Check whether two files contain the same data
|
Total Hit (3189) |
«Code LangId=1»' compare two files
' return True if they're equal
Function CompareFiles(ByVal file1 As String, ByVal file2 As String) As Boolean
Dim fnum1 As Integer, isOpen1 As Boolean
Dim fnum2 As Integer, isopen2 As Boolean
Dim buffer1 As String, buffer2 As String
Dim byt
....Read More |
Rating
|
|
|
|
InstrRev - Backward Instr for VB4 and VB5
|
Total Hit (1842) |
«Code LangId=1»' A clone of VB6's InstrRev function (including its quirks)
' that works under VB4 and VB5
Function InstrRev(StringCheck As String, StringMatch As String, _
Optional Start As Long = -1, Optional Compare As VbCompareMethod = _
vbBinaryCompare) As Long
Dim index As
....Read More |
Rating
|
|
|
DecToFrac - Converts a decimal number into a fraction
|
Total Hit (1843) |
«Code LangId=1»' Converts a decimal value into fractional parts as integers
' (based on the concept of Continued Fractions)
' Examples of usage:
' Call DeclToFrac(0.125, a, b) ' 1 and 8 are returned in a & b
' Call DecToFrac(5/40, a, b) ' 1 and 8 are also returned
' Call DecToFrac(2/3
....Read More |
Rating
|
|
|
Reduce activation delays by sorting DCOM protocol list properly
|
Total Hit (1966) |
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
|
|
|
Extract Red,Green,Blue components of a color
|
Total Hit (3046) |
If you have a 32-bit color value in RGB format, you can extract its Red, Green and Blue components using the following routines:
«Code LangId=1»
Function GetRed(ByVal lColor As Long) As Long
GetRed = lColor Mod 256
End Function
Function GetGreen(ByVal lColor As Long) As Long
GetGre
....Read More |
Rating
|
|
|
Display the Connect To Printer dialog
|
Total Hit (5070) |
Under Windows NT you can programmatically display the Connect To Printer dialog using one simple API function:
«Code LangId=1»
' This works only under Windows NT and 2000
Private Declare Function ConnectToPrinterDlg Lib "winspool.drv" (ByVal hWnd As _
Long, ByVal flags As Long) As Long
....Read More |
Rating
|
|
|
Where on Earth is an Add-ins's Description
|
Total Hit (2244) |
Every now and then someone asks me "How can I modify the default description that is associated to an add-in I have written and that appears in the Add-In Manager? I tried to modify the Project's Description attribute, but it didn't work".
The answer is simple, even though this detail is not doc
....Read More |
Rating
|
|
|
Enum constants that include spaces
|
Total Hit (2913) |
If you're writing an ActiveX control, you can create properties that return an enumerated value, as in:
«Code LangId=1»
Public Enum SizeConstants
SizSmall = 1
SizMedium
SizLarge
End Enum
Public Size As SizeConstants
«/Code»
When another developer is using your control, an enu
....Read More |
Rating
|
|
|
|
Check whether a form is loaded
|
Total Hit (2842) |
You can load several instances of the same form, but VB doesn't let you determine how many forms of a given class are currently loaded. You can work around this flaw by iterating over the Forms collection:
«Code LangId=1»
' Return the number of instances of a form
' that are currently loaded
....Read More |
Rating
|
|
|
Remove collection items from the beginning
|
Total Hit (3390) |
There are many different ways to delete all the items in a collection, but some of them are much faster than the others. Let's start with a collection that holds 10,000 items:
«Code LangId=1»
Dim col As New Collection, i As Long
For i = 1 To 10000
col.Add i, CStr(i)
Next
«/Code»
You can d
....Read More |
Rating
|
|
|
How to Autosize ListView columns ?
|
Total Hit (10404) |
This demo will show you how to auto fit all ListView items.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add ListView control on the form1. To add ListView control you need to add reference to Microsoft Windows Common Control 5.0 (Click Project->Components)
- Place the follo
....Read More |
Rating
|
|
|
|
Fading Out Selected Areas Using UpdatedLayeredWindow
|
Total Hit (2213) |
In Windows 2000 and XP, when you click a Start Menu item, such as "Run" an after image of the item you've clicked remains on screen and fades out whilst the Run box starts up. This article provides a reusable form-class you can use to provide this effect in your application.
....Read More |
Rating
|
|
|
How To Transfer Data from ADO Data Source to Excel with ADO
|
Total Hit (1183) |
Because Microsoft Excel is such a powerful data analysis tool, Visual Basic and VBA application developers often want to bring data into an Excel worksheet for analysis purposes. This article describes the ActiveX Data Objects (ADO) approach to this programming task, using Microsoft Jet-specific syn
....Read More |
Rating
|
|
|
Enumrate Local or Remote Disks
|
Total Hit (1827) |
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 (2785) |
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
|
|
|
256 Colour DIBSections
|
Total Hit (2341) |
The Image Processing using DIBSections sample provided on this site shows you how to implement a True-Colour DIBSection in VB. This is great for code which needs an effectively unlimited number of colours to perform effectively (such as blurring, sharpening, resampling and so on) but if you are inte
....Read More |
Rating
|
|
|
Subclassing and Hooking with Machine Code Thunks
|
Total Hit (2108) |
VB's AddressOf is limited in that it can only provide an address to a function within a module, and not one in a class. This makes doing many things with it harder. However, there is a way of getting a callback to a class function, although you need to know a little assembler to do it. Don't worry i
....Read More |
Rating
|
|