|
|
|
|
ArrayAvg - The average of an array of any type
|
Total Hit (2185) |
«Code LangId=1»
' The average of an array of any type
'
' FIRST and LAST indicate which portion of the array
' should be considered; they default to the first
' and last element, respectively
' if IGNOREEMPTY argument is True or omitted,
' Empty values aren't accounted for
Function ArrayA
....Read More |
Rating
|
|
|
|
Bin - Convert from decimal to binary
|
Total Hit (2837) |
«Code LangId=1»' convert from decimal to binary
' if you pass the Digits argument, the result is truncated
' to that number of digits
'
Function Bin(ByVal value As Long, Optional digits As Long = -1) As String
Dim result As String, exponent As Integer
' this is faster than creating t
....Read More |
Rating
|
|
|
BitToggle - Invert a bit in a value
|
Total Hit (3005) |
«Code LangId=1»' Toggle a bit in a value
'
' NOTE: requires Power2()
Function BitToggle(ByVal value As Long, ByVal bit As Long) As Long
' simply XOR with the negation of the bit mask
' Range checking is performed in Power2()
BitToggle = (value Xor Power2(bit))
End Function
....Read More |
Rating
|
|
|
Programs using the WebBrowser require that IE is installed
|
Total Hit (1963) |
If your program uses the WebBrowser control or any Microsoft Internet Control, you must ensure (and clearly specify in your app's documentation) that the program can only work on systems that have Internet Explorer installed. In fact, the WebBrowser control is embedded in the ShDocVw.Dll file, which
....Read More |
Rating
|
|
|
Don't use global variables in MTS/COM+ projects
|
Total Hit (2740) |
Public variables at module level are thread specific. Each new thread starts get a new fresh & uninitialized copy of such variables. All the activities that are born from the same object context always run in the same apartment (You can confirm this by checking the thread ID) as if the object contex
....Read More |
Rating
|
|
|
Create an Internet shortcut
|
Total Hit (2873) |
Unlike regular LNK shortcut, which contain data in binary file, Internet shortcut files are just text files in this format:
[InternetShortcut]
URL=www.domain.com
Thus it is simple to programmatically create an Internet shortcut that, when double-clicked, will load the default browser and hav
....Read More |
Rating
|
|
|
Determine the total playing time of an Audio CD
|
Total Hit (2740) |
The Microsoft Multimedia Control lets you easily determine the total playing time of an Audio CD: you only need to correctly initialize the control and then decipher the value returned by its Length property. Use the following code as a guideline for your routines:
«Code LangId=1»
Private Sub cm
....Read More |
Rating
|
|
|
Let the user add tab characters to a RichTextBox control
|
Total Hit (3105) |
Here's a simple method to programmatically insert an image into a RichTextBox control, by copying it into the clipboard and then pasting it into the control:
«Code LangId=1»
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hwnd As Long, ByVal wMsg As Long, ByV
....Read More |
Rating
|
|
|
Create a owner form with API functions
|
Total Hit (3105) |
Starting with VB5, the Show method supports a second optional argument, that lets you specify which form owns the form that is about to be displayed:
«Code LangId=1»
Form2.Show , Me
«/Code»
A owned form is always displayed in front of its owner, and when the owner is unloaded, VB automatical
....Read More |
Rating
|
|
|
Checking if a Floppy Drive is ready using FileSystemObject library
|
Total Hit (3553) |
The Microsoft Scripting Runtime Library offers a FileSystemObject and a Drive object that allow you to check if a Floppy drive is ready. Before writing the code you have to add this library to your project using the References dialog window. If the library isn't contained in the list, you can downlo
....Read More |
Rating
|
|
|
Hidden Variant variables
|
Total Hit (3564) |
Variants are the default type of variables that are declared without an As clause, as in:
«Code LangId=1»
Dim name ' this is a variant
«/Code»
or are not declared at all (which is only possible if the current module does not include any Option Explicit statement). If you are recycling progra
....Read More |
Rating
|
|
|
Simple VB Script to check Registry Key
|
Total Hit (6682) |
«code LangId=1»Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\CCleaner"
strValueName = "UpdateCheck"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strVal
....Read More |
Rating
|
|
|
|
|
|
How to Subclass a Form
|
Total Hit (3785) |
«Code LangId=1»'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrev
....Read More |
Rating
|
|
|
|
Your First TAPI Program
|
Total Hit (2794) |
This sample application shows you how you can use the TAPI 3.0 functions to create a TAPI application of your own. This application uses the Windows Phone Dialer utility that comes with Windows and can be found under the Accessories group. That program will act as the call manager and will handle th
....Read More |
Rating
|
|
|
Enumerating Shared Resources on Remote Machines
|
Total Hit (1715) |
NetShareEnum retrieves information about each shared resource on a server. It's security requirements are the same as those outlined in Obtaining Workstation User Logon Information.
WNetEnumResource can also be used to retrieve resource information, however, it does not enumerate hidden shares or
....Read More |
Rating
|
|
|
Creating the Common Control Initialization Module
|
Total Hit (1025) |
This file will be required to be added to the existing project for all common control API methods detailed here that use the API to actually create the common control (as opposed to using the Visual Basic Common Control). The BAS module will provide the mechanism to initialize the comctl32.dll, rega
....Read More |
Rating
|
|
|
Obtaining Bitmap Info Without APIs
|
Total Hit (1429) |
Using binary file access, read the BITMAPFILEHEADER and BITMAPINFOHEADER structures of a file to obtain the image details.
|
Rating
|
|
|
Sorting ListView ListItems Using Callbacks
|
Total Hit (1563) |
Sorting numeric values with the ListView control's built-in sort mechanism has always left much to be desired. Because the ListView stores the item and SubItem data as strings, the default sorting algorithm sorted numbers in string format. This meant that instead of a sort of 1, 2, 3, 20, 35, the Li
....Read More |
Rating
|
|
|
Link Spoof
|
Total Hit (1566) |
LinkSpoof is a sample from Robert Heinig (rheinig@gmx.net) demonstrating one technique to take over the VB6 compile process in order to compile your own code into the finished executable.
|
Rating
|
|
|
Totalistic Cellular Automata
|
Total Hit (1769) |
Continuing this short series on the use of cellular automata for creation of algorithmic images, this sample demonstrates using the Totalistic form. A Totalistic cellular automata differs from other the other forms of the algorithm by summing the contribution from surrounding cells, and using modula
....Read More |
Rating
|
|
|
vbAccelerator Explorer Bar Control
|
Total Hit (1943) |
The vbAccelerator Explorer Bar control is a new control entirely written in VB which provides a user interface like the one in Windows Explorer under XP. You can use it to create handy lists of shortcuts and informational panels, or you can incorporate controls into the panels to provide flexible an
....Read More |
Rating
|
|
|
vbAccelerator Icon Editor Control
|
Total Hit (931) |
The vbAccelerator Icon Editor control is an all-VB control which allows Icon Editing facilities, with the aim of providing a similar level of facilities to the Icon Editor provided in Visual Studio. The control builds upon the cFileIcon Class to allow writing as well as reading icons, and adds full
....Read More |
Rating
|
|