|
-
Aug 6th, 2001, 01:30 PM
#1
Thread Starter
Fanatic Member
Restart Windows?
Is there a function to just restart Windows, and not the whole computer?
Alcohol & calculus don't mix.
Never drink & derive.
-
Aug 6th, 2001, 05:56 PM
#2
You could just crash explorer and this would force Windows to refresh/restart itself. I believe you can do this with the TerminateProcess API function.
-
Aug 7th, 2001, 05:40 AM
#3
PowerPoster
here is some code that i wrote in VB, you got to convert it into C/C++/VC++ 
VB Code:
'// Main Form
Private Sub cmdAction_Click()
If optShutdown(0).Value Then
Exit_Wnd 0
ElseIf optShutdown(1).Value Then
Exit_Wnd 1
ElseIf optShutdown(2).Value Then
Exit_Wnd 2
ElseIf optShutdown(3).Value Then
Exit_Wnd 3
End If
End Sub
'// Basic Module
Option Explicit
'// WIN32API Function
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
'// WIN32API Constant
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Public Sub Exit_Wnd(ByVal lpChoice As Integer)
Select Case lpChoice
Case 0
'Logoff
ExitWindowsEx EWX_FORCE Or EWX_LOGOFF, 0
Case 1
'ShutDown
ExitWindowsEx EWX_FORCE Or EWX_SHUTDOWN, 0
Case 2
'Reboot
ExitWindowsEx EWX_FORCE Or EWX_REBOOT, 0
Case 3
'???
ExitWindowsEx EWX_FORCE Or EWX_FORCE, 0
End Select
End Sub
regards,
-
Aug 7th, 2001, 06:11 AM
#4
Originally posted by Matthew Gates
You could just crash explorer and this would force Windows to refresh/restart itself.
LOL I don't think the user would be too fond of that.
Wynd, you could use the ExitWindowsEx() function.
Code:
ExitWindowsEx(EWX_FORCE | EWX_REBOOT, 0);
-
Aug 11th, 2001, 01:36 AM
#5
Frenzied Member
Re: Restart Windows?
Just to restart Windows use:
Code:
ExitWindowsEx(EWX_LOGOFF, 0);
-
Aug 11th, 2001, 09:21 AM
#6
Thread Starter
Fanatic Member
Ok, thanks guys. The reason I asked is because lots of programs I've seen say "You must restart Windows to complete the installation" or something, but they restart the computer, not Windows.
Alcohol & calculus don't mix.
Never drink & derive.
-
Aug 12th, 2001, 06:43 AM
#7
Good Ol' Platypus
But you don't have to necessarily restart the computer, a lot of the newer programs caught on to this, go into DOS for a few seconds, and come right back in.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 12th, 2001, 07:43 AM
#8
One way is to hold shift while restarting. I don't know if you can programmatically simulate this though.
-
Aug 13th, 2001, 03:10 AM
#9
Junior Member
Microsoft disabled the shift thingy in Windows ME and Win2K because some motherboards don't restart HDDs and FDDs right when you do it. It's better to restrt the wole computer
 Pinkfish Is NPC! 
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
|