如何让我的应用程序跳到其它应用程序的前面?

来源:百度知道 编辑:UC知道 时间:2024/06/27 21:52:25
我想让我的应用程序自动跳到其它应用程序的前面?
有没有这样的api,让我调用,最好是兼容winxp的。
谢谢
但是不要置顶,因为想要后面还能切换到别的应用程序

我用了hWndInsertAfter = 0 试了,但只能在状态栏里一闪一闪的,跳不出我的窗口

有的改变窗体顺序可以用 SetWindowPos 这个API函数就可以让窗体置顶.

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 Long

Private Sub Form_Load()
SetWindowPos Form1.hwnd, -1, 0, 0, 0, 0, 3
End Sub

这样就不会被覆盖了