Category Archives: Microsoft

Drop in the Bucket

Your plumbing has sprung a leak! Grab your trusty bucket and start catching all those drops of water that are falling from the damaged pipe. This becomes much more challenging with each level, as the difficulty continually increases. Rack up huge scores by earning Bonus Multipliers and the Gold Drop then save your best score on the top… Read More »

Net enum

Sample code from unknown author to enum the computers in a network using API, shows servers and clients with different icons. Ability to send messages to other computers and enum remote PC users. Many other filters can be activated such as SQL controllers to check properties of a network machine. Attachments File Uploaded Size 968-20190909-160046-net_enum.zip 9/9/2019 4:00:46 PM… Read More »

Partial Path Formatting

Ensures the path contains a trailing backslash. Module Public Sub CheckPath(MyPath$) ‘ Adds the \ to the Application Path when required    MyPath$ = App.Path    If Not Right(MyPath$, 1) = “\” Then        MyPath$ = MyPath$ & “\”    End IfEnd Sub Usage Private Sub Command1_Click()    Dim MyPath As String    Dim FileName As String     FileName = App.EXEName    Call CheckPath(MyPath$)    MsgBox “The location of: ” & FileName & ” is… Read More »

Determine Disk Type

Given a drive letter, returns the type of disk present, if connected. Module Option Explicit ‘API Calls ‘Function GetDriveType’lpRootPathName : string that specifies the root directory of the disk to return information about. If lpRootPathName is an empty string, the function uses the root of the current directory.Public Declare Function GetDriveType Lib “kernel32.dll” Alias “GetDriveTypeA” (ByVal nDrive As… Read More »

Obtain Drive Serial Number

Given a drive letter, this function will return the assigned serial number for the given volume. Module Private Declare Function GetVolumeSerialNumber Lib “kernel32.dll” Alias “GetVolumeInformationA” _    (ByVal lpRootPathName As String, _    ByVal lpVolumeNameBuffer As String, _    ByVal nVolumeNameSize As Long, _    lpVolumeSerialNumber As Long, _    lpMaximumComponentLength As Long, _    lpFileSystemFlags As Long, _    ByVal lpFileSystemNameBuffer As String, _    ByVal nFileSystemNameSize As Long _    ) As Long    Public Function… Read More »

Connect and Disconnect a Network Drive

A handy module to connect to and disconnect from network locations. Module ‘Create a Module named ModNetUseOption Explicit Public Declare Function WNetAddConnection2 Lib “mpr.dll” Alias “WNetAddConnection2A” _(lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUsername As String, _ByVal dwFlags As Long) As Long Public Declare Function WNetCancelConnection2 Lib “mpr.dll” _Alias “WNetCancelConnection2A” (ByVal lpName As String, ByVal dwFlags As… Read More »

Check if a File Exists

A simple way of determining if a file exists. Simply pass it a full path and filename, and it will tell you if it exists, and whether or not it is a zero-byte file. Module Function FileExists(strFile As String) As Integer’********************************************************************************’* Name : FileExists’* Date : Feb-17, 2000’* Author : David Costelloe’* Returns : -1 = Does not… Read More »

Extract File or Path

Extract either a filename or path from a fully qualified pathname. Module Option Explicit Public Function ParsePath(strFullPathName As String, ReturnType As Integer, Optional StripLastBackslash) As String” Returns: Either the path or filename of a fully qualified pathname.’ See below for details.” Called with:’ strFullPathName – STRING (REQUIRED) – the full path and file name of interest’ If strFullPathName… Read More »

Determine File Version Number

This module will show you how to get the file version number of an executable file, given a full path and filename, using Windows API. Module Option Explicit Private Declare Function GetLocaleInfoA Lib “kernel32.dll” (ByVal lLCID As Long, ByVal lLCTYPE As Long, ByVal strLCData As String, ByVal lDataLen As Long) As LongPrivate Declare Sub lstrcpyn Lib “kernel32.dll” (ByVal… Read More »

Enumerate Ports

Using the EnumPorts API, you can list the ports on a local or remote PC with this code. Module Option Explicit ‘API callsPrivate Declare Function EnumPorts Lib “winspool.drv” Alias “EnumPortsA” (ByVal pName As String, ByVal Level As Long, ByVal lpbPorts As Long, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As LongPrivate Declare Function lstrlenW Lib… Read More »