Home All Groups Group Topic Archive Search About

C# function be converted to VB.NET

Author
27 Dec 2006 6:11 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 7:36 PM
Tom Shelton
Don Juan wrote:
Show quoteHide quote
> 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
>

maybe...

Return New IntPtr (IntPtrHiWord.ToInt32() Or IntPtrLoWord.ToInt32())

Or some variant of such...
--
Tom Shelton
Author
27 Dec 2006 8:16 PM
Don Juan
Thanks Tom

but the function returns a IntPtr



Show quoteHide quote
"Tom Shelton" <tom_shel***@comcast.net> wrote in message
news:1167248176.566044.69000@f1g2000cwa.googlegroups.com...
>
> 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
> >
>
> maybe...
>
> Return New IntPtr (IntPtrHiWord.ToInt32() Or IntPtrLoWord.ToInt32())
>
> Or some variant of such...
> --
> Tom Shelton
>
Author
28 Dec 2006 1:09 AM
Tom Shelton
Don Juan wrote:
> Thanks Tom
>
> but the function returns a IntPtr
>
>

And if you look closely, you will see that what i was returning is also
a intptr :)

--
Tom Shelton
Author
28 Dec 2006 4:15 PM
Don Juan
Oups!!!

you're right

thanks Tom


Show quoteHide quote
"Tom Shelton" <tom_shel***@comcast.net> wrote in message
news:1167268153.569375.150060@n51g2000cwc.googlegroups.com...
>
> Don Juan wrote:
> > Thanks Tom
> >
> > but the function returns a IntPtr
> >
> >
>
> And if you look closely, you will see that what i was returning is also
> a intptr :)
>
> --
> Tom Shelton
>