Naredba za Shut Down? Delphi

1

Naredba za Shut Down? Delphi

offline
  • Đuro Glumac
  • dipl. ing. informatike
  • Pridružio: 08 Feb 2004
  • Poruke: 3640
  • Gde živiš: ApAtIn

Jel zna neko nardbu za ShutDown Copmutera u Delphiju?
Znaci kada se pokrene ta naredba ako je ATX kuciste(napajanje) da se racunar iskljuci.



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Max  Male
  • Super građanin
  • Marko Milic
  • MWEB - Project manager & Front-end developer /Saobracajni inzenjer
  • Pridružio: 02 Nov 2003
  • Poruke: 1363
  • Gde živiš: Beograd - Jagodina

O pa poceli smo sa igranjem....



offline
  • Pridružio: 18 Jul 2003
  • Poruke: 4194
  • Gde živiš: U zlatnom kavezu

Ako je xp onda samo pozovi shutdown.exe uz parametar s
znaci u vb bi to izgledalo ovako:
shell "c:\windows\system32\shutdown -s"
e sad ti samo shell zameni komandom za pozivanje u delphiju

NAPOMENA
Ovu shutdown izvrsnu datoteku ima samo xp

offline
  • Đuro Glumac
  • dipl. ing. informatike
  • Pridružio: 08 Feb 2004
  • Poruke: 3640
  • Gde živiš: ApAtIn

@max
Ne razumem kakvo igranje? Hocu da napravim prog koji ce u zadato vreme da iskljuci racunar.
@brksi
parametar -s je shutdown a -r za restart???
Jel imas nesto da radi i na ostalim sistemima?

offline
  • Pridružio: 18 Jul 2003
  • Poruke: 4194
  • Gde živiš: U zlatnom kavezu

Za automatsko gasenje Windows-a 9 uneti dole
navedenu putanju.

rundll.exe user.exe,exitwindows

samo napravi exe fajl koji ovo pokrece

offline
  • Pridružio: 16 Jun 2003
  • Poruke: 240

Koda za shutsown:

