Category Archives: Visual Basic 6 (VB6)

Faded Background with API

This handy little chunk of code will show you how to create a faded background on a form, using the Windows API. Option Explicit ‘ Data type used by FillRectType RECT   Left As Long   Top As Long   Right As Long   Bottom As LongEnd Type ‘ API Functions used to create solid brush and draw brush on formPublic Declare Function CreateSolidBrush Lib “gdi32.dll”… Read More »

Explode or Implode a Form

Rather than have a form simply appear or disappear, you can use this module to add an explode or implode effect when a form appears or disappears. Module Insert the following code to your module. If Win16 Then   Type RECT      Left As Integer      Top As Integer      Right As Integer      Bottom As Integer   End TypeElse   Type RECT      Left As Long      Top As Long      Right As Long      Bottom As Long   End TypeEnd… Read More »

Custom ToolTips

Create Custom ToolTips with multiline text and Balloon shape. Option Explicit ‘************************************************************’ Constants’************************************************************ Private Const GWL_WNDPROC = -4Private Const GWL_STYLE = (-16) Private Const WS_BORDER = &H800000 Private Const FW_NORMAL = 400Private Const FW_HEAVY = 900Private Const FW_SEMIBOLD = 600Private Const FW_BLACK = FW_HEAVYPrivate Const FW_BOLD = 700Private Const FW_DEMIBOLD = FW_SEMIBOLDPrivate Const FW_DONTCARE = 0Private Const FW_EXTRABOLD… Read More »

Tile a Picture on a Form Background

To create a form with tiled picture use the code below. In this code the picture is loaded in a picture box (invisible) and is copied over the form many time as necessary to cover it. So you can use pictures on all formats supported by picture box. Option Explicit Private Type BITMAP   bmType As Long   bmWidth As Long   bmHeight As… Read More »

Capture to Clipboard

This module will allow you to capture the entire screen or just one form, and copy the image to the Windows clipboard. Option Explicit Private Const CCHDEVICENAME = 32Private Const CCHFORMNAME = 32Private Const SRCCOPY = &HCC0020 ‘ (DWORD) destination = source Private Type DEVMODE   dmDeviceName As String * CCHDEVICENAME   dmSpecVersion As Integer   dmDriverVersion As Integer   dmSize As Integer   dmDriverExtra As Integer   dmFields As… Read More »

Read Excel and Text Files Using ADO

Read Excel File Using ADO. Public Function Read_Excel _         (ByVal sFile _          As String) As ADODB.Recordset       On Error GoTo fix_err      Dim rs As ADODB.Recordset      Set rs = New ADODB.Recordset      Dim sconn As String       rs.CursorLocation = adUseClient      rs.CursorType = adOpenKeyset      rs.LockType = adLockBatchOptimistic       sconn = “DRIVER=Microsoft Excel Driver (*.xls);” & “DBQ=” & sFile      rs.Open “SELECT * FROM [sheet1$]”, sconn      Set Read_Excel = rs      Set rs = Nothing      Exit Functionfix_err:      Debug.Print… Read More »

Check if a RecordSet has Data

Before you can query for a recordset, you need to make sure it has data in it. Public Function EmptyRS(ByRef adoRS As ADODB.Recordset) As Boolean    ‘Checks for an EMPTY RecordSet    On Error GoTo ErrHandler    EmptyRS = True    If Not adoRS Is Nothing Then        EmptyRS = ((adoRS.BOF = True) And (adoRS.EOF = True))    End IfExit FunctionErrHandler:    EmptyRS = TrueEnd Function

Show Modal Forms in Taskbar

This is a simple way to force MODAL FORMS show in TaskBar. By default, modal forms aren’t show in taskbar. This method uses ShowWindow API to hide the form and show it again after change WS_EX_APPWINDOW attribute of form (a clever way to do this is define the caption of form). Note if you use Visible property of… Read More »

Menu-Related APIs Collection

This is a great collection of all Menu-Related API Functions with perfect examples. Attachments File Uploaded Size 1035-20190913-075959-MenuRlatedAPIFunctions.zip 9/13/2019 7:59:59 AM 24445