|
With insufficient information, I missed what Richard was saying. I have to laugh though. When Windows was 16 bit, I was off in Unix land. So, I've not made this transition. I did just get done with migrating the project as a whole, so the suggestion certainly makes sense.
Quote: Just pick the body up onto the clipboard and post it into a new empty resource file associated to the project. That is why we can't work out why you are stressed over it as it's like 1 min work with a text editor .
now I understand, sorry for being so dense. I'll get to this in the afternoon and see where it leads me.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
modified 9-Aug-16 16:38pm.
|
|
|
|
|
Well, to update this query by me so that someone might be helped in the future:
VS2008 does not even come close to properly converting a project from eVC++. There are so many macros left undefined from the conversion that VS2008 is not able to handle its own includes let alone the application. The problem has absolutely ZERO to do with any specific resource file. It's caused by the pathetic migration effort made by VS2008.
Save yourself some time and (a) create a simple smart device project appropriate for you in VS2008. Then (b) migrate the existing code base in one at a time. Even then your dialog resource processing may need manual intervention.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
modified 8-May-17 17:18pm.
|
|
|
|
|
I have a straight class hierarchy.
The base class only has a method F() which calls another method P().
This method P() has to be implemented in all of the child classes and is called by polymorphism.
How can I get sure (at compile time) that all child classes implement this method P()?
class CBase
{
private:
virtual void P() { printf("CBase::P\n"); }
public:
void F() { printf("Base: F()->P(): "), P(); }
};
class C1 : public CBase
{
private:
virtual void P() override { printf("C1::P\n"); }
};
class C2 : public C1
{
private:
virtual void P() override { printf("C2::P\n"); }
};
void main()
{
CBase* p = new CBase();
p->F();
p = new C1();
p->F();
p = new C2();
p->F();
}
The above is the structure, when all is correct and will result in:
Base: F()->P(): CBase::P
Base: F()->P(): C1::P
Base: F()->P(): C2::P
Now I made a mistake and forgot to implement P() in class C1
class C1 : public CBase
{
private:
};
the compiler doesn´t error and it will result in
Base: F()->P(): CBase::P
Base: F()->P(): CBase::P
Base: F()->P(): C2::P
The only Idea is to use an Interface declaring P() abstract.
But since C2 is derived from C1 from CBase how to do?
Followeing code will show up an error on missing P(), but also shows up warnings when all is correct:
warning C4584: 'C1': base class 'PI' is already base of 'CBase'
warning C4584: 'C2': base class 'PI' is already base of 'C1'
struct PI
{
virtual void P() abstract;
};
class CBase : public PI
{
private:
virtual void P() { printf("CBase::P\n"); }
public:
void F() { printf("Base: F()->P(): "), P(); }
};
class C1 : public CBase, public PI
{
private:
virtual void P() override { printf("C1::P\n"); }
};
class C2 : public C1, public PI
{
private:
virtual void P() override { printf("C2::P\n"); }
};
also it doesnt help at all because now I have to be sure to derive C1,C2, ... from PI too, not only from its parent
So what I need is "method P() has to be declared in all child classes!- error if it is not"
|
|
|
|
|
If you make P a pure virtual function, then the compiler will spot if it has not been implemented:
virtual void P() = 0;
|
|
|
|
|
in which class, where to put this?
in CBase? -> then CBase doesnt have its P() method itself
in struct PI? ->still used this
"=0" is same systax like "abstract"
|
|
|
|
|
You put it in the CBase class then every class that inherits CBase must implement P .
|
|
|
|
|
does not work ...
I can ommit P() in C2 without compile error because its stil defined in C1
also I miss the code of CBase::P() itself
like:
class CBase
{
private:
virtual void P() abstract;
public:
void F() { printf("Base: F()->P(): "), P(); }
};
class C1 : public CBase
{
private:
void P() override { printf("C1::P\n"); }
};
class C2 : public C1
{
private:
};
|
|
|
|
|
The function C1::P() is declared private so it is not accessible in class C2 . However, it is difficult to see exactly what problem you are trying to solve here.
|
|
|
|
|
The structure is:
CBase <- C1 <- C2 <- ... etc
so straigt inheritance
CBase contains the main method CBase::F() which does all calculations needed.
And this method F() calls P() which should be choosen by inheritance (polymorphism)
CBase::F() { ...; P(); ... }
If I have CBase* b = new C2() than C2::P() will be called.
If I have CBase* b = new C1() than C1::P() will be called.
because of P() is a virtual method, overridden by C1::P().. C2::P() etc
now I miss C1::P() (forgot to add it) =>
if CBase b=new C1() then CBase::F() will call CBase::P() instead of C1::P() because there is no C1::P()
the override clause also tells the compiler to check if C1::P(), C2::P() match their parents P().
All is cointained by a complex chaotic SW-project which I will clean by small steps.
The idea behind:
P() is a call to a factory class which creates objects dependend on parameters AND on the class from which is called
CBase::P(int type) creates objects of CPbase_<type> so CPbase_1, CPbase_2...
C1::P(int type) creates obejcts of CP1_<type> so CP1_1, CP1_2...
C2::P(int type) creates obejcts of CP2_<type> so CP2_1, CP2_2...
etc...
CBase::F(switch,type) : if (switch) P(type) else CBase::P(type) ...
So if switch is set call the factory "of the class", else call the factory of CBase
example:
Cbase b = new C1();
b->F(true, 3) will create an object of C1_3()
All the pointers are stored in a list and for each element in the list the creation-funbtion F() is called
list ... C1*,CBase*,C3* etc ...
foreach element in list , element->F(switch,type) ...
|
|
|
|
|
1. Change all private into 'protected'
2. For testing purpose do trial and error of pure virtual test on each level.
Best wishes
|
|
|
|
|
Hi
I have a CrichEditCtrl that works fine. However when the user Selects to view some other data in a Different Cdialog/CRichEditctrl. The first stops working and returns a zero
I display the Text I am Searching for and the Returned code From FindText (in the caption bar)
The Text looks fine However as soon as The Second Cdialog/RichEdit are created the return from the First CDaliog/RichEdit returns a zero
I double checked things as resource id of both RicheditCtrl's and they are different
|
|
|
|
|
Are you saying both dialogs are open at the same time?
|
|
|
|
|
Yes Actually this is the 3rd CDialog/CRicheditCtrl Pair That I have in my application The parent window is the First Cdialog/CrichEditCtrl. However After this is Created the Find functionality of the Richedit which is a child control of my main (for lack of a better term)CDialog stops working
|
|
|
|
|
Without a lot more detail, including the code, it is anyone's guess. However using dialogs to open other dialogs does not sound like the best design.
|
|
|
|
|
If you can see the problem starts when it's returning zero then you have an obvious debug point.
Place a debug point inside an if statement on the zero return ... when it breaks follow the steps backwards. The hard part is generally finding a debug point with this sort of problem but you have that already.
In vino veritas
|
|
|
|
|
I added he following code want to see what is in the rich edit
linechar = myedit->FindText(FR_DOWN , &listtext);
if(linechar == 0)
{
CFile dumpfile;
CFileException e;
TCHAR* pszFileName = _T("F:\\DUMPLIST.LST");
if(!dumpfile.Open(pszFileName, CFile::modeCreate | CFile::modeWrite, &e))
MessageBox("file could not be opened");
EDITSTREAM dmp;
dmp.dwCookie = (DWORD_PTR) &dumpfile;
dmp.pfnCallback = (EDITSTREAMCALLBACK)dumpit;
myedit->StreamOut(SF_TEXT,dmp);
}
static DWORD CALLBACK dumpit(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile* pFile = (CFile*) dwCookie;
pFile->Write(pbBuff, cb);
*pcb = cb;
return 0;
}
|
|
|
|
|
|
ForNow wrote: I added he following code want to see what is in the rich edit Why not just use:
CString str;
myedit->GetWindowText(str);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Would that code get what's in the rich edit good to know
I did find the bug in my code
What works in the debug version does not necessarily work in release by doing research the bugs have to do with the heap in my case I had forgotten to initialize CStatic *pointers after adding the '= new' code I resolved the problem thanks
|
|
|
|
|
I get this message all of the sudden while I have a modless Cdialog and Richedit displayed
When I switch the debugger to threads I see a number of ntdll.dll worker threads
Can somebody point me in the right path
Thanks
|
|
|
|
|
Just look at the Call Stack and find in this list your own (last called) module. Click on it to see what was your command/operation that caused the exception
|
|
|
|
|
I did that went to the main thread (and looked at the stack) it pointed to thrdcore.cpp
!::GetMessage(&(pState->m_msgcur line 155 Please note I have created 5 other Threads 4 UI threads which act as a wrappers for my Derived CAsynSocket Class and a regular worker thread
Thanks
|
|
|
|
|
Access violation means that you're accessing memory that hasn't been allocated to your application ... so do the obvious.
Go back a few steps on the stack and look at the sequence and look at all the pointer use and check
1.) The pointer is valid
2.) Is what it pointing at allocated
3.) If it is required that the structure it points to #0 terminated ... is it.
Something in the last calls is failing one of those criteria, if need separate every pointer to a temp line of code in those sections and run a debug test on it.
In vino veritas
|
|
|
|
|
Without some more information about where this happened, the code that caused it, and the values of the variables involved, it is impossible even to make any suggestions. The only thing one can say is that you are using either an uninitialised variable, or one that has received an invalid value.
|
|
|
|
|
The strange thing Is there all these worker threads (ntdll.dll) that seem to have come up okay
Thanks
|
|
|
|