Link to home
Start Free TrialLog in
Avatar of TechMonster
TechMonster

asked on

Getting active application by mouse click

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.  

Avatar of Hillwaaa
Hillwaaa
Flag of Australia image

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
Avatar of Mike Tomlinson
Take a look at my approach here:
https://www.experts-exchange.com/questions/21567355/Is-it-possible-to-do-some-drag-drop-between-2-different-application.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.
Avatar of TechMonster
TechMonster

ASKER

The setCapture may work.  I am not 100% sure i understand how to use but it may be heading me in the right direction.
I'll work out a sample project to demonstrate it...
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial