I am a bit of a novice w/ programming and the whole gadget concept.

I am trying to create a gadget that allows me to Lock my Workstation, Shut Down or Restart the computer w/ just the click of a button.

I figured it would be a simple gadget, HA! i was wrong.

At first I figured i would find out what shuts down a computer... ExitWindowsEx(POWEROFF), located in user32.dll, will do it.

So then I said cool maybe i can point it to that function. Well, now i dont even know if it does work cuz my gadget wont ever appear in the add list. I even dropped it into the "Program Files" fold and when i click the + button on the Sidebar the Icon shows up briefly then disappears.

None of this gadget creating thing is making sense. I have tried to read 3 different "Guides" but they all suck and explain nothing.

They all show things like "Hello World!" which is the worst tutorial ever to programing cuz it shows you how to do nothing that i would ever concieve of to do in a program. There needs to be a guide to something cool, like C# Expresses RSS tutorial.

Any help at all

I guess can I even call the ExitWindowsEx()

Re: Sidebar Gadget Development My struggling gadget production.

Bruce Williams

At the risk of suggesting yet another "guide", check out my ActiveX gadget tutorial:


It will show you how to call ExitWindowsEx from your gadget. (Actually, it shows you how to get a list of all the programs installed on your computer, but if you can do that, you can also call ExitWindowsEx.)

I don't know how your gadget can show up briefly and then disappear from the gadget gallery dialog - I've never seen that behavior. Please feel free to post your gadget somewhere if you'd like me to take a look.

I'm also interested in knowing what guides you've been looking at, that suck; and if they are Microsoft guides, I'd like to know specifically how they suck, so we can improve them.

Re: Sidebar Gadget Development My struggling gadget production.


well I tried to work through your tutorial, but when I got to Tutorial 2 and adding a Method to the control. I get a script error and am not able to proceed thru to the next steps. It seemed as though it was on to being a good tutorial tho.

Also, I would be more than happy to help provide feedback I just would rather provide the feedback via e-mail or messenger, or even communicator. Let me know :)

Re: Sidebar Gadget Development My struggling gadget production.

Jonathan Abbott

Without sounding rude, if you're a Novice Programmer - Gadgets and ActiveX COM aren't the best place to start.

Having said that, I'd forget tutorials as most of them are somewhat confusing to follow.

Your best bet is to look at an existing Gadget and modify it. There's already a Shutdown, Standby, Restart Gadget available - it was written for build 5342, but it will show you what you need to do on the code side for the Power part of it.

For a gadget.xml, copy an existing one and modify it - as this has to be exact before it will appear in the Add Gadgets dialogue.

The Sidebar Reference is also a good place for reference.

Re: Sidebar Gadget Development My struggling gadget production.



I didn't find it rude at all. That's some of the feedback I was hoping to hear. Personally I figured the gadgets may be a great place to start as they didn't seem to take too much complicated programming but I would also be able to see results. I love that you had linked an existing gadget of what I had in mind, because my greatest way of learning is through comparing analysis. I have already downloaded it and am browsing the code. Thank you both for your help!


Re: Sidebar Gadget Development My struggling gadget production.

Tom from cener.co.uk

instead of a com object why don't you just call/run a window less application to do what you want it to do