Solved

CFileDialog returns -1 for thread

Posted on 1997-11-13
7
228 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Accepted Solution

by:
dirtdart earned 100 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

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

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

791 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