Application Launch means application has been loaded properly.
Also mean, its program is loaded finished.
To resolve this problem, key, is define the point on loading is finished.
I tries these ways:
#1, Find the loaded Window. After it is loaded, get its handle and close it. Make this duration as Application launch time + loading time.
Failure,
For some main application spend much time of loading after Computer resource has been assign include handles.
so, handle can be get as it is assign in memory, but this time, the process is still in loading. Example, AutoCAD
#2, Measure program resource usage like CPU Time, Memory Usage
Failure,
For CPU Time or Memory Usage can not be updated in each ms, even 100ms, and 1000ms.
The sleep time for this should be at least 1000ms.
Even we make the wait time in 1000ms in each recycle, we may get the equal before Application loading finished.
Even the loading is finished, how to calculate the time spending duration? Should decrease the wait time? or not ?
#3, Kernel PCB contain Process status : wait, ready, running
It is a technology problem.
Can not find information on how to get WINDOWS Kernel PCB.
Last , i get a mind, why can i get window information? Window store process PCB information, there should be some place store windows information.
Maybe the window information can resolve this.
I find it.
//Codes
//you also need to define this struct
public struct WINDOWINFO
{
public uint cbSize;
public RECT rcWindow; //holds the coords of the window
public RECT rcClient;
public uint dwStyle;
public uint dwExStyle;
public uint dwWindowStatus;
public uint cxWindowBorders;
public uint cyWindowBorders;
public ushort atomWindowType;
public ushort wCreatorVersion;
}
//this holds the coordinates
public struct RECT
{
public int Left; // Specifies the x-coordinate of the upper-left corner of the rectangle.
public int Top; // Specifies the y-coordinate of the upper-left corner of the rectangle.
public int Right; // Specifies the x-coordinate of the lower-right corner of the rectangle.
public int Bottom; // Specifies the y-coordinate of the lower-right corner of the rectangle.
}
do
{
Helper.GetWindowInfo(hwnd, ref WINDOWINFO);
} while (WINDOWINFO.dwWindowStatus == 0);
If application loading is finished, it will show the one window immediately, we just need to capture this window and get this window status as it is ACTIVE.
And that time, application is loading finished.
I think so.
Hope your different suggestions. Readers.