In my opinion, if you can sit down in a simple text editor, and without looking at any notes, write out the code for a simple application, then you are using the right libraries for the job. If you have to constantly look things up in a help menu or go to online tutorials, then you are using the wrong libraries for the job. If you can't write code that is self documenting, and understandable to someone who isn't familiar with the user interface that you are working with then that user interface is bad, and should not be used. In my experience this has been the doom of many projects that I have worked on with other people. They don't understand that 1000 lines of...
BEGIN_MESSAGE_MAP(CLayerTree, CTreeCtrl)
//{{AFX_MSG_MAP(CLayerTree)
ON_WM_CREATE()
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdraw)
ON_NOTIFY_REFLECT(TVN_BEGINDRAG, OnBegindrag)
ON_NOTIFY_REFLECT(TVN_KEYDOWN, OnKeydown)
//ON_WM_PAINT()
ON_NOTIFY_REFLECT(TVN_ITEMEXPANDED, OnItemexpanded)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
...is going to completely ruin your day when a bug appears. Why? Because this code is not expected in the middle of a supposedly object oriented program, it is not intuitive what is going on here, or why you are doing it.
Going further, if you ever want to change the way a control looks, you wind up with code that looks something like this:
NMCUSTOMDRAW nmcd = *(LPNMCUSTOMDRAW)pNMHDR;
if ( nmcd.dwDrawStage == CDDS_PREPAINT )
{
*pResult = CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT;
return;
}
What was that? NMCUSTOMDRAW? LPNMCUSTOMDRAW? CDRF_NOTIFYITEMDRAW? I don't know what that means without a walk over to www.msdn.com , I've looked them up before but for some reason long lists of random capital letters don't stick in my head too well, and they shouldn't have to. Let's have a look at this superior product's documentation, shall we? Here is the opening to the NMCUSTOMDRAW documentation at msdn:
NMCUSTOMDRAW Structure
Contains information specific to an NM_CUSTOMDRAW notification message.
Syntax
typedef struct tagNMCUSTOMDRAWINFO {
NMHDR hdr;
DWORD dwDrawStage;
HDC hdc;
RECT rc;
DWORD_PTR dwItemSpec;
UINT uItemState;
LPARAM lItemlParam;
} NMCUSTOMDRAW, *LPNMCUSTOMDRAW;
Jeez, thanks Bill. That's some informative stuff you got there. I really enjoy wasting 99% of development time going through infinite loops of long random capital random letters.
-Fredric