Solved

Choose Directory ComboBox

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RSS Feeds--IE 13 186
Removing Flash from Website 6 69
Select distinct 25 116
Cordova Camera plugin fails 2 143
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…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

820 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