473,666 Members | 2,073 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 3740
> 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 _
"ExitWindow sEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long

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

t& = ExitWindowsEx(E WX_FORCE OR EWX_REBOOT, 0)

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

t& = ExitWindowsEx(E WX_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
8515
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 condition and if it finds it it notifies the user with a MessageBox and then on the next line of code (example in a minute) it calls Application.Exit(). To my astonishment, I stepped through the code with the debugger, and watched it call...
32
5871
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 the function: const long double& mean(long long x) { vector<int> v(x); for(int i= 1; i <=x; ++i) { v.push_back(i);
4
2814
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 mirrored logging? Thanks
11
11155
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, but how do I tell DB2 instance and database to use that particular user exit program. Thanks, Yasaswi
8
5388
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 `'}'' 'else if (choice == 27) exit(0) } }' Here is my program (Simple loop to display currency equivalencies based
19
11481
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, before terminating. I want it to terminate completely without having to press enter manually. Anybody know what I might be missing here ?
8
29121
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 advance for any help. /////////////////////////////////////////////////////////////////////////////////////////////////// // ...
5
3226
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, exception). Note that when the other program dies due to exception, it writes to messagebox. does the "StandardOutput" and "StandardError" is only good for console
6
2203
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
3179
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 search algorithms that can be used are Linear Search and Binary Search. The sorting algorithms are bubble, selection and Insertion sort. First, the user is asked whether he/she wants to perform a search option, a sort operation, or exit the program. If...
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.