?
Solved

CFileDialog returns -1 for thread

Posted on 1997-11-13
7
Medium Priority
?
256 Views
Last Modified: 2013-11-19
I noticed, in a larger application, that after bringing up the CFileDialog box (Open mode) and dismissing it properly (i.e. it returns w/ IDOK) I get the message "The thread 0xFFF8D963 has exited with code -1 (0xFFFFFFFF)." I made a test program that just puts up the CFileDialog and nothing else and it has the same problem. Right after selecting a file and clicking OK the above message is printed in the debug frame. What I would like to do is get rid of this error. I think it's throwing off another element of my program.

I'm running MFC C++ DevStudio 5.0 on Windows 95.

Thanks
0
Comment
Question by:winkle
[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
  • 2
7 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1309916
This is not an error. When you debug a program and the debugger detects that a thread has terminated, it will output this message with the thread exit code. The file open dialog box creates another thread which will be terminated once you close the dialog box.
0
 

Author Comment

by:winkle
ID: 1309917
I didn't intend to imply that I considered the entire thread exit message an error. I understand that the thread messages are information and not an error. It's the -1 return as opposed to the 0 return that I'm asking about. In otherwords, why does the closing of a file dialog generate "The thread 0xFFF8D963 has exited with code -1..." instead of "The thread 0xFFF8D963 has exited with code 0...", for example. Is there a way to reset this? I've double checked my constructor call for the CFileDialog  and in my test case that's the only thing I'm doing. Here's the code:

  CFileDialog aDlg (TRUE, "htm", "*.htm",
                    OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN,
                 "HTML Files (*.htm)|*.htm|All Files *.*)|*.*||",
                    this);

0
 
LVL 23

Expert Comment

by:chensu
ID: 1309918
Sorry, I misunderstood your question. I tried the above code and didn't get the message with Visual C++ 5.0 on Windows 95. Is there anything wrong with your system? Try other system.
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 5

Accepted Solution

by:
dirtdart earned 200 total points
ID: 1309919
The way it's supposed to work:  If you click the OK button in the CFileDialog Box, your thread should exit with code -1.  This indicates that a TRUE condition exists, and the code should continue.  If you click the cancel button, it should exit with code 0, thus representing a FALSE condition to show that the user pressed cancel.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1309920
dirtdart:
This sounds correct. But, how come I didn't get the message? Have you tried it?
0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1309921
I haven't tried that specific code, but I've written several programs using the same kind of code, and gotten the same results from it.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1309922
I have never gotten the message using not only that specific code  but also the other code I wrote before. It is strange.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

649 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