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

ShellFolderView Question 2

Status
Not open for further replies.

ShyFoxBack

Programmer
Joined
Feb 24, 2004
Messages
18
Location
RO
Hy,
I have a ocx that shows me a TreeView with all folders. The root is Desktop. But it doesn't show me the files. Can you help me by pointing to a place where I can find such a class that looks like Explorer Shell (a MyComputer kind of view, this way I could enter in every disk (removable or fixed) in a visual way) or an ideea of how can I achieve that. It will mean a great help for me.
Thank you.
Regards
 
ShyFoxBack

Not sure I understand your question, but faq184-3106 How can I select multiple files from Windows utilises the Windows Common Dialog which may provide what you are seeking with access to network files and folders as well as local drives.

You could also consider launching an instance of Windows Explorer through the WinAPI call ShellExecute(), which would enable you to determine the start folder as you are able to with the Windows Common Dialog.

Other than that you could roll your own using TreeView and ListView, problem being that you are liable to be reinventing the wheel by pursuing that route.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
HI

The following code is from my collections..
The credit should go to Mike Gagnon as this is his code from these forum threads..

Click on the command button when you run this code and explore.
*****************************************
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT olecontrol1 AS olecontrol WITH ;
Top = 24, ;
Left = 48, ;
Height = 169, ;
Width = 241, ;
Name = "Olecontrol1" ,;
OleClass = "Shell.Explorer.2"
ADD OBJECT command1 AS commandbutton WITH ;
AutoSize = .T., ;
Top = 216, ;
Left = 120, ;
Height = 27, ;
Width = 114, ;
Caption = "Get folder content", ;
Name = "Command1"
PROCEDURE Init
this.olecontrol1.oBJECT.Navigate2("c:\")
ENDPROC
PROCEDURE command1.Click
LOCAL cDir
cDir = GETDIR('','','',2)
thisform.olecontrol1.navigate2(cDir)
ENDPROC
ENDDEFINE

** - Mike Gagnon
**********************************************

:-)

____________________________________________
ramani - (Subramanian.G) :-)
 
ramani (Programmer)
Thank you for posting this for me and to Mike for sharing it. I give you a star for helping me, but I would like to know which dll or ocx he used from the OS because I would like to link to it myself.
Please give me a help on this matter.
Thank you.
Regards
 
but I would like to know which dll or ocx he used from the OS because I would like to link to it myself.


Microsoft WebBrowser Activex.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
mgagnon (Programmer),
Thank you. Now if you'd like to tell me how can I know the name of the selection would be very nice. I want when I click on a folder to append it's name in a variable. Ah, and I'd like to know if I can change the navigate path inside my form.
Thank you.
Regards
 
ShyFoxBack

Now if you'd like to tell me how can I know the name of the selection would be very nice

Do you mean how to specify the starting directory? if so, in the init of the form use:
Code:
WITH this
   this.olecontrol1.OBJECT.Navigate2("c:\")
ENDWITH

I want when I click on a folder to append it's name in a variable

this LocationURL property of the Activex will give you the current location. So create a command button and add the following:
Code:
MESSAGEBOX(THISFORM.olecontrol1.locationURL )






Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mgagnon,

> Q: would like to know which dll or ocx he used ...
> A: Microsoft WebBrowser Activex?

Does this mean that the OleClass "Shell.Explorer.2" is part of the web browser control or installed by the web browser control?

Visually I can see that they are related, but I've never understood the programmatic relationship between the two.

Thank you (and great code example!)

Malcolm
 
mgagnon (Programmer)
I'm sorry if you did not understand me. I was to complicate. I wanted to know if ican browse in my form. Because now when I open a folder in this ole object it calls the the explorer window to open it. But I would like to do the browse stuff in my form.
Regards
 
ClassLibrary: _webview.vcx (In VFP gallery folder)
Class: _webbrowser4
 
mgagnon

[blue] this LocationURL property of the Activex will give you the current location. So create a command button and add the following [/blue]
OK, but what's the method that traps the mouse click inside this control window?
Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top