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
///
 
Back
Top