Kernel32.dll

CopyMemory 
FileTimeToSystemTime 
GetCommandLine 
GetCurrentThreadId 
GetLocaleInfo 
GetSystemTime 
GetTempPath 
GetTempPathA 
GetTickCountUsed for timing a macro
GetVersionEx 
GlobalAlloc 
GlobalLock 
GlobalSize 
GlobalUnlock 
LocalFileTimeToFileTime 
Lstrcpy 
Lstrlen 
MultiByteToWideChar 
RtlMoveMemory 
RtlZeroMemory 
Sleep 
SystemTimeToFileTime 
WideCharToMultiByte 
xLib 

CopyMemory

Private Declare PtrSafe Sub CopyMemory Lib "kernel32" _ 
    Alias "RtlMoveMemory" (ByVal lpDst As LongPtr, ByVal lpSrc As LongPtr, ByVal byteLength As Long)

GetCommandLine

Public Declare PtrSafe Function GetCommandLine Lib "kernel32" _ 
    Alias "GetCommandLineA" () As Long

GetCurrentThreadId

Private Declare PtrSafe Function GetCurrentThreadId Lib "kernel32" () As Long 

GetLocaleInfo

Private Declare PtrSafe Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" ( _ 
    ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long

GetSystemTime

Private Declare PtrSafe Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) 

GetTempPath

Getting temp folder path:

Private Declare PtrSafe Function GetTempPath Lib "kernel32" Alias "GetTempPathA" ( _ 
    ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

GlobalUnlock

Private Declare PtrSafe Function GlobalUnlock Lib "kernel32" (ByVal hMem As LongPtr) As LongPtr 

GlobalLock

Private Declare PtrSafe Function GlobalLock Lib "kernel32" (ByVal hMem As LongPtr) As LongPtr 

GlobalAlloc

Private Declare PtrSafe Function GlobalAlloc Lib "kernel32" (ByVal wFlags As LongPtr, ByVal dwBytes As LongPtr) As LongPtr 

lstrcpy

Public Declare PtrSafe Function lstrcpy Lib "kernel32" _ 
    Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As LongPtr

lstrlen


Public Declare PtrSafe Function lstrlen Lib "kernel32" _ 
    Alias "lstrlenA" (ByVal lpString As LongPtr) As Long

xLib

Declare PtrSafe Sub xLib "Kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long) 

Public Sub TestPause()
    Dim start As Double
    start = Timer
    Sleep 8000 'Pause for 8 seconds
    Debug.Print "Paused for " & Format(Timer - start, "#,###.000") & " seconds"
End Sub

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext