Solved

Get Handle by Class Name

Posted on 2011-03-07
2
845 Views
Last Modified: 2012-06-27
I'm new to VB.NET
How do you get the hWnd of a external application by Class Name
Example:
MSBLClass is the Class Name of Windows Messenger
Notepad is the Class Name of Notepad
tSkMainForm is the Class Name of Skype

Thanks for you help.
0
Comment
Question by:PhilChapmanJr
[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 13

Accepted Solution

by:
gamarrojgq earned 500 total points
ID: 35058319
Hi,

You can use FindWindow, you have to declare this function first

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal ByVallpClassName As String, ByVal lpWindowName As String) As Integer

After that use this code get the hWnd

        Dim hWnd As Integer
        hWnd = FindWindow("Notepad", vbNullString)
        MsgBox("NOTEPAD: " & hWnd)
0
 
LVL 2

Author Closing Comment

by:PhilChapmanJr
ID: 35062847
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal reports login after closing form 3 57
How to repeat the data 4 43
sql server connection string in config file 4 41
Convert a string to date 4 40
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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