# Windows Log Off Button



## dynamicaldave (Jun 5, 2009)

I am supposed to created a log off button for a University computer lab so that students will be less likely to forget to log off. I have programming experience in java and have used visual basic for applications in microsoft excel, but I'm not sure of the best way to approach this. 

To be clear, I know how to direct a desktop icon to log off the computer, but I do not know how to go about attaching a listener to some image(a button) on the desktop so that that large button will log off.

Any help is appreciated, even just making a suggestion for what scripting language to use.

Thanks.


----------



## pvc_ (Feb 18, 2008)

this shell instruction would accomplish that (vb):

Shell("c:\windows\rundll32.exe shell32.dll,SHExitWindowsEx 0")

not sure if you have to declare any api's to be able to run the shell instruction.


----------



## Ent (Apr 11, 2009)

I'd create a splash-screen form, gut out all the code, resize it to arount 100 px squared, and fill it with a button. Make the button look nice, add the shell to the handler, compile, and stick it in the startup folder. That essentially sticks a nice big button with everything you need, and it looks like pvc_ has given you all the code you actually need.

But I'm using VB.net, and though the express version it still packs a lot more power than anything in excel. I'm not sure how you could do the same with what you've got there. An excel VB macro probably isn't the way to go.


----------



## Lilian33 (Dec 13, 2008)

It"s done in 2 minutes with C/Win32 api...
You can ask on Professional Win32 api group :
http://tinyurl.com/cmhb5g by Google
for code (C or C++)


----------

