Ok, here´s the idea: I'm gonna make a program that plays a really loud sound, like a siren, if my laptop is locked and someone unplugs the power chord. I know this isn´t gonna stop smart thieves and there´s nothing to stop them from just turning off the sound as soon as they hear it but the idea is that the loud sound will scare them off or someone will hear it and go see what's going on. I´m in university and some laptops have been stolen from here so I´m a bit worried.
Why not just buy one of those locks that let you lock your laptop to a convenient heavy object? Breaking that would also require a while and draw attention, and then no embarrassing false alarms that make everyone in the computer lab despise you.
Indeed -- look for the little hole which is about 3mm by 7mm which is designed for plugging one of these into http://www.microsaver.com/html/2220.html
A laptop with one of those little wire security systems was stolen from a place I used to work... the 23rd floor of a high rise owned by the company I worked for. Someone, it seems, sawed through the wire during the overnight period, despite the metal detectors and x-ray machines.
Actually there is at least one external laptop alarm already on the market that makes a very loud sound (louder than your laptop speakers could make, I believe) when the laptop is moved. It plugs into the security lock slot.
Um, after a quick Google search, make that "there are at least twenty bazillion" laptop alarms on the market today. Just do a search for "laptop security" or "laptop alarm" or "notebook alarm" and you'll find quite a range of choices available. These things all emit a loud noise when the laptop is moved, or when it strays too far from you if you're holding a homing device.
Yeah, I know you can buy them but I want to program it. Also just for the practice, I´m studying computer science. Anyone know how to catch the 'unplug' signal?
You could start here:
Or, for a simpler approach, you could just periodically call the GetSystemPowerStatus function:
I love it.
Good Luck laptop user.
Google for "Briefcase Alarm". Most of these attach the alarm to the case and give you a monitor. You and the monitor get more than "X" feet apart and the alarm on the briefcase goes off.
Thanks Philip, I looked at that and it is what I was looking for. I realize that this alarm probably isn't gonna help me much and a hardware thingy which makes sound is gonna be much more useful, but hey, I´m studying for my exams and need a pet project to do between studying Big O notations and binary trees.
I would not think it that good an idea to have the laptop permantly on mains power anyway. At the very least you're running the risk of burning yourself when you pick it up (and putting it on your lap doesn't bear thinking of) and at the worst you might cause a fire that destroys the whole building.
I could set fire to the building...
huh? my laptop is plugged in 99.5% of the time. it's a nice small computer which takes up very little space in my apartment.
There have been cases of fires caused by laptops or the transformers overheating. I've just felt my transformer now, and while not hot enough to burn it is still pretty hot to touch.
You need a metallic laptop, like an Apple, then just run loads of current through it so the would-be thief is electrofried.
Fog Creek Home