|
|
Sharing Data Between Processes Using Memory-Mapped Files
|
Total Hit (16283) |
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
|
|
|
How to disable word wrap in RichTextBox control
|
Total Hit (2863) |
By default rich textbox control wrap a long line. Sometimes we want to disable this inbuilt feature then here is some trick.
set RightMargin property to an arbitary high value which will not wrap your long line.
Happy Programming....
|
Rating
|
|
|
|
|
|
ListBoxEnsureVisible - Ensure that a ListBox element is visible
|
Total Hit (2187) |
«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 (2788) |
«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 (1900) |
«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 (1632) |
«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
|
|
|
CompareList - Compare an argument with a list of values
|
Total Hit (2372) |
«Code LangId=1»
' Return the position of the argument in a list of values
' or zero if the argument isn't included in the list
' It works for both regular values and for objects
'
' This handy function can often save you a lengthy Select Case
' statement or a complex series of If...ElseIf blo
....Read More |
Rating
|
|
|
Display the Find system dialog
|
Total Hit (3193) |
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
|
|
|
Wait for the termination of a program using Windows Scripting Host
|
Total Hit (2707) |
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
|
|
|
Undo changes in a TextBox control
|
Total Hit (3812) |
The TextBox control supports the capability to undo changes, but there is no property or method that exposes this feature. You can achieve the same goal with a a set of messages.
«Code LangId=1»
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hwnd As Long,
....Read More |
Rating
|
|
|
Convert a VB6 project back to VB5
|
Total Hit (2336) |
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
|
|
|
Create a system timer using AddressOf and a callback function
|
Total Hit (4003) |
The Timer control is great when you want to periodically execute a piece of code while the program is doing something else. However, it also has a couple of shortcomings: (1) it requires a parent form, so you can't use it directly inside a BAS module, and (2) it's Interval property can't be higher t
....Read More |
Rating
|
|
|
Simple variables are always faster than array elements
|
Total Hit (2681) |
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
|
|
|
Detecting Keyboard strokes
|
Total Hit (15615) |
«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 (2801) |
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
|
|
|
Tutorial - TreeView Control Introduction
|
Total Hit (1762) |
The Tree View control is a Visual Basic version of the control you see used in many programs, including Explorer and FrontPage, used to list the folders on your hard disk. This control allows you to add nodes to a tree, each of which can have sub items. Below is an image of the Tree View control in
....Read More |
Rating
|
|
|
HOWTO: Navigate Excel Objects from Visual Basic
|
Total Hit (2175) |
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 (964) |
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
|
|
|
Applying Special Effects to a TreeView
|
Total Hit (999) |
The treeview is a special beast ... compared to the listview, in my opinion, a lot more complicated to manipulate via API. Instead of referring to items as simple indices based on order, each treeview item has an item handle, and it is this that is used when manipulating treeview items (see the cod
....Read More |
Rating
|
|
|
Duplicating List Contents to Another List or Combo Using SendMessage
|
Total Hit (1502) |
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
|
|
|
Reading EXIF and Other Image Properties Using GDI+
|
Total Hit (1298) |
Many digital cameras record information about when and how a picture was taken using the EXIF format (which is slowly becoming the DCF format under ISO). You can read and write this information using GDI+; not just that but you can also read the image metadata from TIF and PNG files.
....Read More |
Rating
|
|
|
Compositing Operations
|
Total Hit (2067) |
There are various ways of combining two images together, particularly when either or both of the two images contain alpha channels. As the real-time video-effects industry has developed, twelve standard compositing techniques, know as the Porter-Duff Compositing Operations, have emerged. In addition
....Read More |
Rating
|
|
|
Creating Drop-Shadows
|
Total Hit (2085) |
Demonstrates how to create drop-shadows for windows and controls using the same technique used by Office XP/VS.NET CommandBars.
|
Rating
|
|