Using Address Operator with Class Members
Hi,
I am having problems while using & with class private members. Take the following class (as for example):
class WinProcMsg
{
private:
// Handle to the Device Context
HDC hDc;
// Name assigned to the PAINTSTRUCT Structure
PAINTSTRUCT Ps;
public:
// To handle WM_PAINT Message
BOOL Paint(HWND);
};
Now if I code the Paint() like this:
BOOL WinProcMsg:aint(HWND hWnd)
{
// Start Painting Window
hDc = BeginPaint(hWnd, &Ps);
// Finish Painting Window
EndPaint(hWnd, &Ps);
// WM_PAINT Message was completed successfully
return TRUE;
}
Ths compiler gives error "Illegal Operation" when I pass the memory address operator, like in:
hDc = BeginPaint(hWnd, &Ps);
How do I accomplish this task using classes in same situation?
Thanks,
I can survive anything ... even NUKES!!!
The Lion King
That code works fine for me, could you be a bit more specific in the error you are getting?
I am using Visual C++ 6 compiler and I always get an error whenever I use &Ps saying :
"Illegal Operation"
Not only that if I fill WNDCLASSEX Class Structure and CreateWindow() in WinMain then the compiler will not say any error but will not compile into executable.
Is something wrong?
or I have to change some options of Visual C++ 6
Please help!
I can survive anything ... even NUKES!!!
The Lion King
"Illegal Operation"
Not only that if I fill WNDCLASSEX Class Structure and CreateWindow() in WinMain then the compiler will not say any error but will not compile into executable.
Is something wrong?
or I have to change some options of Visual C++ 6
Please help!
I can survive anything ... even NUKES!!!
The Lion King
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement