我正在阅读一些 VB6 以转换为 C#。这条线是什么意思? 0&
是否等同于 IntPtr.Zero
?
//'Get a Device context
hdc = GetDC(0&)
这个值用于 pinvoke,所以我不确定 IntPtr.Zero
是否有意义,因为我们需要选择一些对象。
OldFont = SelectObject(hdc, ObjFont)
请注意,ObjFont 是通过
填充的//'Get the Window's font
ObjFont = SendMessage(hwnd, WM_GETFONT, 0, 0&)//there's that mysterious 0& agaain.
最佳答案
它是一个 (VB6) 类型声明字符。看看this question有关这些的更多详细信息。
在您的示例 VB6 代码中,它强制 0
为 Long
(4 个字节),否则它将为 Integer
(2字节)
这与再次执行此长手方法相同 VB6 代码:
Dim lParam as Long
lParam = 0
ObjFont = SendMessage(hwnd, WM_GETFONT, 0, lParam)
关于c# - GetDC(0&) 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11903951/