BBC BASIC for Windows
« Control HDD power ON/OFF from BB4W? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:13pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Control HDD power ON/OFF from BB4W?  (Read 1116 times)
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Control HDD power ON/OFF from BB4W?
« Reply #3 on: Jul 9th, 2011, 12:00am »

Thanks dynamic tiger, that sounds promising.

I am very ignorant about sys calls, so if I cannot find it in WinAPI I am stuck. Where can I learn about the 3 parameters you are sending in {SYS `SetSuspendState`, 0, 1, 0}.

Can I use some variation of this to suspend only specified drives (including a RAID 0 pair)?

--G
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: Control HDD power ON/OFF from BB4W?
« Reply #4 on: Jul 9th, 2011, 4:32pm »

on Jul 9th, 2011, 12:00am, 19Grumpah42 wrote:
Thanks dynamic tiger, that sounds promising.

I am very ignorant about sys calls, ...
--G

(like most of us!) ) but we may study msdn.microsoft.com:
BOOLEAN WINAPI SetSuspendState(
__in BOOLEAN Hibernate,
__in BOOLEAN ForceCritical,
__in BOOLEAN DisableWakeEvent
);


Parameters
Hibernate [in]
If this parameter is TRUE, the system hibernates. If the parameter is FALSE, the system is suspended.

ForceCritical [in]
This parameter has no effect.

Windows Server 2003, Windows XP, and Windows 2000: 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 Value
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.

Remarks
The calling process must have the SE_SHUTDOWN_NAME privilege. To enable the SE_SHUTDOWN_NAME privilege, use the AdjustTokenPrivileges function. For more information, see Changing Privileges in a Token.

An 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.

For more information on using PowrProf.h, see Power Schemes. For information about events that can wake the system, see System Wake-up Events.

{SYS `SetSuspendState`, 1, 0, 0}.

saves maximal amount of kilowatts (hibernites)
User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Control HDD power ON/OFF from BB4W?
« Reply #5 on: Jul 10th, 2011, 02:09am »

Thanks for the above, that was encouraging, perhaps I am getting the idea about how to read msdn descriptions. Lots more to embrace, obviously. --G
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
Richard Russell
Guest
xx Re: Control HDD power ON/OFF from BB4W?
« Reply #6 on: Jul 14th, 2011, 09:10am »

Don't forget that API Viewer will provide the BB4W translations of many API calls. It's not simply a tool for finding the values of Windows Constants (in which respect it has been superseded by the Windows Constants add-in utility).

If you haven't already done so, download and install API Viewer and its BB4W plug-in, then checkout the translation it gives of the API(s) you are interested in.

Tools are there to be used!!!!

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls