Question

BCB2006 TOpenDialog (and TSaveDialog) problem and missing option

Asked by: sburck

I just got a call from a site where I have an app installed, and a problem was reported to me which I can verify, and cannot find a quick fix.

The problem is using a TOpenDialog (using BCB 2006).  The problem is that drives are not shown - folders, and everything else are shown, but going to "My Computer" gives an empty selection screen.  I couldn't find a flag in Options or OptionsEx which would fix this, either.  I threw a TSaveDialog on the form to test with, it has the same problem.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-07-12 at 07:12:20ID21916602
Tags

topendialog

Topic

C++ Builder

Participating Experts
2
Points
500
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Resizing tOpenDialog
    I am descending a new fileOpen dialog from tOpenDialog. Among other features, it will have combobox at the bottom which will allow the user to decide if the selected file will be open in a tabular window, graphic window, or no window at all. The problem is, there isn't enou...
  2. Similiar Functionality as Filter property of TOpenDialog
    I am trying to set & get some strings from a Dialog box which consists of a StringGrid with 2 columns & 10 rows. I want to store the cell strings in a string variable like in the Filter property of a standard TOpenDialog or TSaveDialog component. I tried to find how ...
  3. TOpenDialog and MultiSelect
    I can get a TOpenDialog to select a directory but I cann ot get it to multiselect several directories. (I have ofAllowMultiSelect = true.) What else do I need to do?
  4. TOpenDialog properties
    Hello, In my application I need to use a TOpendialog object to allow users to remove and create directories. The dialog box works fine, except that I need to restrict the user from going into the parent directory (my thought is to disable the 'up one directory' button, but ...
  5. TSaveDialog and filename
    Hi Delphi Experts. Ok. Here is the question... I want to change the filename in the SaveDialogbox when users choose different.. filter. f.ex. filter as txt, xml, csv etc. and the filename will appears as MyFile.txt, MyFile.xml, etc. I manage to change the filename before ...
  6. Hot to control the size of tOpenDialog and tSaveDialog
    Hi, When I am using tOpenDialog and tSaveDialog in my application then the dialogs have a standard size the first time I use them. After resizing one of them to a new size then they open with that 'user defined size' as long as the application is running. Unfortunately Window...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: gtokasPosted on 2006-07-12 at 07:29:13ID: 17090821

I made an application in BCB2006 and dropped a TOpenDialog and a TButton.
At Button click I called OpenDialog1->Execute() and run it.
After click at the button the dialog displayed with all drives visible when clicked "My Computer"...
Did you installed the updates??
I had installed them...

George Tokas.

 

by: sburckPosted on 2006-07-12 at 07:34:32ID: 17090889

No, I found the solution now at Borland -         

"TOpenDialog doesn't show MyComputer items when CoInitFlags := COINIT_MULTITHREADED"

and, because I require CoInitFlags to be COINIT_MULTITHREADED I will have to replace the dialog boxes with API calls.

 

by: gtokasPosted on 2006-07-13 at 14:13:00ID: 17103718

Agree since I was of no help....
George Tokas.

 

by: sburckPosted on 2006-07-17 at 01:40:56ID: 17120347

First, I will remove my request to close this question - however, I'm going to change it, and increase it's points, because it has now become considerably more difficult.

After a lot of research, I've found the following:  Although the bug is listed on Borland as I reported above, the 'bug' is in Windows.  See http://support.microsoft.com/kb/287087 (INFO: Calling Shell Functions and Interfaces from a Multithreaded Apartment).  This is not a Borland-specific problem, but in general, a lot of the shell interface will fail from a multithreaded apartment.

Now, this problem cannot be fixed by using API calls, because the API calls fail in the identical manner.  I have to, I believe, make a multithreaded application, where the calls to the DLL I'm using which requires me to use COINIT_MULTITHREADED in one thread, and the other thread is COINIT_APARTMENTTHREADED.  This I don't know how to do.  To make my original application multithreaded I had to add the call to CoInitializeEx(NULL, COINIT_MULTITHREADED); before the Application->Initialize() and then the calls to the DLL worked.  However, I don't know where to go about changing the concurrency model for a TThread.

What I'd like to do, actually, is make the main thread the APARTMENTTHREADED one, and create a MULTITHREADED thread where the DLL calls could go, that would mean the least changes to my code, I think.

Another option is if anyone knows of Open/Save Dialog components which don't care about the concurrency model; I could use these without mucking about with making a rather simple application multithreaded in order to view these two dialogs correctly.

 

by: sburckPosted on 2006-07-17 at 01:44:01ID: 17120359

Someone has suggested to me to make two applications, one which gets the filenames (normal app), and then runs the second (MULTITHREADED), which display the filenames gotten.  I'm not thrilled with this, but it's my last resort.

 

by: gtokasPosted on 2006-07-17 at 03:28:44ID: 17120779

The description I'm about to give you assumes that the multithreaded app is running...
Create a new standard app...
Drop a TClientSocket...
At your main application drop a TServerSocket...
Those will be needed for communication the FAST way...
The standard application when starts connecting to the TServerSocket...
The Server sends the data the other app have to find...
The Client sends report...
Precautions:
Because the standard app may called many times from the multithreaded app you have to use a mutex, or simply if you choose TServer/TClient sockets limit the TServer connections by using at OnConnect: if(Socket->ActiveConnections > 1){Socket->Close();}
If something isn't clear on the strategy I'm proposing feel free to ask...

George Tokas.

 

by: sburckPosted on 2006-07-17 at 03:40:25ID: 17120828

I'll look into this - let me just clarify.  For my user interface, I make a standard application with a clientsocket.  The (main) application which uses the DLL will be formless (or at least invisible), and have a ServerSocket.  The two applications communicate via the sockets.

I'll give this a try and let you know.

 

by: gtokasPosted on 2006-07-17 at 04:08:01ID: 17120977

Just create a Dialog application with the client socket...
BEFORE the dialog appears HAS TO connect to the server socket...
If not terminating...
If connection closed terminating...
If error terminating...
Choose the file using the dialog and press ok...
At the button's handler communicate with the server and if all are OK terminate the dialog application...

George Tokas.

 

by: gtokasPosted on 2006-07-17 at 04:10:55ID: 17120992

For saving:
Create a temporary file and send the path and filename to the dialog application...
At the dialog application load the temporary file to a TMemoryStream and save it as you like....
Report to master application for deletion...

George Tokas.

 

by: sburckPosted on 2006-07-17 at 07:19:18ID: 17122207

It seems that in BDS, the tclientsocket and tserversocket have been deprecated, there are the newer, more complicated INDY 10 components.  I'm looking at how to make a simple client/server connection without any underlying protocol (the old "chat" example from BCB6).

 

by: gtokasPosted on 2006-07-18 at 02:59:10ID: 17128845

There are there just not added to the pallete...
Check out the bpl TClient/TServer Sockets are included...
Add the same in BDS....
I am on the move and the machines I have the details are not here yet....

George Tokas.

 

by: sburckPosted on 2006-07-18 at 04:05:46ID: 17129139

After trying to use them (I created them dynamically), they gave strange linker errors.  So, late yesterday I decided to try to use Windows Messaging (PostMessage, with a Message handler on the form of both master and slave to handle a WM_USER message) instead.  I'll keep you updated.

 

by: gtokasPosted on 2006-07-18 at 04:47:51ID: 17129323

dclsockets.pas have the declarations at BDS...
Try to add the bpl...
They will appeared in the pallete..
Maybe you will find difficulties with post message...
And the reason is multithreading...
In this case you have to use a mutex...

George Tokas.

 

by: cwwkiePosted on 2006-07-20 at 13:37:02ID: 17149532

>> First, I will remove my request to close this question - however, I'm going to change it,
>> and increase it's points, because it has now become considerably more difficult.

it would have been better not to withdrawn your request, and ask a new question, because it would get everybody's attention again. I only saw this by coincidence, and I don't think anybody else has subscribed after you have found your solution...

In case you still need help, maybe these links will help you.

http://www.codeguru.com/cpp/com-tech/activex/apts/article.php/c5529/
http://digital.ni.com/public.nsf/allkb/ad46b130ba24bb5c86256b8100689612?OpenDocument

 

by: gtokasPosted on 2006-07-20 at 13:51:27ID: 17149647

From my article at www.bcbjournal.com not yet published but at least I finished moving...

A note about BDS2006. If you noticed TServerSocket and TClientSocket are not present at the Internet “Tab” of components. That does not mean that we can’t use them anymore. The source code and the im-plementation remain there (ScktComp.pas + hpp). So where are they?
 With C++Builder personality open in BDS goto Pro-ject|Options|Packages choose Add and point to BDS\4.0\bin\dclsockets100.bpl. Click ok and now you will see the components at the internet “Tab”.

George Tokas.

 

by: sburckPosted on 2006-07-21 at 05:48:48ID: 17153458

A couple of comments:

I have begun to write the implementation using Windows Messaging and a mutex, but cannot do anything with it until at the customer site.  The problem DLL won't do anything unless it's hooked up to a big camera which I don't have access to - I'll be there on Monday, so until then I cannot test anything.

However, cwwkie, both of your points make sense.  First thing after posting this comment I'll post a pointer to this question, and won't handle a situation like this again.  Secondly, and more "on subject", the articles showed that it is possible to have different threads with different concurrency models.  This would be the ideal solution.  I would make my application a "Single-threaded-apartment", and create a "multi-threaded apartment" in a thread which calls the DLL.   Synchronization would be simple - all I need to do is wait for the thread to run to completion, after it had called the DLL.  However, I had to place my call to CoInitializeEx(COINIT_MULTITHREADED) before the call to Application->Initialize(), because Application->Initialize() automatically calls CoInitializeEx with COINIT_APARTMENTTHREADED.  I don't know what the case for a tthread is - but I'll wager if I dig into it, the thread will be auto-initialized to COINIT_APARTMENTTHREADED.  If not, or if I can place a call to CoInitializeEx in my constructor which will get called before the class itself calls it, then this may be the way to go.  I'll post this and hope for a definitive answer before Monday, when I will go in and solve the problem any way I can, but as cleanly as possible.

 

by: cwwkiePosted on 2006-07-21 at 06:13:55ID: 17153659

>> I don't know what the case for a tthread is

You don't need to know. Take a look at the code in the second link. You only need to make some small changes, and can use it. It simply calls CreateThread to create a thread. The thread function only needs to contain CoInitializeEx, your own function call and CoUninitialize. Call the Wrapper function to use it.

 

by: sburckPosted on 2006-07-24 at 07:37:16ID: 17168100

cwwkie - I'm here and working on it - it works to a point.  My problem is callbacks.  The DLL has callback functions, which currently are my functions which update the UI.  This doesn't work - can't update the VCL from other threads.  if I was using TThread, I could call synchronize, but I'm not.  I'm trying to do modifications of the code which instead of calling

WaitForSingleObject (threadHndl, INFINITE)

I'm trying to do:

        while (WaitForSingleObject(threadHndl, 100) == WAIT_TIMEOUT)
        {
             ..update UI via globals set by the callback.
        }

This isn't working.

Any help would be appreciated.

 

by: cwwkiePosted on 2006-07-24 at 11:44:14ID: 17170558

You can take a look what syncronise is doing (source\vcl\classes.pas)

Basicly it does
  SendMessage(ThreadWindow, CM_EXECPROC, 0, LongInt(Self));

In the window procedure, the LParam is typecasted back to a TThread pointer (Self=this) and the function is called.
You cannot use This if you do not use a TThread, but you can create something simular, or create a dummy TThread, just to call Synchronize.

As a simple alternative, you can also use a global variable, and poll it using a ttimer. Be sure to guard the access of the global variable using a mutex or critical section.

 

by: sburckPosted on 2006-07-24 at 12:02:07ID: 17170691

Due to time constraints, I just finished doing it the dirty way - I used two applications - one invisible and COINIT_MULTITASKING, and the other with the UI and not - and communicated between them using PostMessage between the two forms.  It's not a very clean solution but it works.  I think the way to have gone had there been time is  the way I started today - so I'm giving the points to cwwkie, (gtokas's suggestion had merit, as well, but, it, too, was a two-application solution).  The second article cwwkie gave the pointer to 90% of it, and given time, I would have solved the problem of the callbacks (possibly as you suggested).

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...