Naredba za Shut Down? Delphi

3

Naredba za Shut Down? Delphi

offline
  • Pridružio: 10 Mar 2005
  • Poruke: 222

Milos4s ::Ima li neki program u kojem pravim "setup"?

Mozes da ga napises i sam. Treba ti prvo MSCOMPRESS tool, a zatim se preko LZCopy i LZExpand funkcija odrađuje ostalo. Ove funkcije su deo samog Windowsa.

Alternativa je da nabavis Install Shield ili slican program. Uz Delphi je isla neka osakacena verzija, koja nije pravila bas najbolje grupu u Programs opciji Start menija.



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Pridružio: 19 Dec 2005
  • Poruke: 110
  • Gde živiš: S one strane Drine gde padaju mine!!!

Za gasenje racunara sam koristio sledeci kod. Ali nakon klika na dugme racunar se ne gasi odmah nego nakon 30 sekundi. Da li neko mozda zna zasto i kako da prepravim da se gasi odmah.

ShellExecute(Handle, 'Open',PChar('shutdown.exe'), PChar('-s -c "HeHeHe - your about to get shutdown! :D"'), nil, SW_SHOW);



offline
  • Pridružio: 10 Mar 2005
  • Poruke: 222

Zato sto si ostavio default period od 30 sekundi za gasenje sistema. Fali ti parametar -t XX, gde je XX vreme u sekundama

offline
  • Pridružio: 19 Dec 2005
  • Poruke: 110
  • Gde živiš: S one strane Drine gde padaju mine!!!

Gde se ubacuje t XX u ovaj kod?

offline
  • Emil Beli
  • Pridružio: 03 Jan 2005
  • Poruke: 2990
  • Gde živiš: Beograd

The ExitWindowsEx function either logs off, shuts down, or shuts down and restarts the system.

BOOL ExitWindowsEx(

UINT uFlags, // shutdown operation
DWORD dwReserved // reserved
);


Parameters

uFlags

Specifies the type of shutdown. This parameter must be some combination of the following values:

Value Meaning
EWX_FORCE Forces processes to terminate. When this flag is set, Windows does not send the messages WM_QUERYENDSESSION and WM_ENDSESSION to the applications currently running in the system. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.
EWX_LOGOFF Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.
EWX_POWEROFF Shuts down the system and turns off the power. The system must support the power-off feature.Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.
EWX_REBOOT Shuts down the system and then restarts the system. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.
EWX_SHUTDOWN Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.


dwReserved

Reserved; this parameter is ignored.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The ExitWindowsEx function returns as soon as it has initiated the shutdown. The shutdown or logoff then proceeds asynchronously.
During a shutdown or log-off operation, applications that are shut down are allowed a specific amount of time to respond to the shutdown request. If the time expires, Windows displays a dialog box that allows the user to forcibly shut down the application, to retry the shutdown, or to cancel the shutdown request. If the EWX_FORCE value is specified, Windows always forces applications to close and does not display the dialog box.

The ExitWindowsEx function sends a separate notification message, CTRL_SHUTDOWN_EVENT or CTRL_LOGOFF_EVENT as the situation warrants, to console processes. A console process routes these messages to its HandlerRoutine functions, which are added and removed by calls to the SetConsoleCtrlHandler function. ExitWindowsEx sends these notification messages asynchronously; thus, an application cannot assume that the console notification messages have been handled when a call to ExitWindowsEx returns.

Windows NT: To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. For more information about security privileges, see Privileges.
Windows 95: Security privileges are not supported or required.

Dopuna: 10 Mar 2006 13:59

uses Windows,classes;

procedure UgasiKompjuter;
begin
ExitWindowsEx(EWX_SHUTDOWN,0);
end;

procedure Rebootuj;
begin
ExitWindowsEx(EWX_REBOOT,0);
end;

//itd, itd...

offline
  • Pridružio: 10 Mar 2005
  • Poruke: 222

Licanin ::Gde se ubacuje t XX u ovaj kod?

U spisak parametara, tamo gde je i -s...

