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

how do display files in a directory like in explorer

Status
Not open for further replies.

Gerrit Broekhuis

Programmer
Aug 16, 2004
316
NL
Hi,

Is it possible to show the content of a particular directory like it's shown in the explorer in a custom form? I would like to be able to copy a file and be able to double click on it to open it with the default program.

Regards, Gerrit
 
If opening the main view then you would just have a Form with a Listview ActiveX control on it. But if opening as Explore (where the folders panel is open on the left) then you would have a Treeview control on the left and a listview control on the right. There are numerous examples of iterating through the contents of a directory and even it's subfolders on this forum and in the FAQ section.

As for opening it with the default program you can use the ShellExecute API function, there are examples here as well. After checking out the FAQ section then you can find the rest using the Keyword search this forum provides.

boyd.gif

 
You can probably embed explorer itself somehow if you research hard enough (try looking a the source if you right-click "Start" menu, choose open, click menu "View".."Customize"
"Next"..."Customize/Choose or edit HTML template".."Finish"
Make hidden files visible, then go into the hidden "Folder Settings" folder, open the "Folder.htt" file... look toward the end and you'll find an ActiveX object reference like:
< object id=FileList classid="clsid:1820FED0-473E-11D0-A96C-00C04FD705A2" tabIndex=1 > < /object >
Figure out how to embed 1820FED0-473E-11D0-A96C-00C04FD705A2 in a form... or, just a little worse, a whole Internet Explorer browser with an HTT document with that HTML code in it, and you will have the "real" windows file explorer.

You could use GETFILE, then ShellExecute api to launch it.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Gerrit,

For the right-hand pane, you could use my freeware SimpleList control ( This is essentially a wrapper for the Listview ActiveX control. It lets you display any items, you like in the usual four views (large icon, small icon, list and detail). In detail view, you can have sortable columns, and all the other features of the right Explorer pane.

Similarly, the left-hand pane is a Treeview control.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
pa33avjj

The following alternative utilises the IE object and you would need to set the various object properties to suit your app.
Code:
[COLOR=blue]oExp = CREATEOBJECT([InternetExplorer.Application])
WITH oExp
	.Navigate([C:\myapp\files])
	.MenuBar = .F.
	.ToolBar = .F.
	.StatusBar = .F.
	.Height = 200
	.Left = 10
	.Top = 10
	.Width = 200
	.Visible = .T.
ENDW[/color]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.co.uk
 
Combine Chris's suggestion with my TakeWindow from here:
like this:
Code:
oExp = CREATEOBJECT([InternetExplorer.Application])
WITH oExp
  .Navigate([C:\myapp\files])
  STORE .F. TO .MenuBar, .ToolBar, .StatusBar
  STORE 200 TO .Height,  .Width
  STORE 10  TO .Left,    .Top 
  .Visible = .T.
  do takewindow with .HWND
ENDWITH

And you now have the Explorer window INSIDE your VFP main window!
Code:
* Access the current folder using:
oexp.LocationURL
* Access the item with current focus using:
oDoc = oExp.Document
oDoc.FocusedItem.Name
* Access the all the selected items using:
FOR EACH oItem IN oDoc.SelectedItems
  wait window oItem.Name
ENDFOR

Pretty neat!

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Mike said:
Gerrit, are you talking about Windows Explorer or Internet Explorer?
Internet Explorer will emulate Windows Explorer under certain circumstances and you will find that to be the case if you run the code suggested by myself and Bill.


The principle advantage of these suggestions being that IE is an automation server which in turn opens up all sorts of other opportunities for a developer.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.co.uk
 
As I recall, Windows Explorer is based on Internet Explorer. That is why MS argued that it couldn't just remove IE from the OS.

For example type in the address bar of Windows Explorer and press enter.

Regards,

Mike
 
Mike and Chris,

I take your point about Windows Explorer being based on IE. You can also see this is you use IE to navigate to an FTP site, in which case it turns itself into WE.

I just wondered what interface Pa33avjj had in mind.

In fact, I wonder if Pa33avjj is still around. He/she hasn't responded to any of the suggestions that have been made.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi everyone,

I was very busy trying all suggestions. For my purpose Chris's approach is perfect. I meant the Windows Explorer, but I have no problem with the use of Internet Explorer the way it is.

My ultimate solution would be to use the solution from Chris inside a VFP form, but I don't know it that could be done.

Thanks!

Gerrit
 
My ultimate solution would be to use the solution from Chris inside a VFP form, but I don't know it that could be done.

Use a Web Browser Activex on your form.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top