|
-
Jan 30th, 2003, 08:13 PM
#1
Thread Starter
Member
Log Off?
How do you log off of Windows XP using VB.NET?
josh
Smartbar XP is WAY better then Dashboard. http://www.smartbarxp.com
-
Jan 31st, 2003, 12:00 AM
#2
Junior Member
The ExitWindowsEx API Still works in .NET as far as I know.
http://www.allapi.net/apilist/ExitWindowsEx.shtml
-
Jan 31st, 2003, 08:20 PM
#3
Addicted Member
Those examples don't seem to be working in vb.net
Does anyone know of any other examples?
-
Jan 31st, 2003, 09:04 PM
#4
Sleep mode
Originally posted by ProgrammerJon
Those examples don't seem to be working in vb.net
Does anyone know of any other examples?
Well , here's another way ......I've not tested it yet!
VB Code:
shell"C:\WINDOWS\RUNDLL32.EXE user.exe,Exit,Windows"
-
Feb 1st, 2003, 10:31 AM
#5
Addicted Member
Originally posted by pirate
Well , here's another way ......I've not tested it yet!
VB Code:
shell"C:\WINDOWS\RUNDLL32.EXE user.exe,Exit,Windows"
when I tried running it I got a file not found error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in microsoft.visualbasic.dll
Additional information: File not found.
-
Feb 1st, 2003, 11:06 AM
#6
Sleep mode
try this now .
VB Code:
Shell("C:\WINDOWS\system32\RUNDLL32.EXE user.exe,Exit,Windows")
-
Feb 1st, 2003, 11:28 AM
#7
Addicted Member
Originally posted by pirate
try this now .
VB Code:
Shell("C:\WINDOWS\system32\RUNDLL32.EXE user.exe,Exit,Windows")
It dosn't do anything now.
Note: I changed "C:\WINDOWS..." to "C:\WINNT" because WINNT is my system directory. (I have Windows 2000 pro)
-
Feb 1st, 2003, 11:30 AM
#8
Addicted Member
Well it acutly dose do SOMETHING but it doesn't log off, the progress indicator just goes for a seconnd.
-
Feb 1st, 2003, 11:43 AM
#9
Addicted Member
this wouldnt happen to be for a virus or hack would it? it just sounds wierd if not what would you need that for?
-
Feb 1st, 2003, 12:57 PM
#10
the API Should still work...Make sure you changed the LONGS to Integers...
VB Code:
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Feb 1st, 2003, 03:46 PM
#11
Addicted Member
Originally posted by james14
this wouldnt happen to be for a virus or hack would it? it just sounds wierd if not what would you need that for?
I was planning on writing a program that would log off my account if someone else was using it. The reason why I wanted a program for this is because I frequently leave my computer logged on to my user and my dad dosn't want other people on my login because I have higher security privalges then the other people who use this computer.
-
Feb 1st, 2003, 04:00 PM
#12
Frenzied Member
How would you know if someone was logged on as you?
Dont gain the world and lose your soul
-
Feb 1st, 2003, 04:04 PM
#13
Addicted Member
I was going to use the filesystemwatcher.
-
Feb 1st, 2003, 06:25 PM
#14
Addicted Member
-
Feb 1st, 2003, 09:52 PM
#15
Addicted Member
Originally posted by sunburnt
the API Should still work...Make sure you changed the LONGS to Integers...
VB Code:
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
I don't undersand how to make this work, can you give me an example so that it will log off when you click a command button.
-
Feb 1st, 2003, 10:07 PM
#16
-
Feb 1st, 2003, 10:14 PM
#17
Addicted Member
-
Feb 1st, 2003, 10:14 PM
#18
Sleep mode
Originally posted by pirate
here you go ... heavily tested on XP (more than 15 times )
little note , it's better you run it from bin dir so it wouldn't ask you whether you want to stop debugging the code or not !
-
Feb 1st, 2003, 11:51 PM
#19
Thread Starter
Member
thanks a lot for all the help. THe changing the Long's to Integers fixed it. Thanks a lot. I will let you all know when my program is finished.
Josh
Smartbar XP is WAY better then Dashboard. http://www.smartbarxp.com
-
Feb 2nd, 2003, 11:30 AM
#20
Addicted Member
Originally posted by pirate
here you go ... heavily tested on XP (more than 15 times )
I worked great until I copied it an put it in my program.
it say's ExitWindowsEx and EWX_LOGOFF is not decleared.
-
Feb 2nd, 2003, 12:32 PM
#21
Sleep mode
Originally posted by ProgrammerJon
I worked great until I copied it an put it in my program.
it say's ExitWindowsEx and EWX_LOGOFF is not decleared.
do this
VB Code:
'in a module
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Public Const EWX_LOGOFF As Short = 0
'in your form
Dim lresult As Object
lresult = ExitWindowsEx(EWX_LOGOFF, 0) 'close all programs and log on as a different user
-
Feb 2nd, 2003, 12:37 PM
#22
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|