1. MFC = Spaghetti code. It's the worst thing ever.
2. You can very well use GDI (what you call WinAPI) in C++.
Here's a small example:
Code:
class IControl {
protected:
IControl() : Caption(0) { }
public:
virtual HWND CreateControl(POINT, UINT, UINT) = 0;
void SetPosition(POINT);
void SetPosition(UINT, UINT);
void SetSize(RECT);
void SetCaption(LPSTR);
protected:
HWND WndSelf;
POINT Position;
RECT ClientRect;
LPSTR Caption;
};
class EditControl : public Control {
public:
EditControl() { }
virtual HWND CreateControl(POINT, UINT, UINT);
};
// ....
std::list<IControl*> Controls;
Controls.push_back(new EditControl);
Controls.push_back(new ButtonControl);
IControl* ptr = 0;
std::list<IControl*>::iterator iter;
for(iter = Controls.begin(); iter != Controls.end(); iter++) {
(*iter)->CreateControl( /*... */ );
if((ptr = dynamic_cast<EditControl*>(*iter)) != NULL) {
// We have an edit control here
} else if((ptr = dynamic_cast<ButtonControl*>(*iter)) != NULL) {
// We have a button control here
}
}
Is this C++ enough for you ?
OOP, Inheritance, polymorphism, dynamic_cast, STL containers...