 |
Reduce the number of DoEvents
|
| Total Hit (974) |
Don't fill your code with unnecessary DoEvents statements, especially within time-critical loops. If you can't avoid that, at least you can reduce the overhead by invoking DoEvents only every N iterations of the loop, using a statement like this:
«Code LangId=1»
If (loopNdx Mod 10) = 0 Then DoEv
....Read More |
Rating
 |
|
 |
Change the ShowInTaskbar property at runtime
|
| Total Hit (925) |
The ShowInTaskbar property lets you decide whether a form is visible in Windows taskbar or not. However, this property is read-only at runtime, so it seems that you can't change this setting while the program is running. Luckly, you just need to change the window's style, using a pair of API functio
....Read More |
Rating
 |
|
 |
Ensure that a form's TextBox and ComboBox controls have same height
|
| Total Hit (589) |
In general you don't have any control on a ComboBox's Height property, because it is determined automatically by VB depending on the font used for the ComboBox control. If you have a form that contains both TextBox and ComboBox controls, you should ensure that all your single-line TextBox controls a
....Read More |
Rating
 |
|
 |
Storing objects in the Tag property
|
| Total Hit (972) |
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
 |
|
 |
Display the Find system dialog
|
| Total Hit (731) |
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 (799) |
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
 |
|
 |
InstrTblRev - The last occurrence of a char in a table
|
| Total Hit (487) |
«Code LangId=1»' If INCLUDE is True or is omitted, return the last occurrence of a character
' in a group
' or zero if SOURCE doesn't contain any character among those listed in TABLE.
' If INCLUDE is False, return the last occurrence of the character in SOURCE
' that does not appear in TABLE.
....Read More |
Rating
 |
|
 |
ReplicateString - Replicate a string a given number of times
|
| Total Hit (464) |
«Code LangId=1»' Replicate a string a given number of times
Function ReplicateString(Source As String, Times As Long) As String
Dim length As Long, index As Long
' Create the result buffer
length = Len(Source)
ReplicateString = Space$(length * Times)
' do the multiple co
....Read More |
Rating
 |
|
 |
ArraySum - The sum of all the items in an array of any type
|
| Total Hit (575) |
«Code LangId=1»
' Return the sum of the values in an array of any type
' (for string arrays, it concatenates all its elements)
'
' FIRST and LAST indicate which portion of the array
' should be considered; they default to the first
' and last element, respectively
Function ArraySum(arr As
....Read More |
Rating
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
 |
Detecting Keyboard strokes
|
| Total Hit (4576) |
«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
 |
|
 |
Create your own cursor at runtime
|
| Total Hit (917) |
Sometimes you might need to create your own cursor at runtime without using any image or resource. You can achive this functionality using CreateCursor API. Here is the basic guidelines for creating your own cursor.
When you call CreateCursor you have to pass Application handle, Cursor Width, Curso
....Read More |
Rating
 |
|
 |
Appending One File to Another File
|
| Total Hit (1006) |
The following example demonstrates opening and closing files, reading and writing files, and locking and unlocking files. The application appends one file to the end of another file. The application opens the file having the new data appended with permissions that allow only this application to writ
....Read More |
Rating
 |
|
 |
How to start/stop and enum services using ADSI
|
| Total Hit (1574) |
This article will show you sample code to use ADSI to manage services.
«b»Step-By-Step Example«/b»
- Create a new standard exe project
- Add reference to "Active Ds Type Library" (Project->Add Reference)
- Add windows common control 6.0 (Project->Controls)
- Add one listview, five command b
....Read More |
Rating
 |
|
 |
How To Transfer Data from ADO Data Source to Excel with ADO
|
| Total Hit (470) |
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
 |
|
 |
Compositing Operations
|
| Total Hit (718) |
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
 |
|
 |
Reading EXIF and Other Image Properties Using GDI+
|
| Total Hit (625) |
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
 |
|
 |
Moving, Clicking and Tracking the MousePointer in Code
|
| Total Hit (1174) |
VB doesn't provide any way to determine where the mouse is regardless of which control its over. Neither does it allow you to move the cursor or emulate mouse clicks on objects. This tip provides a simple class which uses API functions to add this functionality.
....Read More |
Rating
 |
|
 |
How to Shutdown the System in Windows 9x and NT
|
| Total Hit (899) |
This tip demonstrates how to shutdown, logoff and/or reboot a system. Shutting down a Windows 9x system is very straightforward - just one API call to ExitWindowsEx is all that is required. However, under NT it is a little more tricky. By default, no application processes under Windows NT have the p
....Read More |
Rating
 |
|
 |
Subclassing Listview Scrollbar Messages
|
| Total Hit (261) |
When it is necessary for your application to maintain synchronization between two or more Listview controls - or two or more List boxes for that matter - as the user interacts with the primary ListView's control's scrollbar, subclassing must be used in order to determine the user's interaction refle
....Read More |
Rating
 |
|
|
|
 |
Tutorial - Image List Control Introduction
|
| Total Hit (572) |
The Image List control allows you to add images to your program, which you can use in the other Common Controls (Toolbar, TreeView, ListView etc). To add the ImageList control to your VB project, click Project|Components, and check the box next to Microsoft Windows Common Controls x.x where x is the
....Read More |
Rating
 |
|
 |
Mail Checker Sample Application
|
| Total Hit (801) |
the tutorial that shows you all the steps of creating of the simple application for receiving e-mail.
|
Rating
 |
|