Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reboot without verification

Posted on 1999-07-08
10
Medium Priority
?
190 Views
Last Modified: 2010-04-06
Hi ! How can I reboot win95/98 computer without verification when documents are opened ???
0
Comment
Question by:ItsMe
[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
  • 6
  • 3
10 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 80 total points
ID: 1387265
Hi again...   :-)

Use this one:

  ExitWindowsEx(EWX_REBOOT or EWX_FORCE, 0);

Regards, Madshi.
0
 

Author Comment

by:ItsMe
ID: 1387266
really with or between, or one of 'em ?
0
 

Author Comment

by:ItsMe
ID: 1387267
I've already tryed with EWX_FORCE or Reboot but it doesn't work. 1. I have to call it twice to get a result. EWX_FORCE makes windows crashing and reboot seem to send wm_endsession to apps. so they're asking for "save document ?"

regards
ItsMe
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:ItsMe
ID: 1387268
I've tried your solution. I'm surprised, that the compiler accepts the or :-). *But* Windoof hangs up at the screen "windows wird heruntergefahren".

regards
ItsMe
0
 
LVL 15

Expert Comment

by:simonet
ID: 1387269
>"windows wird heruntergefahren".

Translating that would really help non-German folks around here!

Alex
0
 

Author Comment

by:ItsMe
ID: 1387270
Oh, sorry: "the computer shuts down" :-) (It should shut down)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1387271
Hi ItsMe, those EWX_* constants are simply 32bit ordinals, that means you can use "or" and "and" and even "xor" - if you like...   :-)

Well, strange, that your compi hangs during shutdown, mine does not!

If it all doesn't help you could go the hard way and terminate all running processes, then do a "normal" shutdown. But then you must know how to enumerate all running processes. Which Delphi-version do you have? Sorry, I have to ask again, though probably you've already told me that 10 times...   :-)

Regards, Madshi.
0
 

Author Comment

by:ItsMe
ID: 1387272
I've got Delphi 4.0. You mean I should send WM_Destroy to
all windows ? I'm interested in getting a list of all windows, this must be possible with FIndNext or something like that ? I don't know, perhaps - no sure - you know ?
But I think if only my comp hangs I will use  it in my app as is. If a comp hangs its not my problem :-)

regards
ItsMe
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1387273
You should test your program on other PCs. If it only hangs at your PC - leave it as it is. Otherwise do this:

(1) Download the unit "enumStuff.pas" from my homepage. Then do something like this:

procedure TerminateAllProcesses;
var pl : TProcessList;
    i1 : integer;
    c1 : cardinal;
begin
  pl:=GetProcessList;
  for i1:=0 to high(pl) do
    if (pl[i1].id<>GetCurrentProcessID) and (CompareText('kernel32.dll',ExtractFileName(pl[i1]))<>0) then begin
      c1:=OpenProcess(PROCESS_ALL_ACCESS,false,pl[i1].id);
      TerminateProcess(c1,0);
      CloseHandle(c1);
    end;
end;

But this is quite hard stuff! So please save all files before you do this...   :-)
Afterwards the EnumWindowsEx should work at once. You don't even need the force flag anymore.

Sending a WM_DESTROY to all windows won't work. Though, if you don't want to use such a big unit like mine, you can enumerate all windows (EnumWindows), then call GetWindowThreadProcessID for each window to get the processID of the process to which each window belongs. Then you can open the process and terminate it like I did in my little loop above. But note, that there are some applications that don't have windows at all. You can stop those apps only by using something like my unit.

Regards, Madshi.
0
 

Author Comment

by:ItsMe
ID: 1387274
Thanks, I'll try your "or" solution. I think it work on other machines.

regards
ItsMe
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 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