Solved

Choose Directory ComboBox

Posted on 1998-08-28
5
1,080 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 10 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

630 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