I have written a program which should move a hidden window, and when a user sends a specific command it should show the window at the new position. Here is how the window is created:
invoke CreateWindowEx,WS_EX_CLIENTEDGE+WS_EX_TOPMOST+WS_EX_TOOLWINDOW,\
ADDR ClassName,\
ADDR AppName,\
WS_ICONIC+WS_SYSMENU,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
219,234,NULL,NULL,hInst,NULL
So for the first time, the window is placed at the CW_USEDEFAULT position and hidden. After the user sends the command, the WM_COMMAND message handler moves the window using the following code:
invoke MoveWindow,hWnd,eax,edx,219,234,TRUE
The eax and edx values are ok. I have checked them using a debugger.
So, after that, I show the window:
invoke ShowWindow,hWnd,SW_RESTORE
This works fine except for the first time the window is shown. The first time, my window stays at the CW_USEDEFAULT position although it is moved using the MoveWindow function.
Does anybody has an idea about what could be wrong here?
Check the return value of MoveWindow.
maybe you can try the SetWindowPlacement function,
possibly the MoveWindow function fails if the window
is iconic.
Thanks! Here we close this topic.