|
Here are my ON_COMMAND's etc:
BEGIN_MESSAGE_MAP(IOschermclass, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
ON_BN_CLICKED(IDOK_IOscherm, OnBnClickedIoscherm)
//ON_BN_CLICKED(IDCANCEL2, OnBnClickedCancel2)
ON_BN_CLICKED(IDC_CHECK, OnBnClickedCheck)
ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
ON_STN_CLICKED(ID_outpad, OnStnClickedoutpad)
ON_COMMAND(IDOK_IOscherm,OnBnClickedIoscherm)
//ON_COMMAND(ID_TERUG,OnBnClickedTerug)
ON_BN_CLICKED(ID_TERUG, OnBnClickedTerug)
ON_STN_CLICKED(ID_inpad, OnStnClickedinpad)
ON_BN_CLICKED(IDC_stop, OnBnClickedstop)
ON_COMMAND(IDC_stop,OnBnClickedstop)
END_MESSAGE_MAP()
It's exact the same as in other parts of my app, but it doesn't work!!!!!
|
|
|
|
|
Post the declarations of those functions, in your class's header file
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
OK, here is how it works with me:
GeneralPP, derived from a CPropertyPage, contains a button to show a CAdvProcDlg, derived from CDialog.
After closing CAdvProcDlg, you can then proceed to use GeneralPP or even call CAdvProcDlg again.
In my case, there is no need to call EndDialog() in CAdvProcDlg, I only use IDOK and IDCANCEL.
void CGeneralPP::OnButtonProcAdvanced()
{
CAdvProcDlg dlg;
int result = dlg.DoModal();
if (result != IDOK)
{
if (result!=IDCANCEL)
{
TRACE1("CAdvProcDlg ended with %d", result);
}
}
else
{
}
} [EDIT]
Please not the function signature of my OnButtonProcAdvanced() function: return type void , parameter list void , too. This may very well make the difference?
[/EDIT]
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hello,
Did you port some old code written in a different language that are not part of a standard library? If so, and they are called from IOschermclass, try not to call those.
The is a tiny change that this will help you getting closer to the source of your problem...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
No,
it's all fesh, brand new code, written in MFC C++ in vStudio .NET 2003
|
|
|
|
|
If you press other bottons on the dialog, do you get the same error?
jij bent trouwens de eerste nederlander die ik hier tegenkom
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
No, i don't get the same error : it's unique
Nee hoor, ik krijg niet dezelfde error, dit gebeurt alleen bij die specfieke knop.
|
|
|
|
|
Post the code for the OnCancel() method, the problem probably lies there
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I mean the OnBnClickedCancel() method,...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
it's just EndDialog(IDCANCEL);
|
|
|
|
|
When I look at the declaration of EndDialog, you are missing a parameter! (from the msdn library: BOOL EndDialog(HWND hDlg, INT_PTR nResult);)
but let's get something straight:
When you press the cancel button, OnBnClickedCancel() is called.
From there you call EndDialog().
Assuming this, maybe you should call CDialog::OnCancel(). The EndDialog function just ends the message loop returning control to the system, maybe something goes wrong there.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
OK,
I'll try: wait a moment
|
|
|
|
|
I'm sorry, doesn't work
DO you have got some other idea's
I'll put the code of my first window, wich will have to receive the message, below this text.
void CF2FDlg::ga_naar_IOscherm(Cmodeprop C)<br />
{ <br />
IOschermclass *iosclass;<br />
iosclass=new IOschermclass();<br />
iosclass->set_properties(C);<br />
<br />
INT_PTR nRet = -1;<br />
nRet=iosclass->DoModal();<br />
<br />
<br />
<br />
switch(nRet)<br />
{<br />
case IDCANCEL:<br />
{<br />
return;<br />
}<br />
case IDC_stop:<br />
{<br />
break;<br />
}<br />
<br />
case 1:<br />
{<br />
return;<br />
}<br />
default:<br />
{<br />
return;<br />
}<br />
};<br />
<br />
<br />
return;<br />
}<br />
|
|
|
|
|
I'm sorry, doen't work
DO you have got some other idea's<br />
<br />
I'll put the code of my first window, wich will have to receive the message, below this text.<br />
<br />
<br />
void CF2FDlg::ga_naar_IOscherm(Cmodeprop C)<br />
{ <br />
IOschermclass *iosclass;<br />
iosclass=new IOschermclass();<br />
iosclass->set_properties(C);<br />
<br />
INT_PTR nRet = -1;<br />
nRet=iosclass->DoModal();<br />
<br />
<br />
<br />
switch(nRet)<br />
{<br />
case IDCANCEL:<br />
{<br />
return;<br />
}<br />
case IDC_stop:<br />
{<br />
break;<br />
}<br />
<br />
case 1:<br />
{<br />
return;<br />
}<br />
default:<br />
{<br />
return;<br />
}<br />
};<br />
<br />
<br />
return;<br />
}<br />
|
|
|
|
|
I just solved the problem... I thought you might like to know how I did it,, but I don't understand it myself --> when I removed the setproperties call, everything worked okay.
The program must have had the problems because of that crash, although it is just a very simple function:
Th second screen has an own object of type Cmodeprop, with setproperties you povide an object to get passed to the second window. It is something like this:
set_properties (Cmodeprop C)<br />
{<br />
own_props=C;<br />
return;<br />
}
This is really strange (microsoft!!!)
|
|
|
|
|
That sure is strange! Well, At least you solved it! .
I once had a strange assertion in my program. It took me 3 days to solve it !
(by the way, Cmodeprops is probaly a class, did you write a copy constructor? or overload the operator=? It might solve something!)
Good luck...
|
|
|
|
|
Hello,
I had a similar error. Try "Rebuild All"
|
|
|
|
|
Let me try........
No doesn't work:
I've pressed clean solution under BUILD, ad then Rebuild Solution. After trying again I got the same error
|
|
|
|
|
It is strange
Difficult say more without seeing project settings and code...
Vitali
|
|
|
|
|
I've put some code on this forum (this thread at 8:37), please take a look
|
|
|
|
|
Thakns, but I don't think this will make a change ?
|
|
|
|
|
Normal code;)
Some comment:
Replace :
IOschermclass *iosclass= new IOschermclass();
INT_PTR nRet = -1;
nRet=iosclass->DoModal();
to
IOschermclass iosclass;
int nRet=iosclass.DoModal();
May be you doing "something artful" in this dialog?
Vitali
|
|
|
|
|
I am building a MFC based program that will first run a series of pings and then NET VIEW command to see which users are online. I have already been able to create a process to run ping.exe, but how can I run NET VIEW and capture the output? I've been digging information, and my head is spinning. Not even coffee helped :P How to capture output from CreateProcess()?
|
|
|
|
|
Поцелуй свой поток в зад!!!
|
|
|
|
|
Use a Pipe to redirect the output to your window;
See CreatePipe, STARTUPINFO and CreateProcess.
Arjan.
|
|
|
|