HWND CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock) { PTRAY_NOTIFY_WND_DATA TnData; HWND hWndTrayWindow; HWND hWnd = NULL; hWndTrayWindow = ITrayWindow_GetHWND(TrayWindow); if (hWndTrayWindow == NULL) return NULL; TnData = HeapAlloc(hProcessHeap, 0, sizeof(*TnData)); if (TnData != NULL) { ZeroMemory(TnData, sizeof(*TnData)); TnData->TrayWindow = TrayWindow; TnData->HideClock = bHideClock; /* Create the window. The tray window is going to move it to the correct position and resize it as needed. */ hWnd = CreateWindowEx(WS_EX_STATICEDGE, szTrayNotifyWndClass, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, hWndTrayWindow, NULL, hExplorerInstance, (LPVOID)TnData); if (hWnd == NULL) { HeapFree(hProcessHeap, 0, TnData); } } return hWnd; }
static HRESULT STDMETHODCALLTYPE ITaskBandImpl_GetWindow(IN OUT IDeskBand *iface, OUT HWND *phwnd) { ITaskBandImpl *This = ITaskBandImpl_from_IDeskBand(iface); /* NOTE: We have to return the tray window here so that ITaskBarClient knows the parent window of the Rebar control it creates when calling ITaskBarClient::SetDeskBarSite()! However, once we created a window we return the task switch window! */ if (This->hWnd != NULL) *phwnd = This->hWnd; else *phwnd = ITrayWindow_GetHWND(This->Tray); DbgPrint("ITaskBand::GetWindow(0x%p->0x%p)\n", phwnd, *phwnd); if (*phwnd != NULL) return S_OK; return E_FAIL; }