Re: "Add New Folder" button in "Folder Browser" for Win 98
Yes, that code runs fine on mine but im using xp. One thing to try is that same code except use folder instead of folder2 because even though its not part of the propertys the Self.Path still works with mine, other than that i cant help unless i had a 98 machine infront of me.
good luck.
casey.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Setting a reference to Shell32.dll and use the COM objects instead of using the API functions directly that are available in the same file, doesn't help you with this issue simply because there is so many versions of this file. There is nothing available in the COM objects that aren't available in the API functions (the COM objects simply call these functions internally anyway).
The advantage you get from setting a reference is that you don't need all the declarations and conversions you'll need to call API functions so it requires less code and it looks more VB-like since we use COM objects all the time. The disadvantage is that you bind yourself to a particular version of the Shell32.dll file in a greater extent than with the API functions, since using the functions the declarations look the same between different versions, they just add new flags. You can always check what Windows version your code is running on an use or discard some of the flags depending on that. This approach is not available for you when you've set a reference to the library.
I'm not telling Casey or anyone else not to use the reference approach, I'm just saying that you must be aware of the limitations.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by vbasicgirl
Maybe its a 98 thing...
casey.
Must be something else, it works for me in a W98 computer.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by Joacim Andersson
The disadvantage is that you bind yourself to a particular version of the Shell32.dll file...
This is a good point I wasn't aware of.
What a juicy thread, I'm really learning.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by krtxmrtz
Must be something else, it works for me in a W98 computer.
:eek: even with .Folder2??
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by Harsh Gupta
:eek: even with .Folder2??
I copied and pasted casey's code at post #29.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by krtxmrtz
I copied and pasted casey's code at post #29.
krtxmrtz,
casey's code is displaying a folder browser on my pc too, but when i press OK, it generates an error. but clicking Cancel does not generate any error. is this happening on your pc too?? could you please check it??
thnx
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by Harsh Gupta
krtxmrtz,
casey's code is displaying a folder browser on my pc too, but when i press OK, it generates an error. but clicking Cancel does not generate any error. is this happening on your pc too?? could you please check it??
thnx
It's exactly as you say, I simply forgot to click on the OK button the first (and only) time I tried out the code. :blush:
I'm sorry I may have been misleading you.
Re: "Add New Folder" button in "Folder Browser" for Win 98
all right, keeping aside all things discussed in this thread (except for the subject), is it possible to use an API along with a control on a form?
i am trying to put 1 TreeView control on a form and when that form is loaded, use SHBrowseforFolder API, but instead of opening its dialog box, call it to load its content in the control (TreeView in this case)??
thank you
Re: "Add New Folder" button in "Folder Browser" for Win 98
So, you want to use the dialog to select a folder, and once selected, that folder and all of its sub folders should be loaded into a treeview. Is that correct?
Did you get the Treeview control to work on your system?
Re: "Add New Folder" button in "Folder Browser" for Win 98
No, instead of opening a dialog box, open another form having TV, and use API to list all folders in that TV which the BrowseforFolder API will list in its dialog box.
but i think i am wrong. do you know how the Extract dialog box of Winzip works? it also uses a TV control but uses a seperate form for it.
hope i am clear this time.
1 Attachment(s)
Re: "Add New Folder" button in "Folder Browser" for Win 98
Well, I don't know about getting it to populate your TreeView control. But what you can do is to show the BrowseForFolder dialog and "steal" the folder view window it uses and simply hide the rest. This would envolve using SetParent when you have the hWnd of the treeview... Hmmm... Instead of explaining it all, I wrapped it up in a UserControl for you... This one if far from perfect, since it can only return the Path of file system folders, and if the user selects a shell folder like the control panel or something an empty string is returned by the Path property... But at least you have something to work with (or maybe just learn from).
The thing with this control is that you have to call the Create method in the Form_Activate event, and you should also call the Destroy method in the Form_Unload or QueryUnload event. The Create method takes an optional path string as argument if you want a particular folder to be selected from the start. It's all shown in the very basic demo project attached. Just open the Group1.vbg file to try it out.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by Joacim Andersson
... This one if far from perfect...
:eek2:
No, in fact thats more than perfect!!!
: praying God : "please help me in getting the coding sense and style like him"
i thought of making one such control (not user-control) where the user is allowed to add folder to a present TV (for Win 98) thats why i popped this question about getting or stealing the control from an API's dialog box to my form.
One request, can i use your technique for my project?? i will list and refer your name (and all those who helped me in this) in the project.
and yes, indeed it a ver good tutorial for every newbie and those who want to get started with UC programming.
Thank you.
Re: "Add New Folder" button in "Folder Browser" for Win 98
Quote:
Originally Posted by Harsh Gupta
One request, can i use your technique for my project?? i will list and refer your name (and all those who helped me in this) in the project.
Everything I post in this forum is free for you or anyone else to use in anyway they like.