Avatar of prasiddutta
prasiddutta
Flag for India asked on

Error message in Windows Vista

Respected Expert,
I download a Borland Delphi source code from planet source. In XP it's run very fine. No problem.
But in Vista it give error. Plz give me a solution...
I attach project file.
Link: http://www.slingfile.com/file/WTVrZezWUF
Delphi

Avatar of undefined
Last Comment
prasiddutta

8/22/2022 - Mon
Geert G

what error, what line of code gives the error ?

you will need to be a lot more specific

Geert G

this is the second similar question you opened
after trying to delete the old one

why ?
prasiddutta

ASKER
Error appear when I compile!
I take two screenshot

error-1.jpg
error-2.jpg
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
prasiddutta

ASKER
Geert_Gruwez: Yes u r right! But there have few error to understand experts. Thus I re-post with proper description.
Geert G

Error appear when I compile!
this is an error while you run the application, not in compile time

Hit ok, hit F7, and look where the app stops, then post that surrounding code.
if the cpu window is open close that and use the run menu to show execution point
Geert G

indeed,
help is only possible with a good description of the problem

it's like going to a garage and asking the mechanic "please fix my car"
without explaining the problem
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
prasiddutta

ASKER
Sir, It's better if you handle in your hand. After clicking Ok I press F7. Cursor going to "BarLabel16.Left:=114;"

Geert G

wow,
bad code man

it is unclear to me as why you don't get a lot of errors in this app
you are using global variables objects in different pieces of code

just the passform has this in the interface declaration:
var
  DelphiReg: TRegistry;
  Password, TrayIcon, Language: string;

this should be removed and changed
see follow up snippet



var
  PassForm: TPassForm;
  DelphiReg: TRegistry;
  Password, TrayIcon, Language: string;
 
implementation
 
uses MainUnit;
 
{$R *.dfm}
 
procedure TPassForm.CancelButtonClick(Sender: TObject);
begin
  Application.Terminate;
end;
 
procedure TPassForm.FormShow(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  if DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False) then
   begin
    if DelphiReg.ValueExists('P') then Password := DelphiReg.ReadString('P');
    if DelphiReg.ValueExists('T') then TrayIcon := '1' else TrayIcon := '0';
    if DelphiReg.ValueExists('L') then Language := DelphiReg.ReadString('L') else Language := 'E';
   end;
  DelphiReg.Destroy;
  if Language = 'E' then
   begin
    PassForm.Caption := 'Password';
    PassLabel.Caption := 'Enter password:';
    OKButton.Caption := 'OK';
    CancelButton.Caption := 'Cancel';
   end;
  if Language = 'MC' then
   begin
    PassForm.Caption := 'Øèôðà';
    PassLabel.Caption := 'Âíåñåòå øèôðà:';
    OKButton.Caption := 'Äîáðî';
    CancelButton.Caption := 'Îòêàæè';
   end;
  if Language = 'ML' then
   begin
    PassForm.Caption := 'Sifra';
    PassLabel.Caption := 'Vnesete sifra:';
    OKButton.Caption := 'Dobro';
    CancelButton.Caption := 'Otkazi';
   end;
end;
 
procedure TPassForm.OKButtonClick(Sender: TObject);
begin
  if PassEdit.Text = Password then
   begin
    Password := '';
    if TrayIcon = '0' then PassTimer.Enabled := True;
    if TrayIcon = '1' then PassTimer2.Enabled := True;
   end
  else
   begin
    if Language = 'E' then MessageDlg('Wrong password!', mtWarning, [mbOK], IDOK);
    if Language = 'MC' then MessageDlg('Ïîãðåøíà øèôðà!', mtWarning, [mbOK], IDOK);
    if Language = 'ML' then MessageDlg('Pogresna sifra!', mtWarning, [mbOK], IDOK);
   end;
   PassEdit.Clear;
   PassEdit.SetFocus;
end;
 
procedure TPassForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if Password = '' then MainForm.Show else Application.Terminate;
end;
 
procedure TPassForm.PassEditKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then OKButton.Click;
end;
 
