View Single Post
Old 9th January 2016, 01:27   #746  |  Link
slavanap
Registered User
 
slavanap's Avatar
 
Join Date: May 2011
Location: Moscow, Russia
Posts: 124
Quote:
Originally Posted by r0lZ View Post
Quote:
Originally Posted by slavanap View Post
There's nice WinAPI function intended for your case:
https://msdn.microsoft.com/ru-ru/lib...(v=vs.85).aspx
Just call it like this:
SetThreadExecutionState(ES_SYSTEM_REQUIRED|ES_CONTINUOUS);
P.S. Call it in your main program thread of course. Or I can write a simple program that monitors a state of other executable and calls this function.
Thanks for the suggestion, but I can't call WinAPI functions from the command line, and the encoding is made from a batch (.cmd) file only. Anyway, I've found the solution: powercfg.exe. That should work fine with all versions of Windows.

If you wish, you can write a small program to automate the change when a certain program is running (or, IMO, better: when the CPU usage remains high for a long time). I'm sure it will be very useful to others, and perhaps also to me, but I don't need it for BD3D2MK3D. Thanks anyway.
Here's .exe file: http://sendfile.su/1191348
Here's the source if you want to compile it yourself: http://pastebin.com/wMJ2nE0r
slavanap is offline