API 
SetWindowpos
 
http://ygyuan.go.163.com/
http://ygyuan.3322.net/

解决方案 »

  1.   

    同http://www.csdn.net/expert/topic/598/598490.xml?temp=.711117
    将窗口置于最上面
    Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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 LongSetWindowPos(frm.hwnd,-1,0,0,0,0,3) 
     
      

  2.   


    那岂不是要自制一个对话框?我只想将Msgbox产生的对话框放在最前面.可行吗?
      

  3.   

    vb有对话框窗体模板。用不了费多大劲。
    加入一个对话窗窗体,可多次调用。
    把代码粘贴进去即可。
    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 Long
    Const HWND_TOPMOST = -1
    Const SWP_SHOWWINDOW = &H40Private Sub Form_load()
      Dim retValue As Long
      retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX,     
      Me.CurrentY, 300, 300, SWP_SHOWWINDOW)
    End Sub
      

  4.   

    给你一个完整的示例:
    建立一个工程,然后输入下面的代码即可: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 LongPrivate Sub Command1_Click()
      SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
    End Sub
      

  5.   

    When dialog created by msgbox is showing,user can not switch to another form.
    so i think you'd better use API function:SetWindowPos.