Is there any way(if is, please suggest something 🙂 ) to create window inside another one that fills it and always be 100% width,height and stay always in same position as parent? In few words, create window that will act(size and movement) same as parent window. For now I have this:
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW,L"Class", L"Title",WS_VISIBLE | WS_POPUP,
0, 0, 0, 0,hParent, NULL, GetModuleHandle(NULL), NULL );
and I’m checking WM_SIZE or WM_WINDOWPOSCHANGING for size change inside CallWndRetProc.
if(msg->message == WM_WINDOWPOSCHANGING && msg->hwnd == hParent){
WINDOWPOS* pos = (WINDOWPOS*)msg->lParam;
SetWindowPos(hWnd, 0, pos->x, pos->y, pos->cx, pos->cy, SWP_NOACTIVATE);
}
But there’s problem, pos has coordinates relative to the hParents window and SetWindowPos sets position relative to the whole screen. Maybe there is easier way to hold hWnd window on same position as hParent?
You can use GetWindowInfo() to query the current screen position of the window. Using this, you can calculate the desired screen position from the relative coordinates