`stdWindow` - Improvements
sancarn opened this issue · 3 comments
sancarn commented
Change window owner
SetWindowLongPtr(GWL_HWNDPARENT, hwnd)
can be used to change the owner of a window. If SetWindowLongPtr(GWL_HWNDPARENT,0)
is used the owner is affectively removed, and the window is treated as it's own "top level application" in a sense. Where as SetWindowLongPtr(GWL_HWNDPARENT, Application.hwnd)
will make the window only appear when Application
is also visible.
Show menu bar buttons
Example:
Call SetWindowLong(hform, GWL_STYLE, existing Or WS_MINIMIZEBOX)
Call DrawMenuBar(hform)
Set icon of window
hIcon = Form.Image1.Picture.Handle
Call SendMessage(hwnd, WM_SETICON, ICON_SMALL, ByVal hIcon)
Call SendMessage(hwnd, WM_SETICON, ICON_BIG, ByVal hIcon)
Enable addition and removal of window from TaskBar maybe more relevant for stdCOM
...
Call CLSIDFromString(StrPtr(IID_PropertyStore), tIID)
If SHGetPropertyStoreForWindow(hform, tIID, pPstore) = S_OK Then
Call CLSIDFromString(StrPtr(CLSID_TASKLIST), tClsID)
Call CLSIDFromString(StrPtr(IID_TASKLIST3), tIID)
If CoCreateInstance(tClsID, 0, CLSCTX_INPROC_SERVER, tIID, pTBarList) = S_OK Then
SetProp Application.hwnd, "pTBarList", pTBarList
Call vtblCall(pTBarList, ITASKLIST3_HrInit, vbLong, CC_STDCALL) 'HrInit Method
Call vtblCall(pTBarList, ITASKLIST3_DeleteTab, vbLong, CC_STDCALL, hform) 'DeleteTab Method
Call vtblCall(pTBarList, ITASKLIST3_AddTab, vbLong, CC_STDCALL, hform) 'AddTab Method
Call vtblCall(pTBarList, ITASKLIST3_ActivateTab, vbLong, CC_STDCALL, hform) 'ActivateTab Method
If Len(ThumbnailTooltip) Then
Call vtblCall(pTBarList, ITASKLIST3_SetThumbnailTooltip, vbLong, CC_STDCALL, hform, StrPtr(ThumbnailTooltip)) 'ActivateTab Method
End If
End If
End If