LocalFree (Kernel32)



Usage

    <DllImport("kernel32.dll", EntryPoint:="LocalFree", SetLastError:=True)>
    Public Shared Function LocalFree(hMem As IntPtr) As IntPtr
    End Function

    <DllImport("kernel32.dll", EntryPoint:="LocalAlloc", SetLastError:=True)>
    Public Shared Function LocalAlloc(uFlags As UInteger, uBytes As Integer) As IntPtr
    End Function

        Dim pszBuf As IntPtr = Nothing
        pszBuf = LocalAlloc(0, 80)

        If pszBuf = Nothing Then
            MsgBox("LocalAlloc failed (" + GetLastError + ")")
            Exit Sub
        End If

        LocalFree(pszBuf)