Reboot after Setup

feurich

Centurion
Joined
Oct 21, 2003
Messages
170
Location
Holland
Hi DI HO Neighbour,

How do you make the setup automatically reboot after the setup is done.
I need this because my setup.exe also installs 2 Barcode fonts and they need a a system restart.

Is there a reboot property somewhere ?

Cire
 
This is what I have in one of my books. I haven't tried the code, but here it is.

Visual Basic:
Public Module Reboot
'This is the API function for exiting Windows
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
'This enumeration holds related constants
Private Enum ExitWindowsFlags
'Use this constant to cause a system reboot
Reboot = 2
End Enum
Public Sub Main()
ExitWindowsEx(ExitWindowsFlags.Logoff, 0&)
End Sub

I didn't write this code, and have eliminated some of it (logoff, shutdown & force routines). This should cover it. I hope, but I can't support it... I am only going by the code in the book. Hope it helps!
 
Where do I put this code

Hi,

The code looks good but where should I put it.
I'm not able (or I don't know how) to add custom code to my setup project.

Could you maybe tell me from what book you got this piece of code ?

Cire :rolleyes:
 
Are you writing the setup code (custom setup.exe) or is this the one included with VB .NET? I don't think you can manually add code to the setup.exe, you would have to create your own setup program.

VB .NET Programmers Cookbook by Microsoft Press.
 
Custom action

I've figured out that you can add a custom action in your Setup & deployment project. This Custom Action can be a dll or a exe file.
I have made your code in to a exe file to see if it works but there is no reset after I run the code.
 
Back
Top