我在程序中,需要将该form置顶(FormStyle:=fsStayOnTop),或则是恢复平常的样子(FormStyle:=fsNormal)
我的问题是,假如我在按扭的单圾事件中写FormStyle:=fsStayOnTop,但是原来Form默认的是FormStyle:=fsNormal,然后,我改变他,
出现下面的错误“
Project raised excption calss EAccessViolation with message 'Access voilation at address 7687da5c in module 'shdocvw.dll'. Read of address 00000000'.
不知道为什么,当然如果写在Form的Create事件中,是可以的。
但是我想在建立后,动态的改变。
各位大哥,帮帮小弟呀?

解决方案 »

  1.   

    FormStyle := fsStayOnTop和FormStyle := fsNormal
    这样写是正确的,出现的错误不是这个引起的。不信你可以建一个只有一个Button的新project测试一下。
      

  2.   

    SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);   //置顶
    SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);  //正常
      

  3.   

    同意13193887977(钟情BCB) ,利用API。