|
How to Open and Close CD gate
|
Total Hit (1980) |
API Declarations
«Code LangId=1»
Option Explicit
'Declare
Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
«/Code»
M
....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
|
|
|
FormatPhoneNumber - Format a phone number
|
Total Hit (3155) |
«Code LangId=1»' Modify a phone-number to the format "XXX-XXXX" or "(XXX) XXX-XXXX".
Function FormatPhoneNumber(ByVal text As String) As String
Dim i As Long
' ignore empty strings
If Len(text) = 0 Then Exit Function
' get rid of dashes and invalid chars
For i
....Read More |
Rating
|
|
|
|
Factorial - The factorial of a number
|
Total Hit (1720) |
«Code LangId=1»' The factorial of a number
'
' if NUMBER is negative or >170 it raises an
' "subscript out of range" error
Function Factorial(ByVal number As Long) As Double
Static result(170) As Double
' this routine is very fast because it
' caches all the possible resul
....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
|
|
|
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
|
|
|
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
|
|
|
The number of lines in a multiline TextBox control
|
Total Hit (2834) |
You can quickly determine how many lines of text are contained in a multiline TextBox control whose Scrollbars property is set to 3-Both - that is, when the TextBox behaves like a programmer's editor - by counting the number of CR-LF characters in the Text property. You can do that in just one line
....Read More |
Rating
|
|
|
Determine when a ComboBox's area is being closed
|
Total Hit (2213) |
The ComboBox control exposes the DropDown event, that lets you determine when its list area is being opened. However, VB doesn't offer any simple way to understand when the list area is being closed. You can achieve this by intercepting the WM_COMMAND message that the ComboBox control sends to its c
....Read More |
Rating
|
|
|
|
Swap strings the fast way
|
Total Hit (3341) |
Consider the usual way of swapping two strings:
«Code LangId=1»
Dim s1 As String, s2 As String
Dim tmp As String
' initialize the strings
s1 = String$(1000, "-")
s2 = String$(1500, "+")
' do the swap, through a temporary variable
tmp = s1
s1 = s2
s2 = tmp
«/Code»
If you put the abo
....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
|
|
|
How To Call CLSID And ProgID Related COM APIs in Visual Basic
|
Total Hit (5755) |
This article demonstrates how to use a set of related Component Object Model (COM) APIs that retrieve and manipulate CLSIDs and ProgIDs. The following APIs are discussed:
«UL»«LI»CLSIDFromProgID: To retrieve the CLSID of a COM object with a given ProgID.
«LI»StringFromCLSID: To convert a CLSID s
....Read More |
Rating
|
|
|
How to install/uninstall Printer Driver programatically ?
|
Total Hit (5623) |
This article will show you how to install/uninstall Printer Driver without any user interaction.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Copy and Paster the following code in form code window
- Make sure you modify various parameter according to your requirement.
«c
....Read More |
Rating
|
|
|
|
|
How to Display Grid Lines in a ListView
|
Total Hit (1304) |
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_GRIDLINES, the ListView columns and rows will be separated by a grey grid line.
|
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
|
|
|
vbAccelerator Visual Studio Style ToolBox ListBar
|
Total Hit (832) |
This control provides a full implementation of a Visual Studio-style List Bar which holds lists of controls. Bars and items can be dragged around the control, and items can be dragged, pressed or double-clicked to add the item to an object.
|
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
|
|
|
|
Two code only solutions for displaying Common/Dialogs
|
Total Hit (1047) |
The Common Dialog/Direct component provides you with a more functional version of the Common Dialog control which also means you no longer need a form to create Common Dialogs. These samples show how you can go one further with your app and remove the need to ship any DLLs at all!
....Read More |
Rating
|
|