Arsip: Shut Down Komputer

more 18 years ago
Grandong
Saya mo numpang tanya, gimana syntaks untuk shut down komputer dengan delphi? Gimana juga syntaks untuk bikin alarm? thanks.

more 18 years ago
J4ckR1pp3r
coba cari disini om :wink:
http://pascal-id.org/dpr/Downloads-index-req-viewdownloaddetails-lid-138.pas

more 18 years ago
Starboard
kalo ini? :twisted:
aku ambilin dari punya nya mas torry :D
// Client Program:
// Send 'power' to Client to shutdown the machine.
// Send 'reset' to Client to reset the machine.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ScktComp;
type
TForm1 = class(TForm)
Clientsocket1: TClientSocket;
StatusBar1: TStatusBar;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Button3: TButton;
CheckBox1: TCheckBox;
Checkbox2: TCheckBox;
procedure Button1Click(Sender : TObject);
procedure Button2Click(Sender : TObject);
procedure Clientsocket1Error(Sender : TObject; Socket : TCustomWinSocket;
ErrorEvent : TErrorEvent; var ErrorCode : integer);
procedure Clientsocket1Disconnect(Sender : TObject;
Socket : TCustomWinSocket);
procedure Clientsocket1Connect(Sender : TObject;
Socket : TCustomWinSocket);
procedure Button3Click(Sender : TObject);
procedure FormClose(Sender : TObject; var Action : TCloseAction);
procedure FormDestroy(Sender : TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1 : TForm1;
implementation
{$R .dfm}
procedure TForm1.Button1Click(Sender : TObject);
begin
Clientsocket1.Active := True;
end;
procedure TForm1.Button2Click(Sender : TObject);
begin
Clientsocket1.Active := False;
end;
procedure TForm1.Clientsocket1Error(Sender : TObject;
Socket : TCustomWinSocket; ErrorEvent : TErrorEvent;
var ErrorCode : integer);
begin
errorcode := 0;
StatusBar1.SimpleText := 'Error';
end;
procedure TForm1.Clientsocket1Disconnect(Sender : TObject;
Socket : TCustomWinSocket);
begin
StatusBar1.SimpleText := 'Disconnect';
end;
procedure TForm1.Clientsocket1Connect(Sender : TObject;
Socket : TCustomWinSocket);
begin
StatusBar1.SimpleText := Clientsocket1.Address;
end;
procedure TForm1.Button3Click(Sender : TObject);
var
ukaz : string;
orders : string;
Text : string;
box : string;
begin
ukaz := edit1.Text;
Clientsocket1.Socket.SendText(ukaz);
if checkbox1.Checked = True then
begin
orders := 'power';
Clientsocket1.Socket.SendText(orders);
end;
if Checkbox2.Checked = True then
begin
Text := 'reset';
Clientsocket1.Socket.SendText(Text);
end;
end;
procedure TForm1.FormClose(Sender : TObject; var Action : TCloseAction);
begin
Clientsocket1.Active := False;
end;
procedure TForm1.FormDestroy(Sender : TObject);
begin
Clientsocket1.Active := False;
end;
end.
// Client Program
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, StdCtrls, ShellApi;
type
TForm1 = class(TForm)
Label1: TLabel;
Serversocket1: TServerSocket;
procedure FormClose(Sender : TObject; var Action : TCloseAction);
procedure FormDestroy(Sender : TObject);
procedure FormCreate(Sender : TObject);
procedure Serversocket1ClientError(Sender : TObject;
Socket : TCustomWinSocket; ErrorEvent : TErrorEvent;
var ErrorCode : integer);
procedure Serversocket1ClientRead(Sender : TObject;
Socket : TCustomWinSocket);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1 : TForm1;
implementation
{$R .dfm}
procedure TForm1.FormClose(Sender : TObject; var Action : TCloseAction);
begin
Serversocket1.Active := False;
end;
procedure TForm1.FormDestroy(Sender : TObject);
begin
Serversocket1.Active := False;
end;
procedure TForm1.FormCreate(Sender : TObject);
begin
Serversocket1.Active := True;
end;
procedure TForm1.Serversocket1ClientError(Sender : TObject;
Socket : TCustomWinSocket; ErrorEvent : TErrorEvent;
var ErrorCode : integer);
begin
errorcode := 0;
end;
procedure TForm1.Serversocket1ClientRead(Sender : TObject;
Socket : TCustomWinSocket);
var
ukaz : string;
orders : string;
Text : string;
box : string;
begin
ukaz := socket.ReceiveText;
label1.Caption := 'reciving...';
ShellExecute(Handle, 'open', PChar(ukaz), PChar(''), nil, sw_show);
Text := socket.ReceiveText;
orders := socket.ReceiveText;
if orders = 'power' then
begin
ShellExecute(Handle, 'open', PChar('shutdown.exe'), PChar('-s'), nil, sw_show);
Application.MessageBox('You will be turned off', 'Warning', mb_iconexclamation);
Serversocket1.Active := False;
Form1.Close;
end;
if Text = 'reset' then
begin
ShellExecute(Handle, 'open', PChar('shutdown.exe'), PChar('-r'), nil, sw_show);
Application.MessageBox('You will be reset', 'Warning', mb_iconexclamation);
Serversocket1.Active := False;
Form1.Close;
end;
end;
end.
more ...
- Pages:
- 1
reply |
Report Obsolete
AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now:
https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- ngambil image otomatis dari camera digital
by dinox in Multimedia & Graphic Enhancement more 17 years ago - memo...
by p2bf in Tip n Trik Pemrograman more 18 years ago - Ada yang tau komponentnya?
by p2bf in Tip n Trik Pemrograman more 17 years ago - combo box tidak bisa melebar
by flamade in Hal umum tentang Pascal Indonesia more 17 years ago - if then else pada query
by sepakterjang in Tip n Trik Pemrograman more 15 years ago - delphi-id lagi sakit
by ganang in Kritik & Saran more 17 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Find Nearest di mySQL ???
by BorlandMania in MySQL more 17 years ago - Soal Sql Server 2005
by juan81 in Hal umum tentang Pascal Indonesia more 17 years ago - Cara buat file log
by em052007 in Tip n Trik Pemrograman more 17 years ago