|
-
Mar 19th, 2005, 02:24 AM
#1
Thread Starter
Junior Member
Re: ?How can I get the selected folder's name in open common dialog window?
Thank you Moeur for answering me.
I'll try to explain better. I'm new in API programming and I don't know how subclassing works but from what I've read some think it's risky (?). Also I don't know that the way I've chosen is the best. What I need to do is this: I want the user to be able to browse through the drives, folders and files of the computer and choose the folders(even drives) and the files that he needs so I can add them (with their complete path) in a list. I thought that the common dialog box is easy to use for the user and he is familiar with it. The problem is that I use VBA from Access 2000 and the common dialog control doesn't exists here... So for short my problem is that when the the user clicks on a folder(not double-clicks ) I cannot retrieve the name of the folder(s) that the user choosed. I can only get the folder's parent path(through CDM_GETFOLDERPATH). For files things work just fine. I renamed the open button and when the user selects files and clicks it I can add them to my list with their ful path. I want to be able to do the same thing with folders.
Thank you again and hope you can give me a hand on this problem
-
Mar 19th, 2005, 10:34 AM
#2
Re: ?How can I get the selected folder's name in open common dialog window?
The problem is that I use VBA from Access 2000 and the common dialog control doesn't exists here...
I think it does.
So, if you are not using the Common Dialog, what are you using?
-
Mar 19th, 2005, 10:53 AM
#3
Thread Starter
Junior Member
Re: ?How can I get the selected folder's name in open common dialog window?
I am not using the common dialog control (the one I understood exists in VB like a text box control or a command button control) and if it does exist do you know how to find it, because I've searched for it and I didn't found any useful control. Also it doesn't exist the drivelist or the folderlist control in VBA so I use the GetOpenFileNameA function from comdlg32.dll and a hook procedure to catch the messages send by the open dialog box...
I repeat what I need is to get the name of the selected folder. I can tell that the selection has changed through the notification CDN_SELCHANGE but I'm not able to get the name of the selected folder.
Do you have any ideea how to solve this or should I use something else?
Thanks and hope you'll write to me soon...
-
Mar 19th, 2005, 11:08 AM
#4
Re: ?How can I get the selected folder's name in open common dialog window?
Did you look at the thread I recommended above?
I can put a commondialog on my form in VBA. Right-click on the toolbox and check Microsoft commondialog control.
-
Mar 19th, 2005, 01:17 PM
#5
Thread Starter
Junior Member
Re: ?How can I get the selected folder's name in open common dialog window?
First: I can create using api an open dialog box with all required controls(open, cancel, help buttons, a.s.o) I can browse folders as in any explorer window but I'm not able to retrieve the name of the currently selected folder.
Second: I've tried to put a Microsoft Common Dialog Control(VB 6) but get one of the errors: "You don't have the licence to use this ActiveX control" or "The OLE server isn't registered". I've tried to register comdlg32.dll using command line and regsvr32 but I get another error saying that the dll is already in memory. I've tried also to add Microsoft Common Dialog Control to my references, succeded but when I try to add a common dialog control to my list I get the same error.
Thus I have to stick to API and try to figure out a work around for my problem. I want to use common dialog box (and not just an api function browsing for a specific folder) because I want the user to be able to select multiple files and folders the same time and be able to add them(full path and name) to a list in an access form. For files (even multiple selection) works just fine but for the folders I can get the full path and name only by double-clicking them which makes multiple selection impossible. If I just click one or several folders(with CTRL key down) I can get only the path of the folder containing them.
Example: I multiple select the folowing files: a.txt, b.txt and c.txt from C:\MyFolder the open dialog box automaticaly generates a string containing the names of these files in quotes inside the text-box "File name :". I can then read through API this string and also their path.
If i multiple select folders I have no clue where to find the equivalent string containing this time the name of the folders in quotes or something like that.
Thanks again, and hope I'm not to annoying ( or clumsy )
-
Mar 19th, 2005, 01:29 PM
#6
Re: ?How can I get the selected folder's name in open common dialog window?
Sounds like your using the wrong control to get a Folder selection. Shouldnt you be using the
BrowseForFolder dialog if your only trying to give the user a folder selection method?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 19th, 2005, 02:01 PM
#7
Thread Starter
Junior Member
Re: ?How can I get the selected folder's name in open common dialog window?
I want a window with explorer browsing capabilities that allows me to multiple select files and folders and retrieve their names and full path for further use. In browse for folder dialog can you see the content of a folder(both files and folders) and can you select multiple folders in the same time?
All I need is that when the user selects a folder to be able to retrieve it's name without opening it. When the user selects a folder the hook procedure gets the CDN_SELCHANGE notification and I want then to get the name of the folder selected...
Thanks for answering me...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|