Instead of complaining, fix the Vista Battery problem.(betterthaneveryone.com)

submitted by crpietschmanncrpietschmann(11.3k) 5 years ago

I get a bit irked when I see stuff that can be solved but people just complain about it. News.com, slashdot, zdnet … list goes on and on about people jumping on the bandwagon. So you know what, I attempted to fix it. Ok, here is my solution. I spent more time prepping this post than writing the application.

3 comments |category: |Views: 16

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by crpietschmanncrpietschmann(11.3k) 5 years ago 0

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

using Microsoft.Win32;

namespace VistaLaptopBatterySaver
{
public partial class Form1 : Form
{
/*
* Copyright Clint Rutkas May 2007
*
*/
[DllImport(“dwmapi.dll”, PreserveSig = false)]
public static extern void DwmEnableComposition(bool bEnable);

[DllImport(“dwmapi.dll”, PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();

public Form1()
{
InitializeComponent();
enableToolStripMenuItem.Checked = DwmIsCompositionEnabled();
}

private void Form1_Load(object sender, EventArgs e)
{
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
UpdatePowerInfo();
}

private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
UpdatePowerInfo();
}

private void UpdatePowerInfo()
{
if (enableToolStripMenuItem.Checked)
{
PowerStatus ps = SystemInformation.PowerStatus;

DwmEnableComposition((ps.PowerLineStatus == PowerLineStatus.Online));
}
}

private void enableToolStripMenuItem_CheckStateChanged(object sender, EventArgs e)
{
UpdatePowerInfo();
}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}

private static void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox ab = new AboutBox();
ab.Show();
}
}
}

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 5 years ago 0

No explanation as to what it does or how it is supposed to affect battery life.

Reply

posted by crpietschmanncrpietschmann(11.3k) 5 years ago 0

It disables Aero when on battery power. Then re-enables it when plugged back in.

Reply

information Login or create an account to comment on this story