Home All Groups Group Topic Archive Search About

C# function be converted to VB.NET

Author
27 Dec 2006 6:37 PM
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

Author
27 Dec 2006 9:37 PM
Fabio
"Don Juan" <carlos.rodrig***@multicim.com> ha scritto nel messaggio
news:O8ZwRYeKHHA.3488@TK2MSFTNGP02.phx.gbl...

>
> 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.
Author
28 Dec 2006 12:06 AM
David Anton
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


Show quoteHide quote
"Don Juan" wrote:

> 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
>
>
>
>
>