Solved

Window Handle: intPtr to Long

Posted on 2007-04-05
2
1,760 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
2 Comments
 
LVL 85

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now