the goal is to center a windows after it is created.
in my function (look below) I ask a program to open a window for me.
After that I want to wait to be sure that the window was created
because I want to center that window.
the first time I do the operation the
creation is not too fast, so the window
is not centered because it shows up after
the window has been created. Look at my
code please and tell me where I'm wrong.
Thanks for your help.
WinExecAndWait32(getCMFullPath + 'bin\' + cmTaskToExecute + filename, 0, MustWait);
//the process is launched but sometimes the window does not come to top Z-buffer
//so we do it by hand.
if CenterWindow then
//to center a window we need to get a handle on it, the problem is that
//when we search for the handle the windows is still not created
//so we first need to wait for the window to appear
//but maybe that window will never be created because of an error for eg
//so we have to setup a timeout
tickStart := GetTickCount;
if not WindowExist(WindowName) then
//showmessage('not found' + WindowName);
if WindowExist(WindowName) then
until ((GetTickCount - tickStart) < TimeOutWaitForWindow);
//showmessage('go for center !');
//show the message view after each operation
if ShowMessageView then