I have a dialog box and, because I need the controls to be aligned by pixels rather than by dialog box units, when I initialize the dialog box for every control I do something similar to this: SetWindowPos(GetDlgItem(hDlg, CONT_Tabs), hDlg, 12, 25, 120, 186, SWP_SHOWWINDOW);
However, for some reason, all the controls in the dialog are invisible. Are the X and Y coordinates relative the screen 0,0 rather than my dialog client area 0,0? Why are all the controls invisible?
OK, now I feel like an idiot...it works the first time but then later when I want to move the control to a different location, it turns invisible again:
1 2 3 4 5 6 7
LONG GetWinTop(HWND hWnd)
{
RECT Rect;
GetWindowRect(hWnd, &Rect);
return(Rect.top);
}
#define GWT(CONT) GetWinTop(GetDlgItem(hDlg, CONT))
SetWindowPos(GetDlgItem(hDlg, CONT_Tabs), NULL, 12, GWT(CONT_Tabs) + (Show ? 2 : -2), 0, 0, SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOSIZE);Show is a bool.
I am almost certain I am doing something wrong that is a simple fix, however I can't see it...
EDIT: OK, problem solved, I was assuming that GetWinRect was relative to the parent window rect, which I now see is a bad idea. Code working like it should (in terms of the windows programming, that is...)