473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem rebooting console app

When I use the ExitWindowsEx function in my C# console application it
doesn't reboot. Any ideas why?
Nov 16 '05 #1
2 1578
Brady,

Goblins? Your doing it wrong? Please provide us with a bit more
information,
such as the API declaration and call as well as any errors you might be
getting etc
so we wont have to play the guessing game =)

//Andreas

"Brady Kelly" <bk****@icom-it.co.za> skrev i meddelandet
news:k3********************************@4ax.com...
When I use the ExitWindowsEx function in my C# console application it
doesn't reboot. Any ideas why?

Nov 16 '05 #2
On Wed, 14 Apr 2004 14:30:37 +0200, "Andreas Håkansson" <andy.h (at)
telia.com> wrote:
Brady,

Goblins? Your doing it wrong? Please provide us with a bit more
information,
such as the API declaration and call as well as any errors you might be
getting etc
so we wont have to play the guessing game =)


I'm using the WindowsController class from The KPD-Team at
http://www.mentalis.org/.

The declarations are, in only the necessary detail:

public enum RestartOptions {
Reboot = 2,
}

[ DllImport( "user32.dll", EntryPoint="ExitWindowsEx",
CharSet=CharSet.Ansi )]
private static extern int ExitWindowsEx(int uFlags, int dwReserved);

....
EnableToken("SeShutdownPrivilege");
if (ExitWindowsEx(RestartOptions.Reboot | EWX_FORCE, 0) == 0)
throw new Exception.......

I'm not getting an exception, so it looks like the call is
'apparently' working. The strangest is that the application restarts,
not the system.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Richard Hanson | last post by:
Over the last few days, I reinstalled Win2kSP2 to a spare harddrive I had just swapped into my Fujitsu LifeBook P1120 (long story <wink>). Subsequently, I DL'ed the newest Python alpha (2.4a2), and...
1
by: Mark Andrews | last post by:
I feel like an idiot but I can't seem to figure out which setting I need to change to stop a bad page from caching. - I modified the search.aspx page in our Sharepoint 2003 portal product...
0
by: Al-ahmadi | last post by:
Hi EveryBody: Is there any way to add the rebooting code to the user interface of the setup project in VB.net ? if the answer is yes,how can I do it ? but if the answer is no, Is there any way...
4
by: A | last post by:
Anyone have any code to reboot from a C# app?
2
by: Brady Kelly | last post by:
When I use the ExitWindowsEx function in my C# console application it doesn't reboot. Any ideas why?
1
by: Al-ahmadi | last post by:
Hi EveryBody: Is there any way to add the rebooting code to the user interface of the setup project in VB.net ? if the answer is yes,how can I do it ? but if the answer is no, Is there any way...
3
by: genojoe | last post by:
I am opening a Word document with code like this: Dim WordApp As New Word.Application Try WordApp.Documents.Open(CType("C:\Temp\mydoc.doc", Object)) etc. -- etc. -- etc. Return True Catch...
7
by: Raju5725 | last post by:
Hi All, How can I Change Local Machine IP Address without rebooting the machine using VB.Net. As I want to shift from one IP address to another IP address with application the effect should...
0
by: blueghost73 | last post by:
We have a SQL Server 2000 server where we can't get into the "Full-Text Catalogs" section of Enterprise Manager for any database. It just freezes Enterprise Manager every time we try. After...
1
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.