>> it will be initialized through some constructor.
Right! Should have figured it out. When the child constructor gets called, it calls the parent's constructor as part of the construction process, so the parent (which is a 'subset' in the child) is properly initialized.
>> A parent can only...
Got it!
You can't call a class' method from anywhere, presumably because 'this' doesn't get passed.
I'm curious though -- what are the risks of calling the methods of a class which hasn't been initialized?
By that I mean, normally an instance of a class is constructed, etc., after which its...
Most MFC functions call their parent's functions, like for instance:
void CMyDoc::DeleteContents()
{
...do stuff
CDocument::DeleteContents();
}
How do they do this? They aren't calling member functions of an *object*, they are calling member functions of a *class*.
And those member...
Sometimes when there is a compile error the output window shows the error, but when I correct it, the build won't *start again* !
If I try to quit VC, it says "there is a build in progress, stop it first with Stop Build". Only Stop Build doesn't do anything. So my only recourse is to...
After a recent XP install, Windows Media Player doesn't play movies. It used to work fine just days ago, now it suddenly just plays the music, not the video.
In addition to my question...
I'm connecting using dial-up (a Conexant softmodem).
Aside from the obvious suggestion "it's a virus dude" what could it be?
I just installed XP on a clean new system. I don't have automatic updates turned on (I checked it off), I don't have anything on this system, not even Office.
When I dial up, the connection status shows a constant upload - no programs are running, the task list is empty, and still it keeps...
I had the same problem. Revert to stock objects (brushes, pens) and delete created objects *before* closing the DC. That will do it.
See here: thread713-686470
void GetScore(double& score);
void DetermineGrade(double score, char& grade);
notice the &'s. You need to mark these parameters as references so the functions can change them and the values still exist after the functions have exited. Otherwise they're deleted.
wndclass.hbrBackground = (HBRUSH)GetStockObject (BLACK_BRUSH);
when registering the window class (in bare Win32 API). In MFC, look it up where you can pass arguments to the window class.
I'm running multiple instances of the same project; I compile different projects, the instance handle is ALWAYS the same = 0x00400000.
Spy++ shows it too.
What's going on?
Here is the code. After about 900 mousemoves the rectangle goes white and stays white.
case WM_MOUSEMOVE:
xMouse = LOWORD(lParam);
yMouse = HIWORD(lParam);
InvalidateRect(hwnd,NULL,FALSE);
return 0;
case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;
SelectObject(hdc...
Say we have a template function that returns the maximum of two values.
template <class T> T& max (T param1, T param2) {...}
It's logical that it would compile into *two completely* separate functions if it's called once with integers, and once with, say, strings.
Then, if this template is...
Hi,
I'm writing a program that updates the client area (fills it with a new color) at each WM_MOUSEMOVE.
I use CreateSolidBrush, fill the area, then duly DeleteObject the brush, but still it doesn't work - after a few hundred mousemoves the brush turns white and stays white -- my guess GDI...
I did not know Mr Stroustrup took the time to answer (lame) questions like my own :)) lol
Actually he's got a point there, bit where do you draw the line? If you keep going in the same direction, you'd end up declaring a variable every time you use it... :/
To Ion Filipski -- multumesc Ioane! ;)
Hi,
I'm doing this according to Straustrup but VC gives the error:
unresolved external symbol "public: static int something::N"
What's going on?
struct something {
int x;
static int N;
};
void main()
{
something::N = 0;
}
Hi,
I'm trying to understand this code. This is the message loop in WinMain, it keeps asking for messages.
.WHILE TRUE
invoke GetMessage, ADDR msg,0,0,0
.BREAK .IF (!eax) ; break if no message
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
I have a few...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.