I've started working on win32 programming, and have a question regarding hwnds. I've milled over tutorials and they seem to vary - I've tried using the following 3 methods, but was wondering which, if any, is preferred?


Code:
...
static HWND hwnd1 = 0;
...
WM_CREATE :
    hwnd1 = CreateWindow(...);
...
Code:
HWND function(...)
{    
    return CreateWindow(...);
}
Code:
#define IDC_CONTROL 1001
...
WM_CREATE :
    CreateWindow(..., IDC_CONTROL, ...);
...

SendMessage(GetDlgItem(hwnd_parent, IDC_CONTROL), ...);
TIA