Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how make message disappear! 1

Status
Not open for further replies.

courselzplzp

Programmer
Mar 6, 2003
9
CN
when I run <findfirst('A:\',attr,sr)>,the messagebox appear,
that is not expected,how to set windows make it disappear?
 
I just ran the following (Delphi 4) according to the example in the help file and there was no message box. Can you post more of your code?
Code:
var
  SearchRec:TSearchRec;

procedure TForm1.Button1Click(Sender: TObject);
begin
    findfirst('c:\*.*',faAnyFile,SearchRec);
    Edit1.Text := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) + ' bytes in size';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   if (FindNext(SearchRec) = 0) then
        Edit1.Text := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) + ' bytes in size'
  else
    FindClose(SearchRec);
end;
What version of Delphi are you using?
 
the code just like yours,but search dir is 'a:\',so messagebox appear,I suppose there API function to set windows sysyem.
 
Changed it to a:\*.* -- same story. No message box. Sorry. Maybe someone else has experienced the same problem.
 
I see
var
ErrorMode :word;
begin
ErrorMode := SetErrorMode(SEM_FailCriticalErrors);

findfirst('A:\',attr,sr);
....
SetErrorMode(ErrorMode );
end;
 
We use the same thing to check for drives. The problem is in NT/XP, where you can't look to see if a file is on the drive without the &quot;no disk&quot; message popping up.

function T_Util.IsDiskInDrive(ASTR_Drive:char):boolean;
var
ErrorMode:word;
begin
ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
try
result := DirectoryExists(ASTR_Drive + ':\');
finally
SetErrorMode(ErrorMode);
end;
end;
Brian
&quot;There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group.&quot; - tag line I stole
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top