Solved

Detect program starting

Posted on 1998-07-22
10
162 Views
Last Modified: 2010-04-04
How can I detect from Delphi 2.0 programs if any Windows program is starting and read it's path? HELP ME, fastest as yu can!
0
Comment
Question by:mmilan
[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
  • 3
  • 2
  • +2
10 Comments
 

Expert Comment

by:westy100697
ID: 1358379
This is not really an answer more of a direction I think you should look at. Have a look in the Win32 help file for Event Logging Information. The procedures to look at i reckon relate to the registry and log files. These are as follows

GetNumberofEventLogRecords()
GetOldestEventLogRecord()
OpenEventLog()
ReportEvent()
ReportEventLog()
etc etc

See if that helps at all...
Like I said may not be a solution but may point you in direction...

WESTY
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1358380
An easy way, not the best, is to scan the process list (process walking) by using
Process32First and Process32Next. Then you will get a complete list of all available
Win32 processes.

OR

.even easier, if you just want to detect windowed "programs"; use EnumWindows, EnumChildWindows to get all visible windows.

/// John
0
 
LVL 4

Accepted Solution

by:
d003303 earned 50 total points
ID: 1358381
Yo,
set a WH_SHELL hook with SetWindowsHookEx and listen to the HSHELL_WINDOWCREATED hook code in your hook proc.
Hook procedures need to resist in a DLL and are mapped in the process space where the hook event occured. So you cannot pass parameters through global DLL variables. You need memory mapped files for that.
For sample code, you'll have to increase the points ;-)

Slash/d003303
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:bome
ID: 1358382
Well, don't want to offend you, d003303, but I have made a freely available shell hook component. mmilan, give him the points and I'll give you the component... ;)

On the other hand I don't understand ..."and read it's path?"
What do you want to say with that ?

bome
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1358383
The executable filename?
0
 

Author Comment

by:mmilan
ID: 1358384
Is it OK, HURRY UP!
0
 
LVL 4

Expert Comment

by:d003303
ID: 1358385
Yo,
mmilan, reject my answer and give bome the points !
bome, no problem. Just didn't know you have something for hooking in stock ;-)

Slash/d003303
0
 

Expert Comment

by:bome
ID: 1358386
OK, read the executable filename. My component does not provide that.

mmilan, what do you mean with hurry up ?

bome
0
 

Expert Comment

by:bome
ID: 1358387
OK, d003303.
mmilan, download it at
http://clio.unice.fr/~fbomers/Watch100.zip

I don't want the points, d003303, your answer was right and appropriate for the points.

bome

PS: and I was too late :)
0
 
LVL 4

Expert Comment

by:d003303
ID: 1358388
Yo,
I took a look at your problem with the program path. The only thing you can get is the name of the module (EXE, DLL, VXD, DRV, ...) and the name of the process (EXE) the window belongs to. AFAIK there is no way to get the complete path out.
If you want to write a log with all used apps on the system, you may want to create a continiously updated table with EXE files in the system and search through that with the process file name.

Slash/d003303
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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 Month9 days, 17 hours left to enroll

624 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