Is there any Win32 API to put the machine into hibernate or suspend mode?
I read MSDN and found that WM_POWERBROADCAST message gets broadcasted when power-management events occur. I thought of simulating the same with PostMessage(WM_POWERBROADCAST). Is this the correct way of doing or any Win32 API exists to achieve this?
Check out
SetSuspendState.Note that you need SE_SHUTDOWN_NAME privilege, as mentioned on the referenced msdn page.