|
Thanks ,I was implemented, still I am getting same errors.
Actual Problem:
class CMyDoc : public CDocument
{
CListView * p1;
CTreeView *p2;
};
class CMyDoc;
class CMyDialog : public CDocument
{
CMyDoc *m;
};
void CMyDialog :: OnOk()
{
m->p1->fun(); ---------> Here I am getting an error ->Access violation
CDialog::OnOk();
}
CListView ,CTreeView are members of the CMyDOc.
Pl Help me
satya
|
|
|
|
|
I inherited some source code that was originaly written for command line apps.
Some functions have signatures as follows
void doSomething(whatever wh, FILE *fp);
so if you pass stdin or stderr it will output the result to the console.
Since I'm writing an MFC app that needs to use these functions, is there any way to redirect the output to a MessageBox, Static text or any other non console output?
|
|
|
|
|
|
I'm making an MFC appplication with CDialog as the base class. Wanna open another non modal dialog in it. Please suggest me how to do this...
All help is appreciated
Thanks
|
|
|
|
|
CAnotherDialog *pDlg;
pDlg = new CAnotherDialog;
pDlg->Create(CAnotherDialog::IDD);
pDlg->ShowWindow(SW_SHOW);
for more info read the msdn.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
don't forget to delete pDlg the variable.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Modeless dialog created via pointers generally delete themself.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Thanks for the help it solved the problem.
|
|
|
|
|
char *sendSize;
sendSize = new char[10];
//on operator delete i have error during the running:
//Unhandled exception at 0x77f767cd in Connect.exe: User //breakpoint.
// in dbgheap.h
// #define WINVER 0x0400
// I'm using VS 7.
delete [] sendSize;
|
|
|
|
|
there must be something you must be doing between new and delete that is causing the problem with the pointer.
if you overshoot the buffer you would get the error when deleting the pointer.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Weird... I had that one too a while ago and it seemingly had nothing to do with pointers. This is just that there is a particular breakpoint code in executable. Can this be a compiler bug because it all went away as soon as I switched to Release build.
PS. It's not an "overshoot" error. The error message sounds differently. I remember because I get it at times
|
|
|
|
|
You are still trashing memory outside of the array. The reason it doesn't have problems in release mode is because the CRTL doesn't have the memory checks on deallocation. All you did was turn off the error, not fix it.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yup. This can be true. But the other possibility is that there actually is no error and Debug version just keeps generating that lousy exception because I'm trying to write beyond what's the end of the string (i.e. '\0') but far from being beyond the end of the allocated memory end. In such case it can be but a misunderstanding based on compiler developers' wish to warn programmer of a possible mistake.
If it's an actual error then please somebody explain to me what's wrong with this code:
char* ptr=new char[256];
strcpy(ptr,"123");
ptr[3]='4';
ptr[4]='\0';
delete [] char; //we get an exception here
|
|
|
|
|
Be sure you don't write outside the border of your allocated memory (be carefull of the end of string character ('\0') ). So this will probably produce an exception when destroying the string:
char* sendSize;<br />
sendSize = new char[10];<br />
strcpy(sendSize,"1234567899");
|
|
|
|
|
Try setting the last item in the array to null.
Kuphryn
|
|
|
|
|
See the line dbgheap.h which is showing an error. It can tell you a lot about the failure.
Bikram Singh
|
|
|
|
|
Hello,
i need a TreeCtrl with Tri-State Checkboxes. Is there any chance to do this with the CTreeCtrl Class? And if yes, how
Thanks and Greetings,
Joerg
|
|
|
|
|
Hi all,
I am doing a graphics project in Embedded VC++.
For drawing dashed ellipse, I use the BeginPath(), Endpath(), BezierTo() functions.
But these functions are not supported in WinCE.
Is there any alternative way for drawing a dashed ellipse(width > 1) compatible to WinCE.
Please help me.
With Thanks and Regards,
arun a.c.
|
|
|
|
|
Compute the line segments yourself and call Polyline .
You could also try drawing an ellipse using a solid black pen into a memory buffer, then use that as a mask with MaskBlt to blit a hatch pattern into the screen buffer.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hi guys,
is it possible to use serialize to read a text file?
i got text file which is just as:
standard1 name1
standard2 name2
......
how can i use serialize function in doc class to read it and store it seperately in two CString Arrays(CString standard[100], CString name[100])?
thank u in advance!
|
|
|
|
|
Can I pop up a Doc/view window by clicking a button on a dialog? they must be within the same project space.
|
|
|
|
|
|
hi, thank you for your advice, but it seems you misunderstand me, actually I don't want the Doc/View to be nested inside the Dialog. what I want is sth like: after I click 'ok' on a messagebox, a IE window (Doc/View)pop up. However, I don't want to use shell comment to call a compiled execuatable file from a Dialog based application, I want Doc/View and Dialog be within the same project because there will be some parameter passing staff.
|
|
|
|
|
hello,
I want to use the SysSysColors-function to change some system-colors. how can I write this changes permanent to the user-profile (registry: HKEY_CURRENT_USER...)?
thanks in advance for your replies.
regards, thilo.
|
|
|
|
|
Consider this snippet:
CFoo* p = new CFoo[10];
.
.
.
delete [] p;
My understanding of the delete [] p above is that it
- calls the destructor of each of the 10
CFoo instances,
- frees all memory allocated for the 10
CFoo instances.
Right?
Therefore, when allocating memory for simple data types, e.g., C-style strings, I tend to do this:
char* p = new char[10];
.
.
.
delete p;
i.e., I skip [] , since there's no destructor for char .
Is this wrong to do?
(Yes, I could probably look it up in the book shelf behind me, but then I wouldn't get the wonderful diverse insights of the Cpians...)
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|