编程中结构处理及相关问题解决
在编程过程中,我们经常会遇到各种结构处理的问题,下面将详细介绍一些常见问题及解决方法。
1. 设备数据的获取与设置
当数据存储在字节数组中时,访问结构字段会变得困难。为了解决这个问题,我们可以使用 RtlMoveMemory 函数将字节数组复制到 DEVMODE 结构中。以下是示例代码:
' Copy the DEVMODE portion of the buffer into
' the dmOut buffer so we can use it
Call RtlMoveMemory(dmOut, dmOutBuf(0), Len(dmOut))
If dmOut.dmOrientation = DMORIENT_LANDSCAPE Then
lblStatus.Caption = "Printer is in landscape mode"
Else
lblStatus.Caption = "Printer is in portrait mode"
End If
' You can modify the contents of the dmout buffer, then
' copy the data to the dmInBuf buffer and
' call DocumentProperties with DM_IN_BUFFER to set the new values
Call ClosePrinter(hPrinter)
如果要设置设备参数,过程
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



