Click here to Skip to main content
15,916,189 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Coders,

In my program I need to get the start time of the application window.I want this from HWND handle to that window.

Thank You in anticipation.

What I have tried:

I tried this from HANDLE to the process got from that window, using

hProcess = OpenProcess(PROCESS_ALL_ACCESS | lpdwProcessId);

(where DWORD lpdwProcessID; is from GetWindowThreadProcessId(hwnd, &lpdwProcessId);)

But it gives same Start Time for the same kind of applications(example:- folders, multiple image windows on Windows Photo Viewer),as they have same processID(I am writing this on my true observation).
Posted
Comments
Richard MacCutchan 13-Feb-16 8:26am    
What code are you using to get the time value?
Suryakant Turing 14-Feb-16 13:24pm    
functions I used are
GetProcessTimes();
FileTimeToSystemTime();
SystemTimeToTzSpecificLocalTime();

parameters accordingly.

1 solution

You can get the start time of a process. There is no such data attached to a window. The "start time" of a window doesn't exist and is not tracked by Windows.
 
Share this answer
 
Comments
Suryakant Turing 14-Feb-16 13:30pm    
OK Dave. But can u suggest me a way, how can I retrieve the start time of multiple "Folders"(I mean the folders with Yellow file icon) opened.
Dave Kreskowiak 14-Feb-16 14:39pm    
No, again, no such data exists. Windows does not track the start time of anything other that processes.

The only way you're ever going to get anything close to that is if you had a process running continuously that watched for all the Shell windows and saw it get created. You get the time when that happens and you've got your data. It is in no way attached to the window itself.

The COM object that gets you to this collection is Shell.Windows method (Windows)[^]. Keep in mind that Explorer windows are really Internet Explorer with the URL being a folderpath. Using this, you will not only get all the Explorer windows but also any internet Explorer window the user has open too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900