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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listing of a directory

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
Hi,

i am looking for some kinda object/class/component that
shows me all files matching a certain criteria in a directory...

and then the same way as windows explorer does.
so with the nice word/excell icons...

i basic need a nice windows explorer component..
anyone know where to get those?

thanks
 
HI

In your command window type..
DO FORM (HOME(1) + 'Tools\Filer\Filer.scx')

You can explore it..
MODI FORM (HOME(1) + 'Tools\Filer\Filer.scx')

:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Thanks for your answer, but this doesnt give me
the windows explorer window . with the images of the files...

this just gives me a directory listin....

i like the windows explorer environment. also
when i double click a file it should open up in word or excell or what ever appropriate programme i linked with that extension.
 
You need to use the Common Dialog control. Go to Tools->Options and select the 'Controls' tab. Go to 'Microsoft Common Dialog Control' and select it by clicking the checkbox. Click on 'Set as Default', then 'Ok'.
Now on your form, add an instance of that control by bringing up the Form Control dialog. Select the 'ActiveX Controls' by clicking on the 'View Classes' icon (it looks like a set of books near the top). Now drag and drop the 'Microsoft Common Dialog Control' on to your form. Name it something like "oleCommDlg".

From there, you can add a button that when clicked will open the control:

Code:
THISFORM.oleCommDlg.ShowOpen
THISFORM.Label1.CAPTION = THISFORM.oleCommDlg.FileName

cFileName=ALLTRIM(THISFORM.oleCommDlg.FileName)
DECLARE INTEGER ShellExecute ;
   IN SHELL32.DLL ;
   INTEGER nWinHandle,;
   STRING cOperation,;
   STRING cFileName,;
   STRING cParameters,;
   STRING cDirectory,;
   INTEGER nShowWindow
nResult = ShellExecute(0,"open",cFileName,"","",1)
IF nResult < 33
   *... Handle the error here
   * 2 = Bad Association (for example, invalid URL)
   * 29 = Failure to load application
   * 30 = Application is busy
   * 31 = No application association
ELSE
   * Values over 32 represent success, and
   * return an instance handle for the running
   * application.
ENDIF
Dave S.
 
This is also not what i am looking for.
this is the way how to open a file using an common dialog box.

i am more looking for a component or class that gives me almost the same functions as the windows explorer.
 
poeijer

The following code, which requires modification to suit your needs, will create an instance of Windows Explorer starting in a folder of your choice.

DECLARE INTEGER ShellExecute ;
[tab]IN SHELL32.dll ;
[tab]INTEGER nWinHandle ,;
[tab]STRING cOperation ,;
[tab]STRING cFileName ,;
[tab]STRING cParameters ,;
[tab]STRING cDirectory ,;
[tab]INTEGER nShowWindow

*!* Retrieve the main VFP window handle (this handle is used by ShellExecute)

DECLARE INTEGER FindWindow IN WIN32API ;
[tab]STRING cNull ,;
[tab]STRING cWinName

IF USER.start_expl
[tab]lcFolder = [Projects]
[tab]lcFolder = ADDBS(THISFORM.cHomeFolder) + lcFolder
[tab]lnResult = ShellExecute(FindWindow(;
[tab][tab]0 ,;
[tab][tab]_SCREEN.caption) ,;
[tab][tab][Explore],;
[tab][tab]lcFolder ,;
[tab][tab][] ,;
[tab][tab][] ,;
[tab][tab]1)
ELSE
[tab]lnResult = ShellExecute(FindWindow(;
[tab][tab]0 ,;
[tab][tab]_SCREEN.caption) ,;
[tab][tab][Explore] ,;
[tab][tab][] ,;
[tab][tab][] ,;
[tab][tab][] ,;
[tab][tab]1)
ENDI

*!* Error messages if the return value is < 32

IF lnResult < 32 && Error messages if the return value is < 32
[tab]API_ERROR(lnResult)
ENDI
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top