WinExec Find Files or Folders?

I would like to call Window 98's "Find Files or Folders" window from a D3 program I am writing.  Can this be done via WinExec()?

Just in case it is not clear what "Find Files or Folders" means...click "Start" > "Find" > "Files or Folders".

Can this Win utility be called from a Delphi app?
SofttechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
Is there a function called "Find" or "ShellFind" in Shell32.dll?

Just a guess...

TiM.
0
intheCommented:
this will call it:

add to uses section ShellAPI


procedure TForm1.Button1Click(Sender: TObject);
begin
shellexecute(application.handle,'find','','','',sw_normal);
end;

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AttarSoftwareCommented:
Ahhh...  so simple...
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

craig_capelCommented:
Barry..... have you got a list of these shellexecute commands? so far i have seen them for Email, URL, playing winamp.... see loads, but how do you know what commands go here, you must have a reference.... i will glady post some points for you.... :)

Craig C.
0
intheCommented:
answering questions all day you just pick these things up..
most shell functions are defined in shellapi.pas
shellexecute(0,'open',....
shellexecute(0,'print',...
shellexecute(0,'find',....

best thing is read the win32.hlp file
and that with the internet you have the biggest reference in front of you.
my advice is save every peice of code you come accross in a code database,one day it will come in handy.
0
SofttechAuthor Commented:
Thanks...

Now...would I be pushing my luck if I asked...is there a way to populate the "Find" field automatically? IOW, when the Find dialog appears, the  "Named" field has ".xyz" as the default?
0
intheCommented:
haha i knew that you would ask this and im afraid from the shellexecute its not possible. :-(
but there is a way of doing it and you cant tell its not being called from execute method.you can find the window and write directly to the edits with the name of file to find etc.if you know what i mean.
here is teseted example just a button on a form.
if the find has already been called it will write to that one if not it will call find then write to it.:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,Shellapi;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Procedure FileNamed(FName:string);
var h:hwnd;
begin
h:=FindWindow(nil,'Find: All Files');
setforegroundwindow(h);
h:=getwindow(h,GW_CHILD);
h:=FindWindowex(h,0,'Combobox',nil);
h:=FindWindowex(h,0,'Edit',nil);
if h<>0 then SendMessage(h,WM_SETTEXT,0,Integer(FName))
        else showmessage('Error writing File name!');
end;

Procedure ContainingText(CText : string);
var h:hwnd;
begin
h:=FindWindow(nil,'Find: All Files');
setforegroundwindow(h);
h:=getwindow(h,GW_CHILD);
h:=FindWindowex(h,0,'Edit',nil);
if h<>0 then SendMessage(h,WM_SETTEXT,0,Integer(CText))
        else showmessage('Error writing Containing Text!');
end;

procedure TForm1.Button1Click(Sender: TObject);
var h:hwnd;
begin
h:=FindWindow(nil,'Find: All Files');
if h = 0 then shellexecute(application.handle,'find','','','',sw_normal);
repeat
 h:=FindWindow(nil,'Find: All Files');
 Application.ProcessMessages;
 until h <> 0;
FileNamed('*.Pas');
ContainingText('Procedure');
end;

end.


pushing your luck works sometimes eh :-)
actually i quite like writing stuff like that so i dont mind.

Regards Barry
0
SofttechAuthor Commented:
You deserve some points for this...

....so...

I've posted a followup question for you, which I hope you can answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.