Reboot after Setup

feurich

Well-known member
Joined
Oct 21, 2003
Messages
168
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 havent tried the code, but here it is.

Code:
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 didnt write this code, and have eliminated some of it (logoff, shutdown & force routines). This should cover it. I hope, but I cant 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.
Im not able (or I dont 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 dont 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

Ive 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