Solved

How do I get the prog/path of a running app?

Posted on 1997-06-09
4
259 Views
Last Modified: 2013-12-03
I want to monitor what programs are started on my computer by logging the program starts (using a callback?).  But, I can't find how I get the program name and path from a window or process handle.  How would I get this information?
0
Comment
Question by:chrisk
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
Shrif earned 140 total points
ID: 1397969
You really should indicate which version of Windows you're talking about.GetModuleFileName takes a module or instance handle and returns the full pathname of the program.  Under Win32, this only works if the task calling the function create owns the module, such as the hInstance of the EXE, or a DLL that it has loaded.  Note: You can call GetWindowLong on an hWnd with GWL_HINSTANCE to obtain the hInstance that created the window.In Win32, the only portable way to do this is to go through the "performance registry".  Look at the source code to PerfMon, which comes with the Win32 SDK.  If your program is to be Windows 95 only, then you can use the the new ToolHelp 32 routines.  This is documented in the Windows 95 Device Drive Kit (DDK).  You'll have to ship the ToolHelp 32 DLL with your software.  ToolHelp 32 not available under Windows 95.The best way to do what you're doing is to write a DLL and then force that DLL to be loaded by all applications that are executed.  You can do this via the registry.  Every application that is executed will load your DLL.
0
 

Author Comment

by:chrisk
ID: 1397970
Sorry, I am programming for Windows 95.

What do I update in the registry to cause my DLL to be loaded by all apps?  And when my DLL is loaded, how do I get the name and path of the program loading it?

I don't have the SDK as I am programming in Delphi and all it comes with is the Win32 help file.
0
 

Expert Comment

by:Shrif
ID: 1397971
Look at "Getting the Filename Given a Window Handle".  You can just enter the "Q" number on Microsoft site's search: Q119163
0
 

Author Comment

by:chrisk
ID: 1397972
I looked at the article you mentioned, but it only deals with NT.  I was looking for info on setting up a DLL to run when any app in Windows 95 is started.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now