|
|
 |
Update/Delete Bitmap and String resource using API at runtime
|
Total Hit (12596) |
A Resource File is a repository in executable file (exe/dll/ocx) where you can store images, sounds, videos, data, or whatever you like. VB provides addin to modify resource during design time but what if you want to modify it during runtime. Win32 API is the solution to this problem. There are 3 ma
....Read More |
Rating
 |
|
|
 |
Check Access Rights to File/Directory on NTFS Volume
|
Total Hit (7047) |
Windows NT/2000/XP has API function AccessCheck, which in fact checks access rights to every operating system object, which supports access rights. This function is called implicitly by system every time user accesses such object. To call AccessCheck function explicitly it is necessary to carry out
....Read More |
Rating
 |
|
|
|
|
|
|
 |
GetShortFileName - Convert a filename to 8.3 format
|
Total Hit (4436) |
«Code LangId=1»
Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
' Convert a long filename into the short 8.3 format
' if the file doesn't exist, retur
....Read More |
Rating
 |
|
 |
SystemDirectory - The path of the System directory
|
Total Hit (1963) |
«Code LangId=1»
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
' The path of the System directory
Function SystemDirectory() As String
Dim buffer As String * 512, length As Int
....Read More |
Rating
 |
|
 |
Disable COM+ 1.5 applications and components
|
Total Hit (3077) |
COM+ 1.5 (provided with Windows XP) has an interesting feature that is missing in COM+ 1.0: the ability to disable entire COM+ applications or just their individual components. You can disable and re-enable a COM+ application or component by right-clicking on it in the Component Services MMC explore
....Read More |
Rating
 |
|
 |
Convert a color value to a gray scale
|
Total Hit (3478) |
When you have a 32-bit color value, you can convert it to a grey-scale - that is, you can determine how it would appear on a monochromatic display (more or less) using the following function:
«Code LangId=1»
Function GetGreyScale(ByVal lColor As Long)
lColor = 0.33 * (lColor Mod 256) + 0.59
....Read More |
Rating
 |
|
|
 |
UseMnemonics property for bound Label controls
|
Total Hit (2313) |
If your forms contain Label controls used to display data from a database, set their UseMnemonic property to False. In fact, if you leave this property to its default value (True), ampersand "&" characters won't be showed correctly, and the Label will mistakenly react to hotkeys.
....Read More |
Rating
 |
|
 |
Understanding the "Allow Unrounded Floating Point Operations" option
|
Total Hit (3120) |
The Microsoft manuals preach that all the compiler options in the Advanced Optimization dialog box are to be considered unsafe, in that they might lead to incorrect results (or just program crashes!). This is true for most of them, but often one of such options - namely, the "Allow Unrounded Floatin
....Read More |
Rating
 |
|
 |
A simple expression evaluator
|
Total Hit (3642) |
While any Windows user could pop up the Calculator accessory to perform any type of math calculations, it would be great if you could offer him or her the capability to do simple math from within your application. This is a very simple expression evaluator function that does it:
This evaluator i
....Read More |
Rating
 |
|
 |
Evaluate an expression at runtime
|
Total Hit (3822) |
The .NET framework doesn't offer any direct way to evaluate an expression that has been entered by the end user when the application is running. However, it is quite simple to create a simple expression evaluator based on calculated columns in DataTable. The following routine does the trick:
«Cod
....Read More |
Rating
 |
|
|
 |
Sending Data using socket.
|
Total Hit (5420) |
In the previous article we learned the recv Winsock API function which is used to read incoming data from the Winsock buffer. Today we'll see how to write data to the Winsock buffer for sending that data to a remote host. That is, actually, the send Winsock API function is not to send data. It just
....Read More |
Rating
 |
|
 |
Adding a VB Toolbar to a VB StatusBar
|
Total Hit (1343) |
This code was prompted by a newsgroup request for code to place a VB command button inside a VB statusbar such that the button reacted normally to events yet was contained inside the status bar panel area. Attempts to use SetParent against the command button worked to re-parent the control, however
....Read More |
Rating
 |
|
 |
How to Programmatically Select and Deselect All ListItems
|
Total Hit (1548) |
Using conventional methods, selecting and deselecting all items in a ListView typically involves iterating through the ListItems collection to set each item's selected property. By utilizing the SendMessage API with LVIS_SELECTED, this monotony can be reduced to a single call.
Note that this meth
....Read More |
Rating
 |
|
|
 |
A Fast Index-Based Collection
|
Total Hit (1815) |
VB provides a simple Collection for storing objects. However, this object is internally implemented as a hashed linked list, and as such provides good performance for access either by an item's key or through enumeration. If you want to access an object by its index, however, you need to enumerate t
....Read More |
Rating
 |
|
 |
vbAccelerator No Status Bar Control
|
Total Hit (731) |
This article provides a small class which implements all of the StatusBar functionality you're likely to need in an application with none of the distribution headaches associated with a control. The latest version supports XP Style drawing and frankly looks quite great.
....Read More |
Rating
 |
|
 |
Subclassing Without The Crashes
|
Total Hit (2623) |
Prior to VB5, it was impossible to subclass a control without relying on a proprietary custom control. This greatly restricted what you could do if you wanted to play around with some of the neater customisation features - creating a new control was completely out, finding out in detail what was goi
....Read More |
Rating
 |
|
 |
A window that's star-shaped, circular or tank-shaped
|
Total Hit (2725) |
Just for fun, its surprisingly easy now to create Windows or controls of any shape whatsoever under Visual Basic. This article demonstrates using SetWindowsRgn to create Windows with a variety of geometric shapes.
|
Rating
 |
|
 |
File Clipboard Enhancer
|
Total Hit (1951) |
Windows Explorer allows you to cut, copy and paste files. However, whilst it uses the clipboard to do this, the file information is not made generally accessible as a custom clipboard is used. Often it's useful to be able to paste a file name as text: for example, into a file name field in an applic
....Read More |
Rating
 |
|
 |
Introduction to the freeware Info-ZIP libraries
|
Total Hit (2026) |
This project started when I was trying to build up the indexes for the vbAccelerator site. I had a program to search through all the HTML files which make up the site, and this could pick out the ZIP files linked to by the pages. But how to determine which projects these ZIP files contained? You nee
....Read More |
Rating
 |
|