|
ありがとうございます。
負値になるとエラーになるのは気付いていたので以下のようにしていたのですが、
そちらのコードと結果は同じでしょうか?
Public Function SignedHIWORD(ByVal n As IntPtr) As Integer
Return SignedHIWORD(CInt(CLng(n)))
End Function
Public Function SignedHIWORD(ByVal n As Integer) As Integer
Return CShort((Math.Max(0, n) >> 16 And 65535))
End Function
Public Function SignedLOWORD(ByVal n As IntPtr) As Integer
Return SignedLOWORD(CInt(CLng(n)))
End Function
Public Function SignedLOWORD(ByVal n As Integer) As Integer
Return CShort((Math.Max(0, n) And 65535))
End Function
|