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

Show Windows Explorer in a form 2

Status
Not open for further replies.

Rutsagig

IS-IT--Management
Jun 24, 2019
9
0
0
ES
Regards.

I want to show in a form a folder content as if it were the windows explorer.
I could do it with the OLE Microsoft Web Browser control and this code in the form init:

Code:
lcFolderName = 'C:\tmp'
THIS.Olecontrol1.Navigate(lcFolderName)

This works like a charm: I can delete and rename files and even add them with drag and drop from Windows.
The only problem is it shows files as large icons and I want to show the details list view.
How can I do this?

Thanks in advance.
 
Hi Rutsagig,

You can send the control keys SHIFT+CTRL+1 to SHIFT+CTRL+8

Put a command button on the form and the following code into the click event:

Code:
LOCAL WshShell

WITH THISFORM.OleControl1
	.SetFocus
	
	WshShell = CREATEOBJECT( "Wscript.Shell" )
	
	WshShell.SendKeys( "+^6" )
ENDWITH

"+^6" means SHIFT+CTRL+6

"+" means SHIFT
"^" means CTRL
"%" means ALT

take a look at the complete description of SendKeys:
Regards, Stefan
 
Yes, it was Web Browser instead of windows browser, I fixed it.
Thanks StefanFoerner, your code works like a charm. Only that in my case the shortcut is Ctrl + Alt instead of Shift + Control
With Control + + I can autoadjust the columns
Thanks again
 
Hi Rutsagig,

I am using a German Windows 10

maybe the control keys differ between German and English version . . .

CTRL++ works for me too (thank You) !!!

Regards, Stefan
 
an addendum:

You can also press the CTRL-key and rotate the mouse wheel up and down to switch through the possible views !!!

Regards, Stefan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top