CreateILockBytesOnHGlobal (ole32)
Last changed: -212.44.26.236

.
Summary

C# Signature:

[DllImport("ole32.dll")]
static extern int CreateILockBytesOnHGlobal(IntPtr hGlobal, bool
   fDeleteOnRelease, out ILockBytes ppLkbyt);

or

[DllImport("ole32.dll",
    EntryPoint="CreateILockBytesOnHGlobal",
    ExactSpelling=true, PreserveSig=true, CharSet=CharSet.Ansi,
    CallingConvention=CallingConvention.StdCall)]
static extern int CreateILockBytesOnHGlobal(IntPtr /* HGLOBAL */ hGlobal, bool fDeleteOnRelease, [MarshalAs(UnmanagedType.Interface)]out object /* ILockBytes** */ ppLkbyt);

VB.NET Signature:

Public Class Win32

    <DllImport("ole32.dll")> _
    Public Shared Function CreateILockBytesOnHGlobal(ByVal hGlobal As IntPtr, _
                              ByVal fDeleteOnRelease As Boolean, _
                              <Out()> ByRef ppLkbyt As IlockBytes) _
                              As Integer
    End Function

End Class

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

With VB.NET,

Dim lockbytes As IlockBytes = Nothing

Dim hr As Integer

hr = Win32.CreateILockBytesOnHGlobal(IntPtr.Zero, True, lockbytes)

Alternative Managed API:

Do you know one? Please contribute it!

Documentation