Solved

Choose Directory ComboBox

Posted on 1998-08-28
5
1,065 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 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
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 …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now