|
Hai,
it just Receives file names from other functions.
|
|
|
|
|
|
(VC++ Debug Library)
status.m_OUT.AddString(e->filename);
|
|
|
|
|
Check this:
status.GetSafeHwnd() ==NULL?
m_OUT is ==NULL?
m_OUT->GetSafeHwnd() ==NULL?
e->filename is CString? Empty?
|
|
|
|
|
hi,
how to check the values for status.GetSafeHwnd() ??
//m_OUT is ==NULL?
m_OUT will be empty when the dialog loads.
//e->filename is CString? Empty?
e value will alwys have a value its of CString type "C:\Dir\filename1"
|
|
|
|
|
You have to write code like this (according to your variable definitions)
and find out what is the object with the real problem.
CStatusDlg status;<br />
status.Create(IDD_INDEX_STATUS_DIALOG);<br />
<br />
ASSERT(status.GetSafeHwnd() != NULL);<br />
ASSERT(status.m_OUT.GetSafeHwnd() != NULL);<br />
ASSERT(e != NULL);<br />
ASSERT(e->filename != "");<br />
...<br />
<br />
status.m_OUT.AddString(e->filename);
You must add every test that could be a problem during execution, and, remember, use DEBUG mode, not RELEASE.
If there is a bug the program will stops at the line that point the problem.
|
|
|
|
|
Hi,
i have used f10 and check the exact line where the error generates
status.Create(IDD_INDEX_STATUS_DIALOG);
305: status.Create(IDD_INDEX_STATUS_DIALOG);
0040A83B push 0
0040A83D push 84h
0040A842 lea ecx,[status]
0040A848 call CDialog::Create (00409e36)
what will be cause ??
------------------------------
void Index :: readFiles (sortentry* e)
{
FILE *fp;
char *s;
static int fnum = 0;
int wds = 0;
if (e != NULL) {
readFiles (e->left);
fp = fopen (e->filename, "r");
fnum++;
CStatusDlg status;
status.Create(IDD_INDEX_STATUS_DIALOG);
if ((s = (char*)strrchr(e->filename, '/')) == NULL)
{
ASSERT(status.GetSafeHwnd() != NULL);
ASSERT(status.m_OUT.GetSafeHwnd() != NULL);
ASSERT(e != NULL);
ASSERT(e->filename != "");
status.m_OUT.AddString(e->filename);
}
else
{
ASSERT(status.GetSafeHwnd() != NULL);
ASSERT(status.m_OUT.GetSafeHwnd() != NULL);
ASSERT(e != NULL);
ASSERT(e->filename != "");
status.m_OUT.AddString(e->filename);
}
// cout <<" " << s+1;
insert (fnum, e->filename);
if (fp) {
wds = getWord (fp,fnum);
}
else {
cerr << "File: " << e->filename << " can't open" << endl;
return;
}
cout << " (" << wds << " words)" << endl;
fclose (fp);
free (e->filename);
readFiles(e->right);
delete e;
}
}
|
|
|
|
|
CStatusDlg is child of CDialog?
Check if IDD_INDEX_STATUS_DIALOG is the right id of a Dialog resource.
else follow the functions's call using F11, and, surely, you will find the point that give the error.
|
|
|
|
|
Possible error:
CStatusDlg status;<br />
status.Create(IDD_INDEX_STATUS_DIALOG);
->Use this:
CStatusDlg status(IDD_INDEX_STATUS_DIALOG);
|
|
|
|
|
Hi,
i did that i am getting compile time error
CStatusDlg status(IDD_INDEX_STATUS_DIALOG);
'CStatusDlg::CStatusDlg' : cannot convert parameter 1 from 'const int' to 'class CWnd *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
|
|
|
|
|
Then, follow the create function using F10 and F11.
Be sure that the ID (and resource object) IDD_INDEX_STATUS_DIALOG is correct.
|
|
|
|
|
Hai,
I have checked the Dialog ID its correct.
I am not able to trace with f11, how to do that ?? its keep on entering the loop its not breaking.
|
|
|
|
|
Simply press F11 in place of F10 when you want to show the code of a called function (in your case Create )
|
|
|
|
|
fp = fopen (e->filename, "r");<br />
...<br />
if ((s = (char*)strrchr(e->filename, '/')) == NULL)
mmm....
fp = fopen (e->filename, "r");<br />
...<br />
if ((s = (char*)strrchr(e->filename, '\\')) == NULL)
Is this a good correction?
|
|
|
|
|
Hi,
I have checked with out adding items it works corectly whn i add the additems to list box i am getting error.
|
|
|
|
|
can you please show the value of e->fileName ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
hi,
It hold the value like c:\path\dir\filename1 that it
|
|
|
|
|
|
what happens if you hard code it with "c:\\path\\dir\\filename1" ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
How to use readFiles can you show
whitesky
|
|
|
|
|
Check if you are binding the variables to the list box correctly. If affirmative you try building this piece of code in ReleaseMode.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
CStatusDlg status;
status.m_OUT.AddString(e->filename);
You cannot do this like that.
the m_OUT listbox will not be Create d until you call either DoModal or Create, so it will crash because the HWND will not exists.
One way is to fill the listbox in the OnInitDialog of your dialog.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
i said but he writes it dosent work
whitesky
|
|
|
|
|
vinaycool wrote: CStatusDlg status;
status.m_OUT.AddString(e->filename);
There are several things wrong here, namely status is a CStatusDlg object whose underlying window has not yet been created. At a minimum, you need to do something like:
CStatusDlg status;
status.DoModal();
...
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_OUT.AddString("1");
m_OUT.AddString("Zoo");
} Until CStatusDlg 's window and the m_OUT control actually exist, calling AddString() will obviously result in an error.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi,
In the dialog window CStatusDlg i have one more class INDEX and it has its own header file.
i am not generating file name inside CStausDlg OninitDialog function i have used the seperate function for file name generation ..is there any way i can access list box from other class ???
|
|
|
|