Solved

Getting active application by mouse click

Posted on 2006-11-28
6
237 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
[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
  • 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 86

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

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

Accepted Solution

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

Author Comment

by:TechMonster
ID: 18103261
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…

734 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