Solved

Logging all method calls

Posted on 1998-06-11
2
164 Views
Last Modified: 2011-09-20
I have a friend that asked me this question and I could come up with only one solution, but I'd be interested in hearing what other possibilities are out there.

Q: Is there any way to "trap" and then log all method calls to all objects in an application?  We're talking several hundred classes and many, many methods.  Is there any way to hook into the Delphi object model and do this?

My suggested answer was to take all the base classes and add code to the methods to log the calls and parameters of each of the methods.  This is not a desirable solution, but at the moment it is the only one we could come up with.

I'm not aware of any single point to trap method calls, except possibly in COM or CORBA objects, which these are not.  Anyone have any thoughts or a solution?
0
Comment
Question by:descikartus
[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 Comments
 
LVL 1

Accepted Solution

by:
pjdb earned 100 total points
ID: 1352239
Hook the OnMessage event of the Application to intercept every message send to every windows of the application. You can event put some filtering in this event toi log only some messages.
You can do the same for any form by defining a procedure asfollow
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1352240
One line is missing, something has gone wrong. It should be :

procedure OnWMSysCommand(var msg: Tmessage); message wm_syscommand;

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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