|
|
|
|
|
Moving a Window Without a Titlebar
|
Total Hit (3522) |
«Code LangId=1»'Place this code in the declarations section of your form:
Option Explicit
Declare Function ReleaseCapture Lib "user32" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Lo
....Read More |
Rating
|
|
|
|
|
ListBoxEnsureVisible - Ensure that a ListBox element is visible
|
Total Hit (2272) |
«Code LangId=1»' ensure that a listbox item is visible
' if the second argument is omitted, the index of current item is used
'
' NOTE: uses the ListBoxVisibleItems function
Sub ListBoxEnsureVisible(lst As ListBox, Optional ByVal itemIndex As Long = -1)
Dim visibleCount As Long
....Read More |
Rating
|
|
|
GetDBDate - Formatting a date as a DateSerial for Access
|
Total Hit (2903) |
«Code LangId=1»' Format a date as a DateSerial for Access
' Example: Debug.Print GetDBDate(date)
Public Function GetDBDate(sDate As String) As String
On Error GoTo ERROR_GetDBDate
Dim sTmp As String
If IsDate(sDate) = False Then
sTmp = sDate
Else
sTmp = "DateSe
....Read More |
Rating
|
|
|
Soundex - Determine the phonetic code of a word
|
Total Hit (1956) |
«Code LangId=1»
' The Soundex code of an alphabetical string
'
' you can use Soundex code for phonetic searches
' Beware: this isn't bullet-proof!
'
' UPDATE: this version corrects a bug in the original routine
' thanks to Edward Wittke for spotting the mistake
Function Soundex(By
....Read More |
Rating
|
|
|
GCD - The Greatest Common Divisor of two integers
|
Total Hit (1695) |
«Code LangId=1»' the Greatest Common Divisor of two integers
' (it uses the Euclide's algorithm)
' if either argument is zero you get a "Division by Zero" error
Function GCD(ByVal n1 As Long, ByVal n2 As Long) As Long
Dim tmp As Long
Do
' swap the items so that n1 >= n2
....Read More |
Rating
|
|
|
Display the Find system dialog
|
Total Hit (3286) |
If you ever needed to programmatically enable your users to search for files, you certainly found useful the possibility of reusing the system Find dialog integrated in the Start menu and also available through the F3 key within the Explorer. The key to obtain such a dialog is the ShellExecute funct
....Read More |
Rating
|
|
|
Open a Control Panel dialog or wizard
|
Total Hit (2760) |
Have you ever needed to open a Windows dialog such as Internet Properties, New Hardware, Modem Properties or any other dialog you can find in the Control Panel? Well, it's very simple, onve you know the trick.
All these dialogs are implemented in files with the CPL extension. (They're actually D
....Read More |
Rating
|
|
|
Wait for the termination of a program using Windows Scripting Host
|
Total Hit (2766) |
If you want to execute an application and waiting for its termination, you can follow two approaches. The "classic" approach is based on API functions such as OpenProcess, WaitForSingleObject and CloseHandle. However, there is a simpler technique based on the Windows Scripting Host object model.
....Read More |
Rating
|
|
|
Copy the contents of the screen or the active window
|
Total Hit (5523) |
The standard way to copy the contents of the screen or a window to a picture box requires you to use a lot of API functions, such as BitBlt. A simpler approach is possible, though: you just have to simulate the typing of the Print Screen key (or Alt+Print Screen if you want to copy the contents of t
....Read More |
Rating
|
|
|
Storing objects in the Tag property
|
Total Hit (4558) |
The Tag property exposed by many Windows Common Controls (including TreeView's Node objects and ListView's ListItem objects) is more versatile than the ListBox and ComboBox controls' ItemData property, because it is of Variant type and can therefore accept values of most data types.
However, it
....Read More |
Rating
|
|
|
Convert a VB6 project back to VB5
|
Total Hit (2413) |
If you load a VB6 project file in the VB5 environment you get a warning, even though the project is correctly loaded. The cause of the warning is a VB6 attribute "Retained" (that is, the "Retained in memory" option in the Project Properties dialog box) that isn't recognized by VB5. If you want to ma
....Read More |
Rating
|
|
|
Simple variables are always faster than array elements
|
Total Hit (2795) |
Reading and writing an item of an array is always slower than accessing a simple variable. Therefore, if you need to repeatedly use the same array item in a loop, you should assign it to a temporary variable and use that variable instead. I've included an example of this technique that scans an Inte
....Read More |
Rating
|
|
|
Sharing Data Between Processes Using Memory-Mapped Files
|
Total Hit (16733) |
Memory-mapped files provide a way to look at a file as a chunk of memory. This feature is very useful in languages that support examining memory at arbitrary addresses. You map the file and get back a pointer to the mapped memory. You can simply read or write to memory from any location in the file
....Read More |
Rating
|
|
|
Optimize Parametrized Queries With ADO Objects
|
Total Hit (3144) |
When you write Insert statements, it can be difficult to accommodate the possible values end users might enter into a textbox. The most common task is replacing single quotes with double quotes. However, parameterized queries provide two benefits: You do not have to parse data entered by users—excep
....Read More |
Rating
|
|
|
|
Detecting Keyboard strokes
|
Total Hit (15750) |
«code LangId=1»'In a module
'***************************
'* Keyboard constants
'***************************
Public Const VK_ACCEPT = &H1E
Public Const VK_ADD = &H6B
Public Const VK_APPS = &H5D
Public Const VK_ATTN = &HF6
Public Const VK_BACK = &H8
Public Const VK_BROWSER_BACK = &HA6
Public
....Read More |
Rating
|
|
|
Binary download with the Internet Transfer Control by Mikael Östberg
|
Total Hit (2931) |
Have you ever wanted to retrieve information automatically from another web page and display it on your own web page? There are a couple of ways to do this. One way, which I am going to show you in this article, is using the Microsoft Internet Transfer Control, also known as the Inet Control. It is
....Read More |
Rating
|
|
|
HOWTO: Navigate Excel Objects from Visual Basic
|
Total Hit (2276) |
This article explains three methods you can use to navigate and access Microsoft Excel Application objects:
«LI»Using longhand and default properties
«LI»Using aliasing
«LI»Using the Parent and Application methods of Microsoft Excel version 5.0 objects to access any Microsoft Excel object
....Read More |
Rating
|
|
|
|
How to Track Cursor Movement in a ListView
|
Total Hit (1052) |
The methods presented here are a bit different. The first (Check1) causes the mouse cursor to change into a hand, and as it moves over the ListView items, causes the item below to become underlined as a visual aid. This is similar to the visual clue in Internet Explorer when a hyperlink is encounter
....Read More |
Rating
|
|
|
Duplicating List Contents to Another List or Combo Using SendMessage
|
Total Hit (1598) |
You may encounter the need to quickly duplicate the contents of a listbox to another listbox, or to a combo box (or vice-versa). While there is no non-looping method available the use of SendMessage can speed up the copying, especially in situations where a large amount of data is to be duplicated.
....Read More |
Rating
|
|
|
Filling Polygonal Regions Using ExtFloodFill
|
Total Hit (1537) |
Here's a quickie one-form demo that shows how to use the ExtFloodFill API to construct a child's drawing canvas that can save and reload a picture.
When the left mouse is pressed, lines are drawn on the picturebox in response to a drag. When the right mouse is pressed, a random colour fills the in
....Read More |
Rating
|
|
|
GDI+ Wrapper
|
Total Hit (2434) |
The GDI+ Wrapper project is a DLL that works on top of Dana Seaman's excellent GDI+ Type Library and aims to provide COM applications with a wrapper providing equivalent functionality to the C++ and .NET GDI+ classes.
The current version provides support for Images and Bitmaps. Further contribut
....Read More |
Rating
|
|
|
Creating Drop-Shadows
|
Total Hit (2187) |
Demonstrates how to create drop-shadows for windows and controls using the same technique used by Office XP/VS.NET CommandBars.
|
Rating
|
|