一个关于VB编程的菜鸟级问题

来源:百度知道 编辑:UC知道 时间:2024/06/10 15:10:20
我希望让我编写的程序始终保持在其他窗口的上方 能办到吗~?
比如我运行我编写的程序 然后打开photoshop最大化 并且正常操作
还能让我编写的程序保持在Photoshop上面
高手帮帮我吖`....

'加入以下代码:
'声明
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 topview = -1

Private Sub Form_Load()
'窗体Form 始终保持在其他窗口的上方
SetWindowPos Me.hwnd, topview, _
Me.Left \ Screen.TwipsPerPixelX, _
Me.top \ Screen.TwipsPerPixelY, _
Me.Width \ Screen.TwipsPerPixelX, _
Me.Height \ Screen.TwipsPerPixelY, 0
End Sub

复制下面代码即可

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)

Private Sub Form1_Load()
SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
End Sub

Public Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAf