January 22, 2000

Remove the Close command from the system menu

If you want to prevent the user from closing a form by using Alt+F4 or by clicking on the “X” button in the upper-right corner you just need to write some code in the form’s QueryUnload event procedure: Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu

SetVolume – Set the master volume level

Const MMSYSERR_NOERROR = 0Const MAXPNAMELEN = 32Const MIXER_LONG_NAME_CHARS = 64Const MIXER_SHORT_NAME_CHARS = 16Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = &H4Const MIXERCONTROL_CONTROLTYPE_VOLUME = &H50030001Private Declare Function mixerOpen Lib “winmm.dll” (phmx As Long, _ ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance

Create an Internet shortcut

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 have it point to the specified URL. Here is a

Add multiple child controls to a Coolbar

The Coolbar control consists of a collection of Band objects, and each Band object exposes a Child property. To move a control inside the Coolbar you just have to assign it to the Child property of a Band object.A minor problem is that you can’t directly assign multiple controls to

Add size grips to a form

There are two simple ways to add the so-called size-grips to the bottom-right corner of a form. The first method is to add a StatusBar control, which includes a size-grip of its own. The second method is to add a multiline TextBox control, set its ScrollBars property to 3-Both and

PlayAVIVideoOFF – Play only the audio track of an AVI file

Private Declare Function mciSendString Lib “winmm” Alias “mciSendStringA” _ (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As LongPrivate Declare Function mciGetErrorString Lib “winmm” Alias _ “mciGetErrorStringA” (ByVal dwError As Long, ByVal lpstrBuffer As String, _ ByVal uLength As Long) As

PlayAVIAudioOFF – Play an AVI file without the audio track

Private Declare Function mciSendString Lib “winmm” Alias “mciSendStringA” _ (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As LongPrivate Declare Function mciGetErrorString Lib “winmm” Alias _ “mciGetErrorStringA” (ByVal dwError As Long, ByVal lpstrBuffer As String, _ ByVal uLength As Long) As

GetMCIErrorString – Get a description of an MCI error

Private Declare Function mciGetErrorString Lib “winmm” Alias _ “mciGetErrorStringA” (ByVal dwError As Long, ByVal lpstrBuffer As String, _ ByVal uLength As Long) As Long’ Get the description of a MCI error.” ErrorCode is the code of the error’ Return a string with the description of the error.Function GetMCIErrorString(ErrorCode As Long)

Change the DataSource at runtime

Visual Basic 6 is the first VB version that lets you programmatically change the DataSource property at runtime, for example to point to another ADO Data control or another ADO Recordset.However, when you assign the new DataSource property VB immediately checks that the DataField and DataMember properties are valid. This

No more posts to show