C# function be converted to VB.NET

D

Don Juan

How can this C# function be converted to VB.NET

static IntPtr MakeLParam(int LoWord, int HiWord)
{
return (HiWord << 16) | (LoWord & 0xffff);
}

I'm trying the following but is causing an error : (Operator Or is not
defined for types System.IntPtr and System.IntPtr)


Shared Function MakeLParam(ByVal LoWord As Integer, ByVal HiWord As Integer)
As IntPtr

Dim IntPtrHiWord As New IntPtr(HiWord << 16)
Dim IntPtrLoWord As New IntPtr(LoWord And &HFFFF)

Return IntPtrHiWord Or IntPtrLoWord

End Function
 
F

Fabio

static IntPtr MakeLParam(int LoWord, int HiWord)
{
return (HiWord << 16) | (LoWord & 0xffff);
}

I'm trying the following but is causing an error : (Operator Or is not
defined for types System.IntPtr and System.IntPtr)

Make operations on the integer params as in the c# code, and *then* convert
it to IntPtr.
 
G

Guest

Actually, the direct translation to VB (via Instant VB) works just fine:
Shared Function MakeLParam(ByVal LoWord As Integer, ByVal HiWord As Integer)
As IntPtr
Return (HiWord << 16) Or (LoWord And &HFFFF)
End Function
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top