I suppose you know how to import Win32 API functions into C#.
Like this :
BOOL ExitWindowsEx(UINT uFlags, DWORD dwReason); // Original Win32 function
[DllImport("User32.dll")] public static extern bool ExitWindowsEx(uint uFlags, uint dwReason); // How to import into C#
I want to import SetSuspendState() function, but don't know what DLL file it requires.
Here the explanation of SetSuspendState() in MSDN :
[IMG]http://www.daniweb.com/techtalkforums/ms-help://MS.MSDNQTR.2003APR.1033/power/common/SeeAlso.gif[/IMG] [IMG]http://www.daniweb.com/techtalkforums/ms-help://MS.MSDNQTR.2003APR.1033/power/common/Requirements.gif[/IMG] Platform SDK: Power Management SetSuspendState
The SetSuspendState function suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).
BOOLEAN SetSuspendState(
BOOL Hibernate ,
BOOL ForceCritical ,
BOOL DisableWakeEvent ); ParametersHibernate [in] If this parameter is TRUE, the system hibernates. If the parameter is FALSE, the system is suspended. ForceCritical [in] If this parameter is TRUE, the system suspends operation immediately; if it is FALSE, the system broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation. DisableWakeEvent [in] If this parameter is TRUE, the system disables all wake events. If the parameter is FALSE, any system wake events remain enabled. Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
RemarksAn application may use SetSuspendState to transition the system from the working state to the standby (sleep), or optionally, hibernate (S4) state. This function is similar to the SetSystemPowerState function.
RequirementsClient: Included in Windows XP, Windows 2000 Professional, Windows Me, and Windows 98.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Header: Declared in Powrprof.h.
Library: Use Powrprof.lib.See Also
Power Management Overview , Power Management Functions , PBT_APMQUERYSUSPEND , PBT_APMSUSPEND
[IMG]http://www.daniweb.com/techtalkforums/../common/tiny.gif[/IMG]
Platform SDK Release: February 2003 [EMAIL="sdkfdbk@microsoft.com?subject=TITLE:%20SetSuspendState;%20RELEASE:%20February%202003;%20URL:%20base/setsuspendstate.xml"][IMG]http://www.daniweb.com/techtalkforums/../common/sendfdbk.gif[/IMG][/EMAIL] [EMAIL="sdkfdbk@microsoft.com?subject=TITLE:%20SetSuspendState;%20RELEASE:%20February%202003;%20URL:%20base/setsuspendstate.xml"]What did you think of this topic?[/EMAIL]
[IMG]http://www.daniweb.com/techtalkforums/../common/download.gif[/IMG] Order a Platform SDK CDRequirements
Client: Included in Windows XP, Windows 2000 Professional, Windows Me, and Windows 98.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Header: Declared in Powrprof.h.
Library: Use Powrprof.lib.
See AlsoPower Management Overview , Power Management Functions , PBT_APMQUERYSUSPEND , PBT_APMSUSPEND
It instructs to import Powrprof.h, but doesn't give a DLL name.
So, is there any suggestions?