|
yes,I did know where the assert occured.
But it in the member function CWnd::AssertAvlid() function.
It was not in my class 's member function.
So,follow your way,how to find witch code of mine bring up such an assert?
Thanks
|
|
|
|
|
This information can be retrived from the call stack window and also from the variale window.
When you have pressed the rety button the application will be breaked. At that time take the variable window. On the top of that window you can find a combobox called "Context". Drop it. Check whether there is any of your function listed in it. Suppose there are three function say f1(), f2() and f3(), If f1 calls f2 and then f2 calls f3, the f3 calls the above funtion of CWnd, the comboboc will look like
cwd::functionname()
f3()
f2()
f1()
|
|
|
|
|
I would have a try and if there would be some other questions I hope I can gain hands from here.
Thanks.
|
|
|
|
|
kcynic wrote: I hope I can gain hands from here
Sure.
|
|
|
|
|
but I using VS2005 to debug it.How should I doing such things?
|
|
|
|
|
You may be using an unassigned variable or deleting a pointer that does not exist or doing some other incorrect operation. It should ideally not be the MFC files that would show an Assertion error.
Did you try and debug your code?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
but I did nothing when the dilog disapeared.
It would crash after about one min!
|
|
|
|
|
was this dialog created by a non mfc-thread ?
|
|
|
|
|
no,this dialog was create in a function of its parent dialog which also derived from CDialog
|
|
|
|
|
are you calling the DoModal() with a NULL from a different thread ?
|
|
|
|
|
I only using its member function ShowDialog(TRUE) to make the dialog appeared after I create the modeless dialog.That wat right or wrong to use modeless dialog?
Thanks
|
|
|
|
|
the handle is valid that is clear. It means there is something wrong. In most cases the windows has been destroyed or the windows was not properly (created, from another Thread)
Greetings from Germany
|
|
|
|
|
I think there is no window destroyed and no handle is acessed during such process,because no action I had done.
|
|
|
|
|
As I see you havent read my posting with the needed correctness. If you have 2 dialogs and share some data, as handles or messaging you HAVE to create them in the SAME thread.
Greetings from Germany
|
|
|
|
|
I create the second dialog in the function of the first dialog. I also using GetCurrentThreadId() to indicate the thread ID is the same.
|
|
|
|
|
That sounds fine.
Can you indentify to which windows the asserting handle belongs? (Tooltip?)
Are you creating others windows in one of the dialogs?
Greetings from Germany
|
|
|
|
|
No,I only cound found the assertion occured in the wincore.cpp,but nothing .
How should I know witch code I write bring up such problem?
|
|
|
|
|
You must step back to find the position or put out all window handles, or look at the call stack. There is also the Spy++ program.
I think the problem is to heavy for your experience, you should ask someone to debug your code. A collegue or a friend. SCNR
Greetings from Germany
|
|
|
|
|
A few lines down from the position in wincore.cpp you refer to is a comment that says:
You should read this article[^] the "Thread Maps" section in this article[^].
After you've read those articles you will know what to do and how to pass a MFC window object from one thread to another.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
according to the note,the problem is because the parameters I had passed.
There,in my codes,I only created a modeless dialog using create() function,and then call its ShowDialog(TRUE) to show it.In the second dialog's new operator function,I pass the current dialog's point as its first parameter,when I created it,I pass the current dialog's point as the first parameter again.
In another hand,I only pass a thread point which was create and start in the parent dialog.
That's all.There is no other parameter passed from one to another.Is any problems?
Best Wishes.
|
|
|
|
|
kcynic wrote: I only pass a thread point which was create and start in the parent dialog.
What do you mean by "passing a thread point"?
Are you, or are you not, using multiple threads?
You'd better post some code snippets showing how you create your dialogs as well.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Oh,I had usint the example [^]" rel="nofollow"> [^][ [^]">^]you send to me somedays before,and I also sent a e-mail to you of my problem of testing such example.I have pass the CClientThread point between some dialogs.
|
|
|
|
|
Ok, so you've used Newcomer's example as starting point.
As I understand it, you're passing the CClientThread pointer between dialogs. I don't see why though... You have to explain this because this could be part of your problem.
When I asked about some code snippets I wasn't joking; it's impossible to help you further if you don't show what you've done so far. It should be sufficient with the code that creates the dialogs.
For some reason I feel like your dialogs are created in the threads that contains the sockets. This is not a good thing for many reasons. You should post messages to the main thread to do this stuff so that the main window is the parent for your dialogs.
By the way:
I haven't received any mail from you regarding your problems and even if I did I would would have informed you not to post to me, or anyone on the boards, directly.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Yes,you are right,I did really using the example and passed CClientThread pointer between dialogs.
And it worked well at begining.But when it is connected with the server,I want to pass the connection to other dialogs and keep it active and no-recreated.What should I do?
Thanks.
|
|
|
|
|
I passed the thread like this:
parentDialog::function()
{
CThirdDlg* dlg=new CThirdDlg(this);
m_pClientThread->SetTarget(dlg);
m_pClientThread->m_socket.SetTarget(dlg);
...//other initializing
dlg->Create(IDD_MYDIALOG,this);
dlg->ShowDialog(TRUE);//i didn't know why it didn't show itself if no such code.
}
|
|
|
|