[1] To put a monitor into a standby mode, the best I can think of is to run the screensaver, xxx.scr, directly with whatever basic method like wshshell.run. This is still the one I would be more likely to recommend.
[2] The sophisticated approach can often backfired. Sometimes, users might no longer be able to wake it up or get so confused and have to reboot.
[2.1] Use sendmessage api of user32 library with parameters wm_syscommand (&h112) and sc_monitorpower (&hf170). The 4th parameter determines whether you want to turnoff (2), standby(1), turnon (-1). The first parameter is some window's handle like the calling form itself.
[tt] sendmessage(me.hwnd,&h112,&f170,1)[/tt]
(me the calling form.)
[2.2] To do it from native vbs, you have to use an extension to wrap the api allowing the script to call the api (not all api with complex data-type, but sendmessage is in the category of allowable api.)
[2.3] You better script a timer to wake it up automatically. Else, users may take the consequence of some bad surprise.
[2.4] Details of the implementations can be found out-there on the net. You won't them miss out doing some search with appropriate keywords such as those used in the above.
[3] wmi has classes implemented to assess the controlling devices, cim_controller, cim_unitarycomputersystem... But, they are more for readonly purposes. Methods are not implemented and in particular, in this context, setpowerstate methods. So, there is something waiting on the line when those methods will be implemented and be available. Not for now.
>I really need to know how to put the PC itself into Standby mode
If you have in mind using api along the line I outline in [2], it would be very similar and I would rather send you directly to vb 5&6 forum for full entertaining where you should find more ideas, and that I have done my bit on this topic with the above and worn out for the day---unless you still do not find satisfaction there later.
I think [3] will have same functionality along the line in the future.
As a supplement note: I think you can as well use small utility (some .exe) to do it through vbs if scripting is the media you use to get to it. You won't fail to find some on the net, even open source. Some might find it unattractive for doing so due to some psychological barrier with some fixed idea behind on what programming is. I don't.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.