Solved

Getting active application by mouse click

Posted on 2006-11-28
6
222 Views
Last Modified: 2010-04-23
Ok, how about this.....is there a way to capture the application by way of a mouse click event?

So when a user clicks on a application (say Notepad) and then clicks on a button in a Vb.net 2003 program which will display what application they selected.  

0
Comment
Question by:TechMonster
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 18033032
Hi TechMonster,

What are you trying to acheive?  There are ways to get references to other applications like Notepad, using functions from the win32 api, however they are pretty tricky to use...

Cheers,
Hillwaaa
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18034177
Take a look at my approach here:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_21567355.html#14929000

It allows you to initiate a drag from your app and it identifies the hWnd of the control where the drop is made.  Then you can figure out the window that owns that control from there.

This is accomplished via the SetCapture() API.

If you think this is workable then I can see about converting the code to VB.Net.  It will be shorter than the solution VB6 since some of that code required APIs that are now encapsulated by the .Net framework.
0
 

Author Comment

by:TechMonster
ID: 18038299
The setCapture may work.  I am not 100% sure i understand how to use but it may be heading me in the right direction.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18038316
I'll work out a sample project to demonstrate it...
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18049092
0
 

Author Comment

by:TechMonster
ID: 18103261
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

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