Solved

CFileDialog returns -1 for thread

Posted on 1997-11-13
7
207 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 106
sameEnds challenge 3 133
maven archtype selection in eclipse 1 53
FizzBuzz challenge 9 76
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now