473,508 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exit program and log off as xp user

Ini
Hi,

I'm using VB6 and Windows XP. For an user on my computer (my 3 year old
daughter) I wrote a program in VB. For reasons of security the program
automaticly starts as she logs in on her user-account.

Now I'm wondering if it's possible to automaticly log off at the moment the
VB-program is ended
I now use a command-button with the "End"-statement, so you return to the
desktop. Can I use another command or do I need to call an external command?
If so, how?

Thanks,

Ini

Nov 12 '05 #1
1 3730
> I'm using VB6 and Windows XP. For an user on my computer (my 3 year old
daughter) I wrote a program in VB. For reasons of security the program
automaticly starts as she logs in on her user-account.

Now I'm wondering if it's possible to automaticly log off at the moment the VB-program is ended
I now use a command-button with the "End"-statement, so you return to the
desktop. Can I use another command or do I need to call an external command? If so, how?


look at http://www.mentalis.org/tips/tip016.shtml

you can see:

Use the function ExitWindowsEx. This function has two parameters. The first
is one or more flags to instruct windows how to shutdown. These are listed
below along with the declarations. The second part of the function is
reserved, and it set to zero. It is important to unload your application to
help the system to shut down smoothly. The declarations for this function
are below.
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4

Declare Function ExitWindowsEx Lib "user32" Alias _
"ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long

If you wanted to forcefully reboot the computer use the following code:

t& = ExitWindowsEx(EWX_FORCE OR EWX_REBOOT, 0)

If you wanted to logoff the computer use the following code:

t& = ExitWindowsEx(EWX_LOGOFF, 0)

Bye Luca
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8487
by: Guinness Mann | last post by:
Pardon me if this is not the optimum newsgroup for this post, but it's the only .NET newsgroup I read and I'm certain someone here can help me. I have a C# program that checks for an error...
32
5846
by: Protoman | last post by:
I have a function that calculates the mean of the some numbers; I need it to accept any number of parameters (one needs to be the number of the other parameters) Can you help me out here? Here's...
4
2800
by: Mulder | last post by:
Has anyone enabled log mirroring under DB2 v8 on AIX 4.3.3 or 5.? and if so are you archiving these mirrored logs to TSM? Is this possible? If so is there any sample code for the user exit and...
11
11127
by: Yasaswi Pulavarti | last post by:
I know there are some sample user exit programs in sqllib/samples/c directory. How do I tell DB2, which user exit program to use? I know I have to edit and compile the c based user exit programs,...
8
5370
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
19
11459
by: ern | last post by:
Right now I'm using exit(0) to terminate my program. My program is a console .exe application. After the "exit(0)" line of code is encountered, the console application waits for an enter press,...
8
29110
by: Nasutperaah | last post by:
Hi all, I have written a C ++ program and now need to add a way to make it exit on command, or start over from the beginning. I have very little programming knowledge; Here is my code: Thanks in...
5
3219
by: alexia.bee | last post by:
Hi, I my program runs other program(form) by process.start. In some cases the other program gets exception and dies. Can I get the reason of the termination of other program(Stopped by user,...
6
2196
by: Michael_R_Banks | last post by:
I have a program with a user input subroutine that I want to exit after a specific amount of time. How do I exit the sub when the timer elapsed event fires? Regards, Michael
5
3165
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7042
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.