请问如何实现在同一程序众,一个窗口总在另一个窗口之上?不是在所有窗口之上。比如用VB的时候,查找替换窗口那样。

解决方案 »

  1.   

    Option Explicit
    Private Declare Function SetWindowPos Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal cx As Long, ByVal cy As Long, _
    ByVal wFlags As Long) As LongConst HWND_TOPMOST = -1
    Const SWP_SHOWWINDOW = &H40API函数
      

  2.   

    比如有两个form,要让form2打开的时候始终在form1上面那么在form1里边加上form2.show 1 就可以了
      

  3.   

    怎么没人看我的回答   form1.show vbmodeless, meme是主窗体,form1是你要悬浮的那个。
      

  4.   

    o,偶知道了,你的意思是form2在form1之上,但是还能编辑form1是吧,这个问题有意思,再帮你顶!
      

  5.   

    哦, xiaoyvr(绿草)说的对,极度同意 xiaoyvr(绿草)
      

  6.   

    比如有两个form,要让form2打开的时候始终在form1上面那么在form1里边加上form2.show 1 就可以了
    _________________________________________这么写也可以,form2.show vbmodal,me
    1代表的就是vbmodal
      

  7.   

    Option Explicit
    Private Declare Function SetWindowPos Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal cx As Long, ByVal cy As Long, _
    ByVal wFlags As Long) As LongConst HWND_TOPMOST = -1
    Const SWP_SHOWWINDOW = &H40
    SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
      

  8.   

    frm子窗体.Show vbModeless, frm父窗体