Compareing IntPtr's

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

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
 
* "Brian Henry said:
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
///
 
Dim hWndMdiClient as IntPtr
If Not hWndMdiClient.Equals(IntPtr.Zero) Then
....
End If
 
thanks that worked good


Herfried K. Wagner said:
\\\
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
///
 

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

Back
Top