Tuesday, April 15, 2008

BE CAREFUL!!!

(01) Always write optimize and good code in WM_PAINT, WM_MOUSEMOVE and WM_CTLCOLOR event handler. In these three event handlers is always called and it’s tough to debug if any bug exists.

(02) When you got the device context by GetDC() api, you must make sure to release the device context by ReleaseDC() api after painting.

Thursday, April 10, 2008

DECLARE_DYNCREATE problem

When you want a class, who will dynamically created by CreateObject(), then you must have a default constructor. Otherwise you got “Compiler Error C2512 - no appropriate default constructor available”.

Forward Declaration problem

When you made a class child who is inherit from class parent and if parent class has some forward declaration then you received a “Compiler Error C2512 - missing type specifier”.

The solution is remove the forward declaration from the parent class header.