Get Desktop Load Time - Windows all OS
Find out the boot time of Windows of any version
A programmatic way to get the desktop load time on a cold start of the system, examples of functions and the simplest utility.
Weekend creativity :)
Description of the function: A method of receiving a notification about the full load of the desktop at system startup.
int GetTimeLoadWorktable(){
NOTIFYICONDATA tnd = {0};
tnd.cbSize = sizeof(NOTIFYICONDATA);
tnd.hWnd = (HWND)101010;
tnd.uID = (UINT)GetModuleHandle(NULL);
//--
while (Shell_NotifyIcon(NIM_ADD, &tnd) == 0) {Sleep(1000);}
Shell_NotifyIcon(NIM_DELETE, &tnd);
return GetTickCount() / 1000;
}
Utility example, C language. Get system and desktop boot time when starting from Windows OS
#include <stdio.h>
#include <windows.h>
/* Declare Windows procedure */
int GetTimeLoadWorktable();
int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow )
{
char str[64];
int re = GetTimeLoadWorktable();
sprintf(str, "%s %d %s", "OS boot time: ", re, " sec.");
MessageBox(NULL, str, "OS is fully loaded", MB_OK);
return 0;
}
int GetTimeLoadWorktable(){
NOTIFYICONDATA tnd = {0};
tnd.cbSize = sizeof(NOTIFYICONDATA);
tnd.hWnd = (HWND)101010;
tnd.uID = (UINT)GetModuleHandle(NULL);
//--
while (Shell_NotifyIcon(NIM_ADD, &tnd) == 0) {Sleep(1000);}
Shell_NotifyIcon(NIM_DELETE, &tnd);
return GetTickCount() / 1000;
}
Function example for VB6:
Function GetTimeLoadWorktable() As Single
Dim ti As NOTIFYICONDATA
ti.cbSize = Len(ti)
ti.uId = GetModuleHandle(ByVal 0)
'--------
While Shell_NotifyIcon(NIM_ADD, ti) = 0
Sleep 1000
Wend
'--------
Call Shell_NotifyIcon(NIM_DELETE, ti)
GetTimeLoadWorktable = GetTickCount()
End Function