473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C# function be converted to VB.NET

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


Dec 27 '06 #1
2 5832
"Don Juan" <ca**************@multicim.comha scritto nel messaggio
news:O8**************@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.
Dec 27 '06 #2
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
"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


Dec 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
<?php class Grad { var $dbFormExemptionArray = array(); function Grad ($id = '') { ...
9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
27
by: Marlene Stebbins | last post by:
I am experimenting with function pointers. Unfortunately, my C book has nothing on function pointers as function parameters. I want to pass a pointer to ff() to f() with the result that f() prints...
7
by: Alfonso Morra | last post by:
How can this work ? I have the following declarations in a header: Header ========= typedef void (*VFPTR)(void) ; void FOO_Callback(void*, char*, char*, int, unsigned long, void*,void*);...
10
by: Robert Skidmore | last post by:
Take a look at this new JS function I made. It is really simple but very powerful. You can animate any stylesheet numeric value (top left width height have been tested), and works for both % and px...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
57
by: Robert Seacord | last post by:
i am trying to print the address of a function without getting a compiler warning (i am compiling with gcc with alot of flags). if i try this: printf("%p", f); i get: warning: format %p...
2
by: Lucas Kruijswijk | last post by:
Hello, I am making some site, where I use UTF-8 encoding. From PHP I send mail. But, if possible I want to send the mail in ISO-8859-1 or KOI8-R (because still some mailers have problem with...
12
by: viza | last post by:
Hi I have program1.c: typedef int (*fn_t)(int); int fn( int f ){ return f; }
10
by: Richard Heathfield | last post by:
Stephen Sprunk said: <snip> Almost. A function name *is* a pointer-to-function. You can do two things with it - copy it (assign its value to an object of function pointer type, with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.