|
How to detect system activity for mouse and keyboard
|
Total Hit (2607) |
«Code LangId=1»Option Explicit
'===========================================================
'TYPE
'===========================================================
Private Type POINTAPI
x As Integer
y As Integer
End Type
'===========================================================
'API
'=====
....Read More |
Rating
|
|
|
|
|
|
|
ArrayAny - Return an initialized array of any type
|
Total Hit (2043) |
«Code LangId=1»
' Returns an array and initializes it with passed data.
'
' It is similar to the Array function, but it works with
' array of any type. The type of the returned array is
' assumed to be the type of the first element in the
' parameter list, so you might need to force a given
....Read More |
Rating
|
|
|
|
RotateLeftI - Rotate an Integer to the left
|
Total Hit (1771) |
«Code LangId=1»' Rotate an Integer to the left the specified number of times
'
' NOTE: requires Power2()
Function RotateLeftI(ByVal value As Integer, ByVal times As Long) As Integer
Dim i As Long, signBits As Integer
' no need to rotate more times than required
times = time
....Read More |
Rating
|
|
|
|
BitTest - Test the value of a bit
|
Total Hit (3502) |
«Code LangId=1»' Test the value of a bit
'
' NOTE: requires Power2()
Function BitTest(ByVal value As Long, ByVal bit As Long) As Boolean
' simply AND with the bit mask
' Range checking is performed in Power2()
BitTest = (value And Power2(bit))
End Function
' Raise 2 to a po
....Read More |
Rating
|
|
|
Don't store object variables in the SPM
|
Total Hit (2599) |
Some MTS/COM+ newbies wonder whether it is legal to store object variables in the SPM.
No, you can't!! the SPM is unaware of Apartment marshaling issues. If you ask the SPM for an interface pointer while running in an apartment that is different from the one where the interface pointer resides t
....Read More |
Rating
|
|
|
Out-of-date dependency file for COMCTL32.OCX
|
Total Hit (2099) |
Have you ever read a message like "Dependency file for COMCTL32.OCX is out of date" during the package creation process? The cause of this problem is simple: you have installed an application that has replaced your COMCTL32.OCX ActiveX with the newer release (which is 5.00.3828 at this time). The Ac
....Read More |
Rating
|
|
|
Open the Internet Connection dialog
|
Total Hit (3706) |
The dialog you see when you start an Internet connection is implemented in the RNAUI.DLL file, and the specific function is called RnaDial. To open this dialog from your application you can call this function through the rundll32.exe application (located in Windows directory) specifying the name of
....Read More |
Rating
|
|
|
Get the Windows temporary directory (without any API call)
|
Total Hit (3074) |
The usual way to determine the Windows' main directory is based on the GetTempPath API function, which requires that you set up a buffer for the result, and then extract the null-terminated result. However, there is a much simpler approach, that works equally well under Windows 95, 98 and NT. It is
....Read More |
Rating
|
|
|
Add a file to the list of recent documents
|
Total Hit (2859) |
The Windows shell provides a function that lets you add a file to the list of the recent documents, that is the list that you can access from the Start menu:
«Code LangId=1»
Private Declare Function SHAddToRecentDocs Lib "shell32.dll" (ByVal dwFlags As _
Long, ByVal dwData As String) As Lon
....Read More |
Rating
|
|
|
|
Start the IDE with maximized code and form windows
|
Total Hit (2210) |
The VB IDE remembers most of the configuration settings that were active when you closed the previous session. However, the maximized status of child MDI windows (the code editor and the designer window) isn't remembered, and the IDE always starts with non-maximized windows. To have VB always start
....Read More |
Rating
|
|
|
Write concise code with the InStr function
|
Total Hit (2045) |
You can often use the Instr function in an unorthodox way to write more concise code. A typical example is when you need to test a single character:
«Code LangId=1»
' test whether CHAR contains a vowel
' the standard way
If UCase$(char) = "A" Or UCase$(char) = "E" Or UCase$(char) = "I" Or UCas
....Read More |
Rating
|
|
|
LenB has changed from VB5 to VB6
|
Total Hit (4218) |
Visual Basic stores UDTs in unpacked format, that is it alignes all UDT elements to the double word (except that Integers and Boolean are aligned to the word, and byte elements aren't aligned at all). To keep the elements aligned VB adds padding bytes where necessary. For instance the structure:
«
....Read More |
Rating
|
|
|
|
Working with Basic Filled Shapes using GDI API
|
Total Hit (5662) |
Filled shapes are geometric forms that are outlined by using the current pen and filled by using the current brush. There are five filled shapes:
«UL»«LI»Ellipse
«LI»Chord
«LI»Pie
«LI»Polygon
«LI»Rectangle «/UL»
Applications use filled shapes for a variety of tasks. Spreadsheet applicat
....Read More |
Rating
|
|
|
Connecting to Network Resources
|
Total Hit (1631) |
These are small network routines that provide developers with increased functionality and usability.
The first two routines deal with displaying the Map Drive and Disconnect Mapped Drive dialogs.
The second two deal with printers; the first shows the Windows dialog responsible for setting up a
....Read More |
Rating
|
|
|
|
Creating a Custom PhotoShop-Style ProgressBar
|
Total Hit (899) |
The routines on this page were originally developed to overcome display limitations of the original VB3 SSPanel FloodPercent control, namely use of and justification of text and the positioning the control as a member of a status panel. The routine was originally developed in VB3 and has been update
....Read More |
Rating
|
|
|
Manipulating Image Brightness with SetPixelV
|
Total Hit (1231) |
Here's an interesting bit of code by Tanner Helland that takes any image assigned to a picturebox and rapidly adjusts the image brightness. As the new image is displayed, it progressively wipes overtop the old image (the demo picture shows the progress half-way across the girl). This code could be e
....Read More |
Rating
|
|
|
Calling the Windows PrintScreen Function Using keybd_event
|
Total Hit (615) |
The following code will copy the contents of the desktop (the screen) into a PictureBox or image control on a form.
Unlike the examples listed at the top of this page, this method uses the Windows API to actually PrintScreen to the clipboard first, and then retrieve that bitmap into the image con
....Read More |
Rating
|
|
|
Working with Multiple Monitors
|
Total Hit (2820) |
Windows 98/2000 systems and above provide support for multiple monitors. This is a great thing except that it messes up old programs which attempt to do things like centre Windows or otherwise restrict their position to the visible area of the screen. This tip provides some simple code to allow you
....Read More |
Rating
|
|
|
vbAccelerator Icon Selector Control
|
Total Hit (2534) |
This control provides a simple to use icon selector, and works in the exactly the same way as the Change Icon dialog in Windows. You can either use it to select existing icons, or you can add your own.
|
Rating
|
|
|
Creating Single Pixel Dotted Lines
|
Total Hit (1578) |
One of the drawing features which makes many of the Windows controls draw attractively is the use of single pixel on-off dotted lines. For example, the TreeView control uses these to draw lines, and they are often used in bounding box selections and drag and drop operations.
Unfortunately VB does
....Read More |
Rating
|
|
|
How to Create Constants and DLL Declarations in a Type Library
|
Total Hit (1614) |
It can be very useful to package constant definitions and DLL declarations in a type Library. Visual Basic allows you to access type libraries and their contents. Once you have made a reference to the type library, you can view its information in Visual Basic's own Object Browser. Type Libraries are
....Read More |
Rating
|
|