procedure TPassForm.PassTimerTimer(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
  PassForm.Hide;
  MainForm.Show;
  PassTimer.Enabled := False;
  DelphiReg.Destroy;
end;
 
procedure TPassForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var Spot: TPoint;
begin
  {If you forget password just click there - Form top left corner (1, 1)}
  Spot.X := 1;
  Spot.Y := 1;
  if (X = Spot.X) and (Y = Spot.Y) then
   begin
    DelphiReg := TRegistry.Create;
    DelphiReg.RootKey := HKEY_CLASSES_ROOT;
    DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
    PassEdit.Text := DelphiReg.ReadString('P');
    DelphiReg.Destroy;
   end;
end;
 
procedure TPassForm.PassTimer2Timer(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
  PassTimer2.Enabled := False;
  DelphiReg.DeleteValue('T');
  MainForm.ApplyButton.Click;
  PassForm.Hide;
  DelphiReg.Destroy;
end;
 
end.

Open in new window

ASKER CERTIFIED SOLUTION
Geert G

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
prasiddutta

ASKER
I remove paasform, language unit from project. Still same problem. Need actual help please.
var
  PassForm: TPassForm;
  DelphiReg: TRegistry;
  Password, TrayIcon, Language: string;
 
implementation
 
uses MainUnit;
 
{$R *.dfm}
 
procedure TPassForm.CancelButtonClick(Sender: TObject);
begin
  Application.Terminate;
end;
 
procedure TPassForm.FormShow(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  if DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False) then
   begin
    if DelphiReg.ValueExists('P') then Password := DelphiReg.ReadString('P');
    if DelphiReg.ValueExists('T') then TrayIcon := '1' else TrayIcon := '0';
    if DelphiReg.ValueExists('L') then Language := DelphiReg.ReadString('L') else Language := 'E';
   end;
  DelphiReg.Destroy;
  if Language = 'E' then
   begin
    PassForm.Caption := 'Password';
    PassLabel.Caption := 'Enter password:';
    OKButton.Caption := 'OK';
    CancelButton.Caption := 'Cancel';
   end;
  if Language = 'MC' then
   begin
    PassForm.Caption := 'Øèôðà';
    PassLabel.Caption := 'Âíåñåòå øèôðà:';
    OKButton.Caption := 'Äîáðî';
    CancelButton.Caption := 'Îòêàæè';
   end;
  if Language = 'ML' then
   begin
    PassForm.Caption := 'Sifra';
    PassLabel.Caption := 'Vnesete sifra:';
    OKButton.Caption := 'Dobro';
    CancelButton.Caption := 'Otkazi';
   end;
end;
 
procedure TPassForm.OKButtonClick(Sender: TObject);
begin
  if PassEdit.Text = Password then
   begin
    Password := '';
    if TrayIcon = '0' then PassTimer.Enabled := True;
    if TrayIcon = '1' then PassTimer2.Enabled := True;
   end
  else
   begin
    if Language = 'E' then MessageDlg('Wrong password!', mtWarning, [mbOK], IDOK);
    if Language = 'MC' then MessageDlg('Ïîãðåøíà øèôðà!', mtWarning, [mbOK], IDOK);
    if Language = 'ML' then MessageDlg('Pogresna sifra!', mtWarning, [mbOK], IDOK);
   end;
   PassEdit.Clear;
   PassEdit.SetFocus;
end;
 
procedure TPassForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if Password = '' then MainForm.Show else Application.Terminate;
end;
 
procedure TPassForm.PassEditKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then OKButton.Click;
end;
 
procedure TPassForm.PassTimerTimer(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
  PassForm.Hide;
  MainForm.Show;
  PassTimer.Enabled := False;
  DelphiReg.Destroy;
end;
 
procedure TPassForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var Spot: TPoint;
begin
  {If you forget password just click there - Form top left corner (1, 1)}
  Spot.X := 1;
  Spot.Y := 1;
  if (X = Spot.X) and (Y = Spot.Y) then
   begin
    DelphiReg := TRegistry.Create;
    DelphiReg.RootKey := HKEY_CLASSES_ROOT;
    DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
    PassEdit.Text := DelphiReg.ReadString('P');
    DelphiReg.Destroy;
   end;
end;
 
procedure TPassForm.PassTimer2Timer(Sender: TObject);
begin
  DelphiReg := TRegistry.Create;
  DelphiReg.RootKey := HKEY_CLASSES_ROOT;
  DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False);
  PassTimer2.Enabled := False;
  DelphiReg.DeleteValue('T');
  MainForm.ApplyButton.Click;
  PassForm.Hide;
  DelphiReg.Destroy;
end;
 
end.

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Geert G

you should follow all the recommendations in all the pieces of code

otherwise you have a possibility of 400% of getting an error

and this is the worst one ...

var
  DelphiReg: TRegistry;
 
Geert G

this would be more in the direction of what i suggest :

the rest is up to you
type
  TPassForm = class(TForm)
    // removed
  
  private
    fLanguage: string;
    fPassword: string;
    fTrayIcon: string;
  protected
  
  public
    protected Language: string read fLanguage;
  end;
  
 
var
  PassForm: TPassForm;
 
implementation
 
{$R *.dfm}
 
procedure TPassForm.CancelButtonClick(Sender: TObject);
begin
  Application.Terminate;
end;
 
procedure TPassForm.FormShow(Sender: TObject);
var DelphiReg: TRegistry;
begin
  DelphiReg := TRegistry.Create;
  try
    DelphiReg.RootKey := HKEY_CLASSES_ROOT;
    if DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False) then
    begin
      if DelphiReg.ValueExists('P') then fPassword := DelphiReg.ReadString('P');
      if DelphiReg.ValueExists('T') then fTrayIcon := '1' else fTrayIcon := '0';
      if DelphiReg.ValueExists('L') then fLanguage := DelphiReg.ReadString('L') else fLanguage := 'E';
    end else ShowMessage('No Wordpad !');
  finally
    DelphiReg.Free;
  end;
  if fLanguage = 'E' then
  begin
    Caption := 'Password';
    PassLabel.Caption := 'Enter password:';
    OKButton.Caption := 'OK';
    CancelButton.Caption := 'Cancel';
  end;
  if fLanguage = 'MC' then
  begin
    Caption := 'Øèôðà';
    PassLabel.Caption := 'Âíåñåòå øèôðà:';
    OKButton.Caption := 'Äîáðî';
    CancelButton.Caption := 'Îòêàæè';
  end;
  if fLanguage = 'ML' then
  begin
    Caption := 'Sifra';
    PassLabel.Caption := 'Vnesete sifra:';
    OKButton.Caption := 'Dobro';
    CancelButton.Caption := 'Otkazi';
  end;
end;
 
procedure TPassForm.OKButtonClick(Sender: TObject);
begin
  if PassEdit.Text = fPassword then
  begin
    fPassword := '';
    if fTrayIcon = '0' then PassTimer.Enabled := True;
    if fTrayIcon = '1' then PassTimer2.Enabled := True;
  end
    else
  begin
    if fLanguage = 'E' then MessageDlg('Wrong password!', mtWarning, [mbOK], IDOK);
    if fLanguage = 'MC' then MessageDlg('Ïîãðåøíà øèôðà!', mtWarning, [mbOK], IDOK);
    if fLanguage = 'ML' then MessageDlg('Pogresna sifra!', mtWarning, [mbOK], IDOK);
  end;
  PassEdit.Clear;
  PassEdit.SetFocus;
end;
 
procedure TPassForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if fPassword <> '' then 
    Application.Terminate
  else 
    Application.MainForm.Show;
end;
 
procedure TPassForm.PassEditKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then OKButton.Click;
end;
 
procedure TPassForm.PassTimerTimer(Sender: TObject);
begin
  PassTimer.Enabled := False; // move this to top otherwise you may get circular calls
  Hide;
  Application.MainForm.Show;
end;
 
procedure TPassForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var 
  Spot: TPoint;
  DelphiReg: TRegistry;
begin
  {If you forget password just click there - Form top left corner (1, 1)}
  Spot.X := 1;
  Spot.Y := 1;
  if (X = Spot.X) and (Y = Spot.Y) then
  begin
    DelphiReg := TRegistry.Create;
    try
      DelphiReg.RootKey := HKEY_CLASSES_ROOT;
      if DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False) then 
        PassEdit.Text := DelphiReg.ReadString('P')
      else 
        ShowMessage('No Wordpad !');
    finally
      DelphiReg.Free;
    end;
  end;
