What I usually do is make a global array of window handles and assign into it from the CreateWindow() calls. I also save the HINSTANCE parameter from the WinMain globally. It saves a lot of time and code figuring these things out on the fly.
Code:
HINSTANCE PgmInst; // global instance handle
HWND Wind[10]; // global window handles
//create windows
// main window
Wind[0] = CreateWindowEx(WS_EX_CONTROLPARENT | WS_EX_APPWINDOW,
RMC_CLASS,L"Remote Media Client",
WS_TILED | WS_SYSMENU | WS_MINIMIZEBOX,// | WS_VISIBLE,
CW_USEDEFAULT,CW_USEDEFAULT,500,400,NULL,NULL,PgmInst,NULL);
Wind[1] = CreateWindow(L"BUTTON",L" Server ",
WS_CHILD | WS_VISIBLE |
BS_GROUPBOX,
10,5,180,182,Wind[0],NULL,PgmInst,NULL);
Wind[2] = CreateWindow(L"COMBOBOX",NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
CBS_DROPDOWNLIST | CBS_SORT,
20,20,160,100,Wind[0],(HMENU)100,PgmInst,NULL);
SendMessage(Wind[2],CB_SETEXTENDEDUI,1,0);
// etc.