|
error C2533: 'CSentenceArray::__ctor' : constructors not allowed a return type
Code:
SentenceAr.h
class CSentenceArray
// Sentences stored as an array
{ public:
CSentenceArray(bool bCreateArray);
virtual ~CSentenceArray(void);
void readFromFile (const char *pszFileName);
//void Display (ostream &Sentence);
void sortSentences(bool bAscending); // implements BubbleSort or quicksort
void Clear();
int FirstWord(const char *ptrWord);
virtual int HowManyWords(const char *pszWord);
protected:
//virtual void storeSentence(const char *pszSentence);
//virtual const char *getNextSentence();
//virtual const char *peekNextSentence();
//virtual void swapWithNext();
//virtual void Reset();
//virtual void eraseAll();
private:
char *m_pSentences;
int m_iCurrentPos;
};
SentenceAr.cpp
#include "StdAfx.h"
#include ".\sentenceAr.h"
CSentenceArray::CSentenceArray(bool bCreateArray)
{
int x = NULL;
}
virtual CSentenceArray::~CSentenceArray(void)
{
}
Jon
|
|
|
|
|
I've created a console project and added you class.
Apart from removing virtual from destructors implementation (You've marked it as virtual in the header file so there's no need for "virtual" keyword in the implementation file) there were no errors...
I'm usig VStudio 2003
|
|
|
|
|
I have written some program codes in C#.NET and VC++.NET.I used to use .NET 2003.But as far as it doesn't support XML Documentation for VC++, I have obliged to switch to .NET 2005.It makes XML files for me. When I was using .NET 2003, I used NDOC to make .chm files out of this XML file(which was made from C#.NET 2003), but now that I am using .NET 2005 and making XML files out of VC++.NET, it is impossible to use NDOC for this kind of XML files, because NDOC only supports XML files made by C# compiler. What can I do? Is there any other tools which support both of them? I am in urgent need. Looking forward to hearing from you.
Thanks in advance.
|
|
|
|
|
Is there a flag i need to raise in order to draw each item (such as in list control i use Ownder-Draw style and then the method DrawItem is getting called).....
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Do you need to customize CTreeCtrl?
whitesky
|
|
|
|
|
Generally, you are better off using custom draw[^] with the tree view.
Software Zen: delete this;
|
|
|
|
|
I build a based dialog application!
and I add some controls ,such as CEdit, CProgress, Cbutton
etc.
But I dbclick the title to maxsize the dialog,
the control still looks old, not changed together
It makes me angry, and how to adjust them to be look comfortable?
if you know, please describle it detailly!
Waiting for answers online!
Just my interest for these common things
|
|
|
|
|
Hope I understood your question
You want to set size and location for your controls when you max or min your dialog
you can use MoveWindow or SetWindowPos in WM_SIZE
for example m_edit.MoveWindow(cx,cy,cx/2,cy/2)
I hope its helpful to you
whitesky
|
|
|
|
|
yes, that's right!
but does it exist any easy way to make all controls can adjust themselves ?
I see some codes in VB,
:
with each obj in form
// adjust the size
Has it the same effect codes in VC?
Just my interest for these common things
|
|
|
|
|
maybe its some helpful to you
CWnd *pWnd2;
pWnd2 = GetTopWindow();
do
{
if(!pWnd2)
break;
pWnd2 ->ShowWindow(0);
pWnd2 =pWnd2 ->GetNextWindow();
}while(pWnd2);
</code>
When you run this code all your controls are hide
whitesky
|
|
|
|
|
xuwenq88 wrote: yes, that's right!
There's an example in the Extras section of this article.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Try looking in the Dialog[^] section of Code Project. Look at the Control Positioning and Dialog sub-sections especially.
Software Zen: delete this;
|
|
|
|
|
Try looking in the Dialog[^] section of Code Project. Look at the Control Positioning and Dialog sub-sections especially.
please give me the correct page link to me ,thank you!
Just my interest for these common things
|
|
|
|
|
The articles in the sections I identified for you will help with automatically laying out controls in a dialog box. You will need to examine the articles on your own to determine which one meets your needs.
Software Zen: delete this;
|
|
|
|
|
Hi,
I have a question about the GDI+ DrawLine method. For some reason, in my latest program, it seems to work for awhile and then suddenly just stop working. I've used GDI+ DrawLine in many other programs and I've never seen this happen before. Sometimes it doesn't work at all, other times it will work for a little while and then stop working (i.e. it just doesn't draw anything anymore). Here's the code:
<br />
Graphics *graphics = NULL;
<br />
...<br />
<br />
graphics = new Graphics(TheHDC);
<br />
...<br />
<br />
void Draw(int x, int y, int x2, int y2)<br />
{<br />
Pen blackPen(Color(255, 0, 0, 0), 2);<br />
graphics->DrawLine(&blackPen, x, y, x2, y2);<br />
}<br />
Any help would be appreciated, thanks!
Kelly Ryan
|
|
|
|
|
How many times are you calling the initialisation?
It could be you end up creating more device contexts than can be handled, I can't say without seeing the complete code.
Elaine
The tigress is here
|
|
|
|
|
It initializes only once.
Kelly Ryan
|
|
|
|
|
Where you use these codes and how?if you can draw then you can use again unless you have a problem in your code
whitesky
|
|
|
|
|
Draw() is called each time the screen needs to be redrawn. It is definitely being called, I have put an AfxMessageBox into the function to make sure. The graphics-DrawItem method is being called, but nothing is being drawn. It's as if the graphics has de-initialized somehow, but there's no reason it should do that. Nobody has seen a similar problem before?
Kelly Ryan
|
|
|
|
|
I think it should worked, a question you wrote that Sometimes it doesn't work at all, other times it will work Is it possible for you that show your code of course not all only it section that you have problem with it
whitesky
|
|
|
|
|
Remember that the DC you got your hdc from cannot go out of scope while you are drawing with the graphics object. How is your DC object created? (On the stack or the heap?)
-- modified at 16:32 Sunday 16th July, 2006
I guess the best way to put it is don't hold onto the graphics object or dc beyond a function call and you'll be alright. I usually create the graphics object once during my OnDraw and loop through my primitives objects draw functions then let the graphics object go out of scope until the next call to OnDraw. If you store it globally, your likely asking for trouble.
|
|
|
|
|
The graphics object is a global, I allocate memory to it on program initialization from the heap, I tried freeing it and re-allocating it each time the draw is called and that seems to work. Just very strange since I do almost exactly the same thing, using a global graphics object (the code is practically copied and pasted) in another, much more complicated application I wrote last summer and I've never seen a problem in that one (and I use that program rigorously almost every day).
In any case, it works now, thanks!
Kelly Ryan
|
|
|
|
|
I am getting "R6025 - pure virtual function call error" somewhere in my code but I can't seem to catch it using SEH. Is this a known issue with SEH?
Here is an example to demonstrate this:
<br />
#include "stdafx.h"<br />
#include <assert.h><br />
<br />
<br />
<br />
class A;<br />
<br />
void fcn( A* );<br />
<br />
class A<br />
{<br />
public:<br />
virtual void f() = 0;<br />
A() { fcn( this ); }<br />
};<br />
<br />
class B : A<br />
{<br />
void f() { }<br />
};<br />
<br />
void fcn( A* p )<br />
{<br />
p->f();<br />
}<br />
<br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
__try {<br />
B b;<br />
}<br />
__except(EXCEPTION_EXECUTE_HANDLER) {<br />
assert (false);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
thanks!
|
|
|
|
|
An R6025 pure virtual function call error occurs because you've called a pure virtual function - one where you declared
virtual void MyFunc() = 0; The compiler writes the address of a handler function to the slot in the virtual function table corresponding to the function for this class - this handler generates the run-time error.
An object whose class has virtual functions carries a virtual function pointer [vfptr] which points to the correct virtual function table [vtable] for the class. During execution of each class's constructor in the hierarchy, from top to bottom (base to derived), the vfptr points to that class, so for example, if you have CBase, CMiddle and CDerived, where CMiddle derives from CBase and CDerived from CMiddle, and you create an instance of CDerived, during CBase's constructor(s) the vfptr points to CBase's vtable, during CMiddle's constructor(s) the vfptr points to CMiddle's vtable, then during CDerived's constructor(s) the vfptr points to CDerived's vtable. Therefore, while the class constructor is executing, if the class has pure virtual functions, the pure virtual function could be called.
If you call a pure virtual function within some other function, and call that function from within a constructor, you'll get an R6025 runtime error.
Example:
class CBase
{
public:
virtual void A() = 0;
CBase()
{
B();
}
void B()
{
A();
}
};
class CDerived : public CBase
{
public:
void A()
{
}
};
int main(int argc, char* argv[])
{
CDerived derived;
return 0;
}
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I am trying to create a program (for a class). If 4 spaces occur in row, then we have to replace the 4 spaces, stored as spaces, as a tab char instead (the '\t' symbol). I am using MS Vis Studio .NET C++ and the \t representation for a tab only provides 3 spaces, not 4. Is there a way to set \t to indicate 4 spaces?
Thank you,
G-Poppa
cpp@//nearsphere//.com
cpp\@\nearsphere\.\com
|
|
|
|