Solved

Window Handle: intPtr to Long

Posted on 2007-04-05
2
1,762 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 74
Change Format on Data when exporting to Excel 4 33
What namespace do I need to import? 2 29
Creating a route in asp.net webforms 2 28
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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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