Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Choose Directory ComboBox

Posted on 1998-08-28
5
Medium Priority
?
1,086 Views
Last Modified: 2013-12-26
How can I create a Combo Box for directory selection ?
( like what we have in open file dialog boxex )
I need only directory selection & drive selection with
files view BUT NO file selection so I can't use common dialog of Borland C++ !
0
Comment
Question by:horesht
  • 4
5 Comments
 
LVL 2

Expert Comment

by:duneram
ID: 1299759
which owl are you using Owl 1  (bc 3.1) or newer?
0
 
LVL 2

Expert Comment

by:duneram
ID: 1299760
which operating system of windows are you using?  win3.1? NT (3.51, 4.x, 5.x)?  or 98 or 95?
0
 
LVL 2

Expert Comment

by:duneram
ID: 1299761
one of the tricks I have dne in the past is to open the dll containing the borland common control and view it in the resource editor.  Locate the dialog that does the file open in this case.  Then copy the whole dialog over to your project.  Then modify the dialog to how you want it to look, then write the code to support it.


0
 
LVL 2

Accepted Solution

by:
duneram earned 20 total points
ID: 1299762
Using the borrow a dialog method.  If using bc3.1 open the workshop and then do a open on comctl.dll (it should be in your windows or windows system directory).
If using 4.x or higher, open the borland compiler and do a file open.  select libaries (*.dll) and then open comdlg32.dll l (in your windows/system directory)

if you are viewing comdlg32, I believe the dialog you are interested in has the id of 1536
YOu could then copy it and put it in your program.  

But there is a much simpler method to this madness.  If you use the Api  GetOpenFilename

The GetOpenFileName function creates an Open common dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open.

BOOL GetOpenFileName(
  LPOPENFILENAME lpofn   // address of structure with initialization
                         // data
);
 

the structure looks like this:

typedef struct tagOFN { // ofn     DWORD         lStructSize;
    HWND          hwndOwner;     HINSTANCE     hInstance;
    LPCTSTR       lpstrFilter;     LPTSTR        lpstrCustomFilter;
    DWORD         nMaxCustFilter;     DWORD         nFilterIndex;
    LPTSTR        lpstrFile;     DWORD         nMaxFile;
    LPTSTR        lpstrFileTitle;     DWORD         nMaxFileTitle;
    LPCTSTR       lpstrInitialDir;     LPCTSTR       lpstrTitle;
    DWORD         Flags;     WORD          nFileOffset;
    WORD          nFileExtension;     LPCTSTR       lpstrDefExt;
    DWORD         lCustData;     LPOFNHOOKPROC lpfnHook;
    LPCTSTR       lpTemplateName; } OPENFILENAME;

If you modify the 'Flags' you can make things appear and disappear on the dialog box.

If you go with a combination of copying the dialog to your own resource, and then changing the look, then specifying that as a special template in the structure above, you have a custom dialog and windows does most of the work.


0
 

Author Comment

by:horesht
ID: 1299763
I already don't it using : setdisk , getdisk , getcurdir , getcwd & TListBox::DirectoryList

thanks anyway
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question