A
active
Has anyone used CopyMemory with DotNet?
In this instance I define it as:
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef
hpvDest As DEVMODE, ByRef hpvSource As Byte, ByVal cbCopy As Integer)
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef
hpvDest As Byte, ByRef hpvSource As DEVMODE, ByVal cbCopy As Integer)
and use it with
Call CopyMemory(pDevMode, aDevMode(1), Len(pDevMode))
where
Dim pDevMode As New DEVMODE
Dim aDevMode() As Byte
and
Private Structure DEVMODE
<VBFixedArray(CCHDEVICENAME)> Dim dmDeviceName() As Byte
Dim dmSpecVersion As Short
Dim dmDriverVersion As Short
Dim dmSize As Short
Dim dmDriverExtra As Short
Dim dmFields As Integer
Dim dmOrientation As Short
Dim dmPaperSize As Short
Dim dmPaperLength As Short
Dim dmPaperWidth As Short
Dim dmScale As Short
Dim dmCopies As Short
Dim dmDefaultSource As Short
Dim dmPrintQuality As Short
Dim dmColor As Short
Dim dmDuplex As Short
Dim dmYResolution As Short
Dim dmTTOption As Short
Dim dmCollate As Short
<VBFixedArray(CCHFORMNAME)> Dim dmFormName() As Byte
Dim dmUnusedPadding As Short
Dim dmBitsPerPel As Short
Dim dmPelsWidth As Integer
Dim dmPelsHeight As Integer
Dim dmDisplayFlags As Integer
Dim dmDisplayFrequency As Integer
End Structure
Plus I do
ReDim pDevMode.dmDeviceName(CCHDEVICENAME)
ReDim pDevMode.dmFormName(CCHFORMNAME)
Thanks,
CAl
In this instance I define it as:
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef
hpvDest As DEVMODE, ByRef hpvSource As Byte, ByVal cbCopy As Integer)
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef
hpvDest As Byte, ByRef hpvSource As DEVMODE, ByVal cbCopy As Integer)
and use it with
Call CopyMemory(pDevMode, aDevMode(1), Len(pDevMode))
where
Dim pDevMode As New DEVMODE
Dim aDevMode() As Byte
and
Private Structure DEVMODE
<VBFixedArray(CCHDEVICENAME)> Dim dmDeviceName() As Byte
Dim dmSpecVersion As Short
Dim dmDriverVersion As Short
Dim dmSize As Short
Dim dmDriverExtra As Short
Dim dmFields As Integer
Dim dmOrientation As Short
Dim dmPaperSize As Short
Dim dmPaperLength As Short
Dim dmPaperWidth As Short
Dim dmScale As Short
Dim dmCopies As Short
Dim dmDefaultSource As Short
Dim dmPrintQuality As Short
Dim dmColor As Short
Dim dmDuplex As Short
Dim dmYResolution As Short
Dim dmTTOption As Short
Dim dmCollate As Short
<VBFixedArray(CCHFORMNAME)> Dim dmFormName() As Byte
Dim dmUnusedPadding As Short
Dim dmBitsPerPel As Short
Dim dmPelsWidth As Integer
Dim dmPelsHeight As Integer
Dim dmDisplayFlags As Integer
Dim dmDisplayFrequency As Integer
End Structure
Plus I do
ReDim pDevMode.dmDeviceName(CCHDEVICENAME)
ReDim pDevMode.dmFormName(CCHFORMNAME)
Thanks,
CAl