?
Solved

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

Posted on 1997-06-09
4
Medium Priority
?
279 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
[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
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
Shrif earned 280 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

801 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