473,385 Members | 1,409 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,385 software developers and data experts.

Compareing IntPtr's

how would you compare an IntPtr to check if it is zero?

c++ example of what i want to do
IntPtr hWndMdiClient;
If (hWndMdiClient != IntPtr.Zero)
{...}

thanks
Nov 20 '05 #1
3 1760
* "Brian Henry" <br**********@newsgroups.nospam> scripsit:
how would you compare an IntPtr to check if it is zero?


\\\
Dim p1 As IntPtr = New IntPtr(23234)
Dim p2 As IntPtr = New IntPtr(23234)
Dim p3 As IntPtr = New IntPtr(99)
MsgBox(p1.Equals(p2).ToString())
MsgBox(p1.Equals(p3).ToString())
///

-->

\\\
If p1.Equals(IntPtr.Zero) Then
...
End If
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Dim hWndMdiClient as IntPtr
If Not hWndMdiClient.Equals(IntPtr.Zero) Then
....
End If

--
Mick Doherty
http://homepage.ntlworld.com/mdaudi1...nate/home.html
"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
how would you compare an IntPtr to check if it is zero?

c++ example of what i want to do
IntPtr hWndMdiClient;
If (hWndMdiClient != IntPtr.Zero)
{...}

thanks

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
Nov 20 '05 #3
thanks that worked good
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j************@uni-berlin.de...
* "Brian Henry" <br**********@newsgroups.nospam> scripsit:
how would you compare an IntPtr to check if it is zero?


\\\
Dim p1 As IntPtr = New IntPtr(23234)
Dim p2 As IntPtr = New IntPtr(23234)
Dim p3 As IntPtr = New IntPtr(99)
MsgBox(p1.Equals(p2).ToString())
MsgBox(p1.Equals(p3).ToString())
///

-->

\\\
If p1.Equals(IntPtr.Zero) Then
...
End If
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4

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

Similar topics

2
by: Nuno Esculcas | last post by:
Hello, I come from C++ and i now have to work with C#, and someone tell me that bye bye pointers but i think this is not true, i must convert a DIB image in something that i can use in C# (like...
13
by: Christian Westerlund | last post by:
Hi! I'm trying to use P/Invoke and a Method which takes an IntPtr where I am supposed to put an address to a method which the native method will use to communicate back to me. How do I convert a...
10
by: Tamir Khason | last post by:
I have a pointer to array and I want to apply indexing to this Array so I have function (name it IntPrt Func) to go to certain member I can use (as C++) Func, but in C# I recieve an error "Cannot...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
6
by: active | last post by:
I downloaded the Win32 Library which saved me MUCH work. Some (All?) of the returned handles are typed int. As I used them I often changed them in my copy of win32 to IntPtr because an...
0
by: Jørn Jensen | last post by:
Hey! I have an issue with creating bitmap from an IntPtr. The IntPtr is created from a Twain scanner, which seem to work perfectly in it's original state (the app is originally written by somebody...
9
by: pigeonrandle | last post by:
Hi, I'm trying to convert the following line to c# from VB6 If hrRapiInit >= 0 Then 'SUCCEEDED where hrRapiInit is declared as a Long. In c#, hrRapiInit must be declared as an IntPtr to fit...
1
by: dcurington | last post by:
I have to call a function. This is from the SDK: INT is_GetActSeqBuf (HIDS hf, INT* pnNum, char** ppcMem, char** ppcMemLast); I have demo C# code that works. Here is the prototype: private...
0
by: Charming12 | last post by:
Hi All, I have a strange problem and due to my inefficiency with IntPtr i am unable to figure it out. I have an structure something like: public struct Detail { public int age; public...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.