Solved

Need To RESTART Windows95 from VB

Posted on 1999-01-13
5
139 Views
Last Modified: 2012-05-04
How do I RESTART Windows95 from VB. Can't find an API call that restarts just a shutdown call?
0
Comment
Question by:rblackwell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
prozak earned 100 total points
ID: 1455952
The ExitWindowsEx function can be passed EWX_REBOOT in the uFlags parameter which will make the machine reboot after it has been shutdown.

The value of EWX_REBOOT is 2.

Hope this helps ...
0
 
LVL 4

Expert Comment

by:mcix
ID: 1455953
0
 

Expert Comment

by:masuta
ID: 1455954

I use:

    Option Explicit

    #If Win32 Then
        Private Declare Function ShutdownWindows Lib "user32" Alias _
            "ExitWindowsEx" (ByVal uFlags As Long, _
            ByVal dwReserved As Long) As Long
    #Else
        Private Declare Function ShutdownWindows Lib "user" Alias _
            "ExitWindows" (ByVal wReturnCode As Integer, _
            ByVal dwReserved As Integer) As Integer
    #End If
    Private Const EWX_LOGOFF = 0
    Private Const EWX_SHUTDOWN = 1
    Private Const EWX_REBOOT = 2
    Private Const EWX_FORCE = 4

    Private Sub Command1_Click()
        ShutdownWindows EWX_FORCE, 0
    End Sub
 

0
 

Author Comment

by:rblackwell
ID: 1455955
I am in 16 VB.
0
 
LVL 4

Expert Comment

by:mcix
ID: 1455956
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question