?
Solved

Getting active application by mouse click

Posted on 2006-11-28
6
Medium Priority
?
246 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 total points
ID: 18049092
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

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