|
Appending One File to Another File
|
Total Hit (3966) |
The following example demonstrates opening and closing files, reading and writing files, and locking and unlocking files. The application appends one file to the end of another file. The application opens the file having the new data appended with permissions that allow only this application to writ
....Read More |
Rating
|
|
|
How to sort string Array using CompareString API
|
Total Hit (3211) |
CompareString compares two strings and determines which one would come first in an alphabetic sort. Although this function can use a number of different comparisons, by default it conducts a case-sensitive word sort. In a word sort, all symbols except hyphens and apostrophes come before the letter "
....Read More |
Rating
|
|
|
Create your own cursor at runtime
|
Total Hit (3353) |
Sometimes you might need to create your own cursor at runtime without using any image or resource. You can achive this functionality using CreateCursor API. Here is the basic guidelines for creating your own cursor.
When you call CreateCursor you have to pass Application handle, Cursor Width, Curso
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
TransposeMatrix - Rotate a bi-dimensional array
|
Total Hit (2368) |
«Code LangId=1»
' evaluate the transposed matrix
'
' a transposed matrix is the array you get when
' you "rotate" a bi-dimensional array
Function TransposeMatrix(arr() As Double) As Double()
Dim startRow As Long, startCol As Long
Dim endRow As Long, endCol As Long
Dim r As Lon
....Read More |
Rating
|
|
|
ArraySum - The sum of all the items in an array of any type
|
Total Hit (2498) |
«Code LangId=1»
' Return the sum of the values in an array of any type
' (for string arrays, it concatenates all its elements)
'
' FIRST and LAST indicate which portion of the array
' should be considered; they default to the first
' and last element, respectively
Function ArraySum(arr As
....Read More |
Rating
|
|
|
|
Get the local IP address using the Internet Transfer Control
|
Total Hit (2623) |
The easiest way to retrieve the IP address assigned to the local machine during an Internet session is by means of the LocalIP property of the Internet Transfer Control:
«Code LangId=1»
MsgBox "IP address= " & Winsock1.LocalIp
«/Code»
Note that getting the same information through API calls
....Read More |
Rating
|
|
|
Retrieve CPU information the simple way (NT/2000 only)
|
Total Hit (1613) |
The Windows API includes all the functions you need to retrieve and display information about the CPU the machine is equipped with. However, if you're running under Windows NT or Windows 2000, you don't need to make complicated API calls, because this information is already available in several envi
....Read More |
Rating
|
|
|
Track changes in system time and display resolution
|
Total Hit (3537) |
Whenever the system time or the display resolution changes, Windows sends all the top-level windows (forms, in VB jargon) the WM_TIMECHANGE or WM_DISPLAYCHANGE message, respectively. Therefore, you can easily determine when these system-wide settings change by subclassing any form in your applicatio
....Read More |
Rating
|
|
|
Download and save an HTML page with the Internet Transfer control
|
Total Hit (2937) |
You can easily download an HTML page by using the Internet Transfer Control (INet). Here's a reusable routine that uses this control to download the HTML page at the specified URL and optionally save it to a local file. In either case the routine returns the contents of the page as a string:
«Co
....Read More |
Rating
|
|
|
Create colorful Command Buttons
|
Total Hit (4315) |
The VB CommandButton control supports neither the ForeColor nor the BackColor properties. If you want to create colorful buttons without resorting to 3rd party controls, you can use an OptionButton control with the Style property set to 1-Graphical. Such OptionButton controls appear to be very simil
....Read More |
Rating
|
|
|
Quickly initialize Variant and String arrays
|
Total Hit (3488) |
Visual Basic doesn't provide any way to declare an array and initialize its elements at the same time. In most cases you end up with setting individual elements one by one, as in:
«Code LangId=1»
Dim strArray(0 To 3) As String
strArray(0) = "Spring"
strArray(1) = "Summer"
strArray(2) = "Fall"
....Read More |
Rating
|
|
|
Functions to find if file exists...
|
Total Hit (1614) |
«Code LangId=1»Public Function FileExists(filename As String) As Boolean
FileExists = (Dir(filename, vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbArchive) <> "")
End Function
«/Code»
Usage
«Code LangId=1» 'Usage:
Private Sub Command1_Click()
If FileExists("C:\Config.sys"
....Read More |
Rating
|
|
|
How to use WinInet FTPCommand function from Visual Basic
|
Total Hit (3750) |
This article includes some background information on the Microsoft Win32 Internet Application Programming Interface (WinInet for short) and the File Transfer Protocol (FTP) and then moves into the use of FTPCommand function.
|
Rating
|
|
|
|
Changing the Dropdown Width of a Combo Box, Advanced
|
Total Hit (736) |
Like the routine in Changing the Dropdown Width of a Combo Box, this routine performs the same functionality but adds the ability to resize the list at runtime. By calculating the average width of a character in the listbox based on the current font, the dropdown width can change to accommodate the
....Read More |
Rating
|
|
|
|
Colourisation
|
Total Hit (1629) |
Image colourisation is a widely-used technique in image processing which can be used to create sepia-toned effects as well as adjusting images so they can be used as watermarks and in the creation of layered background images. This article demonstrates how to use the Hue, Luminance and Saturation mo
....Read More |
Rating
|
|
|
Media Progress Bar Renderer
|
Total Hit (1871) |
Windows Media Player has a neat progress bar showing how its getting on whilst burning files to CD or other long operations. This article presents a reusable class which draws a progress bar in a similar presentation. The resulting bar can be drawn to anything that exposes an hDC, and therefore can
....Read More |
Rating
|
|
|
PopupMenu DLL - Create Unlimited Popup Menus
|
Total Hit (2453) |
The PopupMenu (cNewMenu.dll) ActiveX DLL is allows you to create completely new popup menus with icons for your application. Menus created using this control either can be used as normal Windows Context menus or can be attached to a vbAccelerator CoolMenu and ToolBar control to be used as a form men
....Read More |
Rating
|
|
|
Keep Form Titlebars in Focus when ToolWindows are Shown
|
Total Hit (2180) |
The ToolWindow style, introduced with VB4, allowing you to easily create pop-up tool windows with small captions. However, there is (and has always been) a problem with them: whenever the form or a control on it gets the focus, it appears that the main form of your application looses focus. Whilst m
....Read More |
Rating
|
|
|
Creating Window Shapes from Bitmaps
|
Total Hit (2859) |
The Windows Shape article shows how to use the SetWindowRgn function to apply a geometric region to a window using the GDI region creation functions. However, beyond using a simple geometric region, things get difficult. How do you specify the exact shape you want?
This article demonstrates how t
....Read More |
Rating
|
|
|
Drawing With Textures
|
Total Hit (1781) |
This article provides an extension to the technique demonstrated in Creating Single Pixel Dotted Lines to show how you can easily create a brush for drawing shapes from any bitmap, picture or device context.
|
Rating
|
|