There is some easily available information on finding the status of a battery, or weather it\'s charging or not. (GetSystemPowerStatus API or System.Windows.Forms.SystemInformat
I honestly don't know, but I'd have a look at the APM or ACPI APIs.
Other than that, the only option I can think of right now is a USB controlled robotic arm that ejects the battery when you need to stop charging, but that's probably not what you are looking for, and borders on the complicator's glove in terms of level of over-engineering. :)
Lenovo laptops know lets you specify the charging levels from bios or from their software, but this feature must be implemented in bios in order to be accessed from windows.
I think it's possible, because it was patented by IBM (patent no. 7570015).
Not sure if there's a Windows API available for that.
I think MiCTech is right. I dont think it is possible but here are some resources which you might useful.
One of the options is to get hold of the device(I) for battery (Microsoft ACPI-Compliant Control Method Battery). Listen for PowerNotification events forever. On each notification check the PowerStatus of the battery. There are APIs for all of the above purposes in .Net and win32
Keep the device(I) disabled as long as the powerstatus is >threshold. Enable it as soon as goes below that or when you are not on AC power (i.e. before removing AC power, your continuously monitoring software should enable that battery device - or you manually enable it).
hmm,...this is a very buggy solution, but it can achieve what you want, although you have to be very careful.
just give up and forget this matter. It is not a problem, so dont worry about that. Let it be plugged in and be fully charged. when it is on 100%, then the system automatically stops charging, and goes on the plug power, so, maybe no worry to wear a battery, as all notebooks (if it's not from the XX century) has auto regulation of it. Although, If you will ever need, move you hands and plug it on/off manually. Dont be lazy. That is the #1 and quickest solution, beleive me.
(however, if you want to waste time, here are methods -
1) http://www.makeuseof.com/answers/what-battery-manager-can-stop-charging-at-a-certain-percentage/
2) disable devices temporarily (But you need to disable "Microsoft ACPI-Compliant Control Method Battery")
3) https://superuser.com/questions/813182/how-to-stopdisable-battery-charging-on-laptop