Moore, Willie wrote:
The Win32FunctionalitySuite did not give me exactly what I wanted.
Basically, I want to be able to create an Rb app that runs in the
background on a 2000/XP machine and have it be able to keep tract of
whatever application is running in the foreground at any given
moment. If there is no Windows plugin with this functionality, am I
better off looking at using the Win32 api and where is the best
source of info on programming using the api. One book that I have
seen mentioned is Dan Appleman's Visual Basic Programmer's Guide to
the Win32 API.
There's no concept of "front application" in Windows like there is on
the Macintosh. On Windows, it's only "active window". You can use the
Windows Functionality Suite with some other declares to tell what the
frontmost active window is, and try to figure out what application that
window belongs to, but it's not a trivial task.
Once you have an HWND for a window, you can call
GetWindowThreadProcessId on it to figure out the process ID that created
the window. Once you have the process id, you can scan over the list of
processes using CreateToolhelp32Snapshot (and the iterator function).
Check each process entry structure to look at the process id. Once you
have a match, then you know what process owns the window.
I'll see if I can whip something up, assuming that this is what you are
trying to do. Just to make sure -- you want to know what process owns
the frontmost window, just the name of the process or something?
~Aaron
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|