{*****************************************************************************************  *  * Unit Name : mpShutdown  * Purpose   : shutdown, reboot, poweroff, logoff Windows  * Author    : markus stephany  * Coppyright: (C) 2001 markus stephany:  This source code is freeware. You may use, change, and distribute without  charge the source code as you like. This unit can be used freely in any  commercial applications. However, it may not be sold as a standalone product  and the source code may not be included in a commercial product. This unit  is provided as is with no warrent or support. Make sure to read relevant  information and documentation from Microsoft before using this unit.  * Version   : 0.01  * Date      : 24.04.2001 19:51:23  * History   : -  *   function SysDown(bForce: Boolean=False): Boolean     shuts down the computer and eventually powers it down (if apm is working)   function SysReboot(bForce: Boolean=False): Boolean     restarts the computer   function ShutdownWindows(eKind: TShutdown; const bForce:Boolean = False): Boolean;     generic shutdown/logoff/reboot function  *****************************************************************************************} unit mpShutdown; interface uses   Windows, SysUtils; type   (* kind of shutdown *)   TShutDown = (sdPowerOff, sdReboot, sdShutdown, sdLogoff); (* ShutdownWindows: ----------------------------------------------------------   generic shutdown/logoff/reboot function   eKind: kind of shutdown   bForce: if True, force termination of applications (possible data loss!!)   returns: True on success, False on failure ------------------------------------------------------------------------------*) (* SysDown: ------------------------------------------------------------------   shuts down the computer and eventually powers it down (if apm is working)   bForce: if True, force termination of applications (possible data loss!!)   returns: True on success, False on failure ------------------------------------------------------------------------------*) (* SysReboot: ----------------------------------------------------------------   restarts the computer   bForce: if True, force termination of applications (possible data loss!!)   returns: True on success, False on failure ------------------------------------------------------------------------------*) (* SwitchPrivilege: ----------------------------------------------------------   -privilege function for nt/w2k   sPrivilege: name of the privilege   bSet: if True, enable the privilege, otherwise disable the privilege   returns: True on success, False on failure ------------------------------------------------------------------------------*) function ShutdownWindows(eKind: TShutdown; const bForce:Boolean = False): Boolean; function SysDown(bForce: Boolean = False): Boolean; function SysReboot(bForce: Boolean = False): Boolean; function SwitchPrivilege(sPrivilege: string; bSet: Boolean): Boolean; implementation const   (* name of the shutdown privilege (needed on nt) *)   SE_SHUTDOWN_NAME                  = 'SeShutdownPrivilege'; function SwitchPrivilege(sPrivilege: string; bSet: Boolean): Boolean; var   (* process token *)   hToken: THandle;   (* privilege storage *)   pTokPriv: PTokenPrivileges; const   (* enable/disable *)   iAttrs: Array[Boolean] of Integer = (0,SE_PRIVILEGE_ENABLED); begin   (* assume failure *)   Result := False;   (* open process token *)   if OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then   begin     (* get memory for privilege data *)     GetMem(pTokPriv, SizeOf(TTOKENPRIVILEGES) + SizeOf(TLUIDANDATTRIBUTES));     try       (* get current state *)       if LookupPrivilegeValue(NIL, PChar(sPrivilege), pTokPriv^.Privileges[0].Luid) then       begin         (* one priv to modify *)         pTokPriv^.PrivilegeCount := 1;         (* set enabled/disabled *)         pTokPriv^.Privileges[0].Attributes := iAttrs[bSet];         (* set new state *)         Result:= AdjustTokenPrivileges(hToken, FALSE, pTokPriv^, 0, TTokenPrivileges(nil^), DWORD(nil^));       end;     finally       (* free the privilege buffer *)       FreeMem(pTokPriv);     end;   end; end; function ShutdownWindows(eKind: TShutdown; const bForce:Boolean = False): Boolean; const   (* ExitWindowsEx consts for eKind *)   cEWXFlags: array [TShutdown] of Cardinal = (     EWX_POWEROFF,     EWX_REBOOT,     EWX_SHUTDOWN,     EWX_LOGOFF   ); var   cFlags: Cardinal; begin   (* assume failure *)   Result := False;   (* prepare ewx-flag *)   cFlags := cEWXFlags[eKind];   if bForce   then     cFlags := cFlags or EWX_FORCE;   (* on nt/w2k, the SE_SHUTDOWN privilege must be set *)   if Win32Platform = VER_PLATFORM_WIN32_NT   then     if not SwitchPrivilege(SE_SHUTDOWN_NAME,True)     then       Exit;   (* do the actual ewx call *)   Result := ExitWindowsEx(cFlags,0);   (* on nt/w2k, disable the SE_SHUTDOWN privilege *)   if Win32Platform = VER_PLATFORM_WIN32_NT   then     SwitchPrivilege(SE_SHUTDOWN_NAME,False); end; function SysDown(bForce: Boolean = False): Boolean; begin   if Win32Platform = VER_PLATFORM_WIN32_NT   then     (* EWX_POWEROFF seems to work on nt/w2k only *)     Result := ShutdownWindows(sdPowerOff, bForce) or ShutdownWindows(sdShutdown, bForce)   else     (* win9x seems to poweroff without the EWX_POWEROFF flag (it doesn't seem to to work there either) *)     Result := ShutdownWindows(sdShutdown, bForce); end; function SysReboot(bForce: Boolean = False): Boolean; begin   (* simply do reboot *)   Result := ShutdownWindows(sdReboot, bForce) end; end.

offline
  • Đuro Glumac
  • dipl. ing. informatike
  • Pridružio: 08 Feb 2004
  • Poruke: 3640
  • Gde živiš: ApAtIn

SantaCruz hvala na kodu...Odakle downloadujes kodove?

offline
  • Pridružio: 16 Jun 2003
  • Poruke: 240

To sam naso na Google-u.

Vlada

offline
  • Max  Male
  • Super građanin
  • Marko Milic
  • MWEB - Project manager & Front-end developer /Saobracajni inzenjer
  • Pridružio: 02 Nov 2003
  • Poruke: 1363
  • Gde živiš: Beograd - Jagodina

@null
sorry preduhitri me SantaCruz hteo sam nesto slicno da napisem ali ovo je bolje od mog.
A sto se tice igranja , pa svi su me pitali kakav sam to "virus" napravio koji im gasi komp , a to je bio obican program koji gasi komp. doziveo sam to kao igru

offline
  • Đuro Glumac
  • dipl. ing. informatike
  • Pridružio: 08 Feb 2004
  • Poruke: 3640
  • Gde živiš: ApAtIn

Ovo moje cudo ce da gasi u odredjeno vreme koje korisnik odredjuje Smile

Ko je trenutno na forumu
 

Ukupno su 529 korisnika na forumu :: 37 registrovanih, 7 sakrivenih i 485 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 1798 - dana 19 Sep 2019 18:42

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: 4channer, aljosa7, Bane san, Bloody, Boris902, cetka, chester_perry, d.arsenal321, darkangel, Deksona, Detective, doktor1964, FOX2, havoc995, Kruger2, Kubovac, Maschinekalibar, medvedekbobi123, Milos1977, misa1xx, Mixelotti, pera12345, plavii, RADOVAN.S, rikirubio, RJ, ruseskij, skvara, Snorks, stegonosa, suton2, versus2, VJ, Vlada1389, vobo, voja64, Zvrk2