Solved

Window Handle: intPtr to Long

Posted on 2007-04-05
2
1,772 Views
Last Modified: 2013-12-03
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
Comment
Question by:Matty023
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 18861580
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
 
LVL 1

Author Comment

by:Matty023
ID: 18861635
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question