Beli ti je dao direktan poziv API funkciji, sto je elegantnije resenje.

offline
  • Pridružio: 14 Maj 2011
  • Poruke: 136
  • Gde živiš: Priboj

Tempirano isključivanje



Ako skidate operativne sisteme, filmove , softvere i računar treba da radi preko noći, verovatno ste razmišljali kako podesiti Windows da isključi računar u zadano vrijeme.
Evo šta treba da uradite kada je u pitanju Windows.
Kliknite na Start>Run ( alternativa tipke Win I R ) I u polje Open unesite “shutdown –s –t” bez navodnika I broj sekundi nakon čega će se računar isključiti ( u mom primeru ja sam stavio 4500 sekundi). Nakon što ste kliknuli na OK, videćete prozorčić System Shutdown koji će vam prikazati koliko je vremena preostalo do isključivanja računara da spremite sve ostalo na čemu ste do tada radili.
Za kraći postupak, potrebno je uraditi sledeće: kliknite desnim klikom na desktop I odaberite New-Shortcut. U Shortcut upišite “Shutdown.exe –s –t 4500” kliknite na Next, unesite ime prečaca npr. Isključi I odaberite Finish. Na desktopu će se pojaviti ikona koju drag and drop metodom možete postaviti u traku za brzo pokretanje.. Istim postupkom možete napraviti prečac za odustajanje s tom razlikom što u Create Shortcut treba upisati “shutdown –a”.

offline
  • Ričard  Male
  • Lavlje srce
  • Supermoderator
  • Zver!
  • Electro maintenance engineer
  • Pridružio: 28 Nov 2006
  • Poruke: 13745
  • Gde živiš: Vršac

Napisano: 15 Avg 2011 22:15

Ji Đing ::Tempirano isključivanje



Ako skidate operativne sisteme, filmove , softvere i računar treba da radi preko noći, verovatno ste razmišljali kako podesiti Windows da isključi računar u zadano vrijeme.
Evo šta treba da uradite kada je u pitanju Windows.
Kliknite na Start>Run ( alternativa tipke Win I R ) I u polje Open unesite “shutdown –s –t” bez navodnika I broj sekundi nakon čega će se računar isključiti ( u mom primeru ja sam stavio 4500 sekundi). Nakon što ste kliknuli na OK, videćete prozorčić System Shutdown koji će vam prikazati koliko je vremena preostalo do isključivanja računara da spremite sve ostalo na čemu ste do tada radili.
Za kraći postupak, potrebno je uraditi sledeće: kliknite desnim klikom na desktop I odaberite New-Shortcut. U Shortcut upišite “Shutdown.exe –s –t 4500” kliknite na Next, unesite ime prečaca npr. Isključi I odaberite Finish. Na desktopu će se pojaviti ikona koju drag and drop metodom možete postaviti u traku za brzo pokretanje.. Istim postupkom možete napraviti prečac za odustajanje s tom razlikom što u Create Shortcut treba upisati “shutdown –a”.


Recimo...

Rešim da donwloud-jem neku Linux distribijicu, program kojim vršim downloud, izračuna da je za to potrebno 3600s, podesim “shutdown –s –t” funkciju na 4000s jer je moguće da internet konekcija varira. Istekne zadato vreme, računar se ugasi, ja se sutra ujtru probudim, uključim računar i imam šta da vidim, nije se skinuo ceo fajl, a server sa koga sa vršio downloud, nema resume opciju. A pri tom imam ograničen protok; i šta sad?

Svaki moderni downloud menadžer ima u sebi integrisanu opciju gašenja računara po završetku downlouda, tako da je ova opcija, koju si ti naveo totalno ne potrebna.

Dopuna: 15 Avg 2011 22:17

Plus, ovo nema veze sa Delphi-jem...

Ko je trenutno na forumu
 

Ukupno su 801 korisnika na forumu :: 5 registrovanih, 2 sakrivenih i 794 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: DPera, Karla, Kriglord, nemkea71, zlaya011