bool test;
test = MoveWindow((HWND)ID_static1, 0, 0, 800, 800, true);
I have searched all over Google for a solution, but the topics about MoveWindow() are all different.
Please assist : - )
EDIT: recompiled it and now it returns 0.
MoveWindow() function
I do not understand why the following code returns 1, even though I see no change on the screen:
Quote:Original post by brechtjahIt succeeds because (HWND)ID_static1 happens to evaluate to a valid window handle, but it's not the one you want - you should always be wary of casts, if you need one it's usually a sign that something isn't expected.
I do not understand why the following code returns 1, even though I see no change on the screen:bool test;test = MoveWindow((HWND)ID_static1, 0, 0, 800, 800, true);
In this case, you want to use the GetDlgItem() function (Assuming you have a dialog with ID_static1 as an item on it). E.g.:
test = MoveWindow(GetDlgItem(hDlg, ID_static1), 0, 0, 800, 800, true);
Where hDlg is the handle to the parent dialog box.
Quote:Original post by brechtjahIf in doubt, The MSDN is the most likely to be correct.
I have searched all over Google for a solution, but the topics about MoveWindow() are all different.
Please assist : - )
Quote:Original post by brechtjahFrom the Documentation:
But I'm not using dialogs, it's a static control in my main window.
Quote:You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window.Or, just use the HWND from CreateWindow[Ex] directly.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement