|
|
|
|
|
|
|
GetFileIcon - Retrieve the icon associated to a file
|
Total Hit (4963) |
«Code LangId=1»Private Const MAX_PATH = 260
Private Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * MAX_PATH
szTypeName As String * 80
End Type
Private Declare Function SHGetFileInfo Lib "Shell32" Alias "SHGetFileInfoA" _
....Read More |
Rating
|
|
|
|
|
RotateRightI - Rotate an Integer to the right
|
Total Hit (1562) |
«Code LangId=1»' Rotate an Integer to the right the specified number of times
'
' NOTE: requires Power2()
Function RotateRightI(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 = ti
....Read More |
Rating
|
|
|
Reduce COM+ context overhead: use non configured classes
|
Total Hit (1597) |
In another item in this Tip Bank (see link below), we mention that you can co-locate secondary instances within the context of the caller. If you don't need any services at all for your secondary components, then you don't have to configure them as COM+ components either. You lose the deployment and
....Read More |
Rating
|
|
|
Create stand-alone type libraries
|
Total Hit (3115) |
Many VB programmers assume that Visual Basic 5.0 is not capable of creating stand-alone Type Libraries, because the documentation states that when an ActiveX component or control is created, the companion Type Library is embedded in the main executable file.
This is correct, but if you own the E
....Read More |
Rating
|
|
|
Hide the Automation Manager
|
Total Hit (3324) |
If you haven't switched to DCOM yet, and still use Remote OLE Automation, you must launch the Automation Manager program on the server machine, in order to let the server respond to requests coming from client workstations.
The Automation Manager displays a visible window at launch time, which t
....Read More |
Rating
|
|
|
|
Highlight current word and line in a TextBox control
|
Total Hit (2992) |
Here's a simple way to highlight the current word in a TextBox control (i.e. the word where the caret is):
«Code LangId=1»
Text1.SetFocus
SendKeys "^{LEFT}+^{RIGHT}"
«/Code»
Similarly, you can highlight the current line in a multiline TextBox control as follows: «Code LangId=1»
Text1.SetFo
....Read More |
Rating
|
|
|
Append a string to a textbox quickly and without flickering
|
Total Hit (2867) |
The usual way to append text to a TextBox or a RichTextBox control is to concatenate the current contents with the new string:
«Code LangId=1»
Text1.Text = Text1.Text & newString
«/Code»
Here is a different approach, which is slightly faster and causes less flickering: «Code LangId=1»
Text1
....Read More |
Rating
|
|
|
Get the canonical name of a file
|
Total Hit (3364) |
In many cases you may need the canonical (or absolute) name of a file, for example when you need to compare two relative file names (relative to the current directory or drive, that is) and decide whether they point to the same or different files.
You can obtain the canonical path of a file usin
....Read More |
Rating
|
|
|
Use integer division operator
|
Total Hit (2876) |
Use "\" instead of "/" when performing divisions between Integers. The "/" operator returns a Single value, therefore the seemingly efficient line
«Code LangId=1»
C% = A% / B%
«/Code»
actually requires three implicit conversions, two for converting the operands from Integer to Single (to pre
....Read More |
Rating
|
|
|
Property Procedures in BAS modules
|
Total Hit (3503) |
Visual Basic supports Property procedures to implement properties in your own CLS and FRM modules. However, it turns out that you can use Property procedures even within BAS code modules.
How can this improve your programming skills? In many a way, as I will demonstrate. Say your program include
....Read More |
Rating
|
|
|
|
Working with Crypto API to encrypt/decrypt text
|
Total Hit (25648) |
This article uses the CRYPTOAPI sample application to demonstrate how to decrypt or encrypt data.
For more information check MSDN article
«b»«a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncapi/html/msdn_cryptapi.asp'»MSDN Article : The Cryptography API, or How to
....Read More |
Rating
|
|
|
|
|
How to get a listview control to sort numbers correctly...
|
Total Hit (2346) |
This is one I discovered after banging my head against the wall for a few hours trying to get a list view control to sort numbers correctly. When trying to create a list view control in report mode that would allow a user to quickly sort by a text listing (in this case a column of state abbreviation
....Read More |
Rating
|
|
|
How to track the download progress
|
Total Hit (2434) |
The Internet Transfer Control (ITC) provides us with a very easy way to retrieve web resources. But unfortunately the control doesn't have any means to track the progress of data transfer. It could be nice if the control ...
|
Rating
|
|
|
An API 'DriveExists' Routine
|
Total Hit (1236) |
For the API purest, here's a tiny function that simply returns True if a specified drive exists, or False if not.
Using GetLogicalDriveStrings, its a simple matter of retrieving all the available drives, then performing a case-insensitive Instr() against the result to determine if the passed drive
....Read More |
Rating
|
|
|
Tiling an Image Across a Form
|
Total Hit (806) |
How to tile an image across the background of any form (except MDI parents). No APIs needed.
|
Rating
|
|
|
GetLastErr
|
Total Hit (942) |
This code snippet returns any error codes from net related functions and system related functions.
Author: Elvio Serrao
|
Rating
|
|
|
Image Processing Using DIB Sections
|
Total Hit (819) |
This sample demonstrates a new 24 bit image processor using the DIB Section GDI object, allowing you to perform a whole raft of standard Image Processing functions, including blurring, sharpening, colourising, resampling and image arithmetic.
|
Rating
|
|
|
QuickStart - Creating an IE Toolbar
|
Total Hit (1942) |
Describes how to use the vbAccelerator CommandBar control by demonstrating how to create a toolbar which looks like the Internet Explorer main toolbar.
|
Rating
|
|