Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Choose Directory ComboBox

Posted on 1998-08-28
5
Medium Priority
?
1,083 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

664 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