Solved

Detect program starting

Posted on 1998-07-22
10
156 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 151
Sending files from  idTcpServer Socket to idTcpClient 2 39
Wincontrol not (correctly) drawn 15 37
Twebbrowser add css to the header 3 24
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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