?
Solved

Window or Handle creation time?

Posted on 2009-02-23
5
Medium Priority
?
588 Views
Last Modified: 2013-12-03
Hi,

I particurlarly need to know when a window was created or displayed. This is essential for various "MessageBox"es that popup from random programs with a text in it but without any timecode saying when this message popped up. This is especially annoying on long-time tasks where nobody is in front of the system.

So - is there any way to get the creation time of a window? I don't mean the creation time of a whole process (and to be clear: I don't mean the startup time of Windows itself, too). And sadly it seems that MessageBoxes also won't create a thread (which definitly has a creation time that can be read with ProcExp).

My problem would be indirectly solved if somebody can guarantee that the WinAPI (or else) was never meant to know the creation time of a handle. In this case it can't be helped of course.


Thanks for reading and thinking :-)
0
Comment
Question by:AmigoJack
  • 2
  • 2
5 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 1000 total points
ID: 23709644
HI AmigoJack,

I don't think there's a possibility to find the creation time of a HANDLE - at least I never heard or read about something to do so.

But, maybe you could implement a system wide hook which can log all window creation/deletion times you need - to do so you would need a WH_CBT-hook proc.

ZOPPO
0
 
LVL 12

Author Comment

by:AmigoJack
ID: 23712027
Hi ZOPPO,

yes it's obvious to write an own helper app which logs all window creations if nothing helpful exists. However - isn't there any other chance? Running hooks for this little purpose is like shooting sparrows with canons ;-)
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 23712359
Sorry, I don't know any other method. AFAIK handles in windows are just 32-bit values handled by the OS. I guess these handles are stored/used in a way that they can be created/accessed/destroyed with maximum performance since every system object is represanted by a handle. Storing a time-stamp or something similar with a handle would be a overhead.
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 1000 total points
ID: 23712697
There indeed is no such thing as a creation time for a handle - but I'd rather go for a WH_GETMESSAGE hook, so you can intercept WM_CREATE messages sent to a MessageBox by identifying their Window Class name using 'GetClassName()' and the MSG::time parameter. See e.g. http://msdn.microsoft.com/en-us/library/ms997537.aspx ("Win32 Hooks")
0
 
LVL 12

Author Comment

by:AmigoJack
ID: 23720058
Thanks for contributing :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The article covers five tools all IT professionals should know about, as they up productivity by a great deal!
Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Suggested Courses

850 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