Solved

CFileDialog returns -1 for thread

Posted on 1997-11-13
7
198 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Accepted Solution

by:
dirtdart earned 100 total points
Comment Utility
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
Comment Utility
dirtdart:
This sounds correct. But, how come I didn't get the message? Have you tried it?
0
 
LVL 5

Expert Comment

by:dirtdart
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 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

13 Experts available now in Live!

Get 1:1 Help Now