How can my program know if Admin is log out

I wrote a program to imitate windows 8 to make my windows xp start faster:
(newshutdown.bat)
@cmd /c sc create -- binPath= "cmd /c start C:/shutdownnow.exe" type= own type= interact & net start -- & sc delete --
(shutdownnow.exe)
1
2
3
4
5
6
7
8
9
10
#include "windows.h"
#include "stdio.h"
int main()
{
	system("rasphone -h broadband connection");//"broadband connection" is Chinese but I turn it to English so maybe it can't work
	system("shutdown -l -f");
	Sleep(40000);
	system("rundll32 powrprof.dll,SetSuspendState");
	return 0;
}

this program can work, but I want to find something to replace "Sleep" function, because sometimes the computer "rundll32 powrprof.dll,SetSuspendState" before Admin logout(because there are so many program which is running), but sometimes the time is too long. So, I need an API to check if Admin have log out already. Can you help me? Thank you.
P.S. Sorry for my bad English.
Topic archived. No new replies allowed.