end;
 
procedure TPassForm.PassTimer2Timer(Sender: TObject);
var DelphiReg: TRegistry;
begin
  PassTimer2.Enabled := False;
  DelphiReg := TRegistry.Create;
  try
    DelphiReg.RootKey := HKEY_CLASSES_ROOT;
    if DelphiReg.OpenKey('Wordpad.Document.1\CLSID', False) then 
      DelphiReg.DeleteValue('T');
  finally
    DelphiReg.Free;
  end;
  Hide;
  TButton(Application.MainForm.FindComponent('ApplyButton')).Click;
end;
 
end.

Open in new window

prasiddutta

ASKER
Please think about MainForm. I removed PassForm & Language unit from project.
Just tell me what I do? What need to change?
You can also download from : http://www.slingfile.com/file/WTVrZezWUF
(virus free site)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Geert G

look at the differences using a tool like "beyond compare" from www.scootersoftware.com

read my suggestions and follow them.

if you are new to delphi, read some of these :
http://delphi.veerle-en-geert.be/ebooks.htm
prasiddutta

ASKER
Okay, I'll try.
Can you modify that project (remove pass form and lang)? And upload here. It's the best. Then I easily find out my problem!
Geert G

do you have any experience in programming in delphi ?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
prasiddutta

ASKER
Yes! But problem in English.
prasiddutta

ASKER
Geert_Gruwez: I try what you say but problem persits. Although I'm not an expert in Delphi.
Geert G

this site is not a site where you get a whole workover of your project
i will give advice but not remake your whole project

you downloaded this project from a site, just find a other similar project for vista and download that

or open a project at getacoder.com and pay for the conversion
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
prasiddutta

ASKER
Already I pay here to meet experts!
prasiddutta

ASKER
Thanks for your valuable comment.