Well certainly I wouldn't place such a time-frame on myself. But in my view, the majority of the programming should be focused on the algorithms and data structures, the back-end . Still I admire your willingness to use pure API and it only exemplifies the outstanding coder that you're so well known to be ( just ask around ). I always liked programming console apps because of the emphasis on the utility of it, and after moving on to Windows, quickly decided I would like to use a "visual" environment to produce the bulk of the GUI in order to continue enjoying that utilitarian programming style. While I haven't reached the visual aspect quite yet, I have come close to the source code version. Here is a small example of Hilo in action.
Code:
class Winnie : public MainWindow {
public:
void NotifyMe() {
Beep(10, 10);
}
Winnie() {
Register(&Winnie::NotifyMe, WM_LBUTTONUP);
}
}; //...we here 'beep' when user releases left clicker over main window...
Winnie win;
//..tight coupling, class accesses a global variable "win"...
class Button1 : public Button {
public:
void BeepWinnie() {
Send(win, WM_LBUTTONUP);
}
Button1() {
Register(&Button1::BeepWinnie, WM_LBUTTONDOWN);
}
}; //...we here 'beep' when user clicks a button of this class...
//...now use loose coupling...
class Button2 {
public:
Button2() {
Register(&Button2::BeepStranger, WM_ONMOUSEHOVER);
}
void BeepStranger() {
Broadcast( WM_LBUTTONUP ); //..send to "attached" observers...
}
}; //...we get a 'beep' when user hovers over this button...
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int visibility) {
ScreenMax max; //...thin encapsulation of SM_CX/CY retrieval...
win.SetWidthHeight( max.x/2, max.y/2 );
win.Center();
win.Create("Hello World!", DefaultWindowStyle(), visibility);
Button1 b1("Tight", max.x/10, max.y/10);
Button2 b2("Loose", max.x/10, max.y/10);
//...create two side-by-side buttons...
b1.BottomRight( b1.Center( win.Center() ) ); //...'bootstrap' alignment ;)
b2.BottomLeft( b2.Center( win.Center() ) );
win.Observe( b2 ); //...recieve b2's Broadcast's()...
return win.RunMessageLoop();
}
As you can see, we're back to programming in main(). Gone is the ugly WindowProcedure. No more fishing for HWND's. Just an easy to use interface that hides so many of those ugly implementation details, without compromising the API itself ( for instance, GetDC( win() ) would be a valid call...).
Having said that, though, all Windows programmers should know straight API, if not just to understand how the whole convoluted (but fascinating) mess works.