• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1792
  • Last Modified:

Window Handle: intPtr to Long

Hi I have the handle of a window as an intPtr, how do I get the handle as a Long from this?
I've tried searching many places, I'm new to VB .Net so I hope it's something so simple people never need to ask.
I appreciate any help.

Matty
0
Matty023
Asked:
Matty023
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You don't!

Use an Integer (NOT a Long)....

For example:

    ' From within some Form
    Dim hWnd As IntPtr = Me.Handle
    Dim intWnd As Integer = hWnd.ToInt32

A handle is represented by a Long in VB6, but in .Net you use an Integer.
0
 
Matty023Author Commented:
Thankyou very much, the things I hate the most are the easy problems that get you stuck for too much time. And I appreciate the Integer tip, all the examples on the net seem to be written in VB6 which means I'm converting it to .Net as I'm learning it.
And there's a shortage of English Books in China for Exchange students.
Here's your points, I appreciate the help ^_^
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now