C and WinAPI: hwnd question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divideby0
    New Member
    • May 2012
    • 131

    C and WinAPI: hwnd question

    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
Working...