默认情况下,vb6具有多个属性的结构会返回什么?

时间:2014-08-08 20:15:13

标签: vb.net struct vb6 structure

我正在将旧的VB6项目升级到.NET并遇到了使用以下行的问题

CopyMemory(lpDevMode, DevMode, Len(DevMode))

Devmode是一个如下所示的结构:

Public Structure DEVMODE_TYPE
    'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
    <VBFixedString(CCHDEVICENAME),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=CCHDEVICENAME)> Public dmDeviceName() As Char
    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
    'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
    <VBFixedString(CCHFORMNAME),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=CCHFORMNAME)> Public dmFormName() As Char
    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

CopyMemory最初使用As Any声明,因此我必须将其更改为As Integer以获取第二个值(Integer适合其他地方使用的代码行)。我需要指定DevMode中包含的哪个值是正确的,但是我不知道要传递给该方法的哪个值,它必须在VB6中自动处理。我如何找出VB6通过哪一个?

我相信还有一些像这样的代码实例被使用,所以理想情况下我可以找出vb6如何处理这样的情况并在代码中的其他地方重复修复。

0 个答案:

没有答案