Sample codes for windows power plans monitoring and CPU fan control?

Hello, anyone has got sample codes in Delphi to share, concerning the monitoring/changing of power schemes in Windows XP/7, as well as samples for changing fan speeds depending on CPU temperature values?