|
|
|
|
|
|
|
|
|
|
ShellSort - Sort Arrays using the ShellSort Algorithm
|
Total Hit (1663) |
«Code LangId=1»
' ShellSort an array of any type
'
' ShellSort behaves pretty well with arrays of any size, even
' if the array is already "nearly-sorted", even though in
' particular cases BubbleSort or QuickSort can be more efficient.
'
' LASTEL is the index of the last item to be sorted,
....Read More |
Rating
|
|
|
ReplaceArgs - Replace numbered placeholders in a string
|
Total Hit (1649) |
«Code LangId=1»' Replace placeholders in the form @@1, @@2, etc.
' with arguments passed after the first one.
' For example, calling this function with
' res = ReplaceArgs("File @@1 not found on drive @@2", "README.TXT", "C:")
' it returns the string
' "File README.TXT not found in drive
....Read More |
Rating
|
|
|
BitSet - Set a bit in a number
|
Total Hit (2887) |
«Code LangId=1»' Set a bit in a value
'
' NOTE: requires Power2()
Function BitSet(ByVal value As Long, ByVal bit As Long) As Long
' simply OR with the bit mask
' Range checking is performed in Power2()
BitSet = (value Or Power2(bit))
End Function
' Raise 2 to a power
' the e
....Read More |
Rating
|
|
|
|
RotateLeft - Rotate a Long to the left
|
Total Hit (1793) |
«Code LangId=1»' Rotate a Long to the left the specified number of times
'
' NOTE: requires Power2()
Function RotateLeft(ByVal value As Long, ByVal times As Long) As Long
Dim i As Long, signBits As Long
' no need to rotate more times than required
times = times Mod 32
....Read More |
Rating
|
|
|
KeepInRange - Ensure that a value is in a given range
|
Total Hit (1607) |
«Code LangId=1»' Keep the first argument in the range [lowLimit, highLimit]
' If the value is adjusted, the fourth (optional) argument is set to True
'
' Note that value and limit arguments are variant, so you can use
' this routine with any type of data.
Function KeepInRange(value As Varian
....Read More |
Rating
|
|
|
Manage the SQL Server date format with SQL DMO
|
Total Hit (3158) |
If you haven't localized SQL Server for your language, the default date format is the American one: DD/MM/YY. You may need to display a date in different formats, and you can solve this problem with the help of SQL DMO. A possible solution is using the T-SQL CONVERT() function to show the date with
....Read More |
Rating
|
|
|
Be careful in using CreateObject with two arguments
|
Total Hit (3093) |
If you install a COM+ application proxy on a client and open its Properties dialog, you'll see that the field "Remote Server Name" is set to the server where you created and exported the application. Before you export the component, you can also change the server name by setting the "Application Pro
....Read More |
Rating
|
|
|
Open the default program for sending email messages
|
Total Hit (2620) |
The ShellExecute API function recognizes email addresses if they are prefixed by the "mailto:" prefix, and correctly run the default program for sending email messages (e.g. Outlook). This lets you open a window for sending an email and automatically fill the address field. Here's a wrapper routine
....Read More |
Rating
|
|
|
Get the Windows main directories (without any API call)
|
Total Hit (3250) |
The usual way to determine the Windows' main directory is based on the GetWindowsDirectory 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
....Read More |
Rating
|
|
|
Build a simple browser for icons
|
Total Hit (3039) |
Winodws uses a special browser to show all icons contained in a file and offers the end user the possibility to choose an icon from it. You can add this functionallity to your applications through an undocumented API function, SHChangeIconDialog. Its Declare is:
«Code LangId=1»
Declare Function
....Read More |
Rating
|
|
|
Check whether a sound card exists
|
Total Hit (3417) |
If you are developing a game in VB or an application that plays sounds, you probably want to check that a sound card actually exists. There is an API function that does this, and returns the number of sound cards installed in the system. Therefore, a return value of zero means that no devices are pr
....Read More |
Rating
|
|
|
Performing FTP operation using WinInet APIs
|
Total Hit (12785) |
«b»Step-By-Step Demo«/b»
- Create a standard exe project.
- Add one module to the project.
- Add six textbox controls and nine command button controls on the form1. Set MultiLine=True and Scrollbar=Both for Text6.
- add two frame controls and add two radio button controls to each frame.
«b»
....Read More |
Rating
|
|
|
Example of rectangle APIs
|
Total Hit (2528) |
This sample code will show you how to work with basic Rectangle manipulation APIs to do some math operations with Rectangles.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add one timer control on the form1
- Add the following code in form1
«code LangId=1»Option Explicit
....Read More |
Rating
|
|
|
Fixing the IE5/MsComCtrl 5 Toolbar Problem
|
Total Hit (1231) |
After the introduction of IE5, users began complaining that their code, which had previously created flat toolbars, failed on systems with IE5 installed. In addition, whenever the text (caption) for a button was changed through code, and the new caption text length differed from that being replaced,
....Read More |
Rating
|
|
|
|
Alpha Image Creator
|
Total Hit (2103) |
As described in the Alpha DIBSection article, if you want to draw an image which has per-pixel-alpha using the AlphaBlend call, then you need a bitmap with an alpha channel and R,G,B components which have been pre-multiplied. These bitmaps are hard to come across in the wild, hence this utility to a
....Read More |
Rating
|
|
|
Transparent AVI Player Control
|
Total Hit (3627) |
The Animation control supplied with VB (and from various other VB websites) is derived from the implementation within COMCTL32.DLL. However, this implementation only allows you to play AVIs with no audio stream. Also, its idea of transparency isn't quite what you might expect: setting an AVI to tran
....Read More |
Rating
|
|
|
Splitting Aligned Controls on MDI Forms
|
Total Hit (2083) |
This article provides an easy to use class which allows resizing of any aligned control on an MDI form. The code is also available packaged as a DLL for ease of debugging, as it uses a subclass which can make things awkward in the IDE.
|
Rating
|
|
|
|
Clipboard Ring Sample
|
Total Hit (1060) |
This sample uses the cClipboardViewer class to hook into clipboard change notifications, and then displays them in a pinnable ListBar in a similar manner to the Clipboard Ring functionality provided in Visual Studio.
|
Rating
|
|