I am writing an application that runs on Windows logon but I want it to wait until the desktop is fully functional/loaded before it actually starts doing anything. Is there any way of working out when Windows has completely finished loading the desktop?
Very old question but I needed the same. The following code seems to work:
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
// wait until desktop ready
IntPtr lHwnd = IntPtr.Zero;
do
{
lHwnd = FindWindow("Shell_TrayWnd", null);
Thread.Sleep(100);
} while (lHwnd == IntPtr.Zero);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With