문제

I have a largish Delphi 6 app that I have ported to Delphi XE3. At one point the main form launches another non-modal form. Sometimes (say 50%) after a second or two the newly created form moves behind the main form. Even thought it is now at the back, the newly created form still has focus so there are no activate/deactivate events. There are a few Timer controls and I have disabled them. It still happens.

I can accept my code is doing this -- but how can I find out what is happening? Is there a way to intercept when then new form moves to the back?

Just to be clear: I want both forms to be used separately. Any of them can appear behind the other. What is happening at the moment is that the z-order seems to be changing.

도움이 되었습니까?

해결책

I have found the answer to this. I discovered I had added a CreateParams override that did this:

  // make a taskbar window
 inherited CreateParams( params );
 params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
 params.WndParent := GetDesktopwindow; // this line caused the problem

Commenting the WndParent solved it. The effect is bizarre though. It is as if there is a timer that goes off about a second after any key or mouse event that forces the window behind others. Thanks to David Heffernan whose comments about stepping CreateParam made me notice it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top