Solved

Get Handle by Class Name

Posted on 2011-03-07
2
825 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
2 Comments
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
Comment Utility
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
Comment Utility
Thanks
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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

13 Experts available now in Live!

Get 1:1 Help Now