winapi - Impose a daily limit on software execution time in Windows -
motivation: i'm addicted particular online game.
goal: write programme impose daily limit on time particular game can played.
background: have never written code windows.
my thoughts: windows has api management of software permissions. need write programme runs in background , periodically checks whether game played. if - sum total daily time , utilize windows api block game when limit exceeded. maybe possible register listener notified when game started, such there no need periodic polling of game status.
questions:
please help me defining global arch of such programme , point parts of windows api might of interest.
are there potential pitfalls need aware of?
what programming language should utilize (can utilize of them or windows api restricted languages)?
i know there many programs need, want write programme myself.
thanks.
sounds job powershell. since it's task automation , configuration management framework microsoft, consisting of command-line shell , associated scripting language built on .net framework. easy manage user permissions.
by task scheduler you'll able create such daemon that
runs in background , periodically checks whether game played
the simple workflow, can implemented this:
using powershell ise create , save my_script.ps1 add my_script.ps1 scheduled task when time exceeded give warning pop-up (so can save game) continue running daemon checking , killing pid related gamefor script design:
#parameter set: name get-process [[-name] <string[]> ] [-computername <string[]> ] [-fileversioninfo] [-module] [ <commonparameters>]
you can see how here. then
$file = get-content my_time_file.utf8
will maintain history daily time limit. how read , write files. aplly parsing , conditional logic. when time on - give warning pop-up , terminate pid in (let's 5 mins):
[system.windows.forms.messagebox]::show("you exceed daily time limit. please save game. game process terminated in 5 minutes!")
but after it's you. people are
addicted particular online game
are resourceful.
windows winapi architecture
No comments:
Post a Comment