vb切换到进程
Dim a As Long
a = FindWindow(vbNullString, "开料单") '查找句柄
ShowWindow a, 0 '由于找不到窗口最前的代码
ShowWindow a, 1 '所以把游戏隐藏再显示一遍,游戏就在最前了
=============================================================
'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
Private mbOnTop As Boolean
Private Property Let OnTop(Setting As Boolean)
If Setting Then
SetWindowPos hwnd, -1, 0, 0, 0, 0, &H2 Or &H1
Else
SetWindowPos hwnd, -2, 0, 0, 0, 0, &H2 Or &H1
End If
mbOnTop = Setting
End Property
Private Sub Form_Load()
OnTop = True
End Sub
'你想用的时候
'写上 ontop=true 'vb把此程序总是放到最前
'不想用的时候
'写上 OnTop =False '取消
_____________________________________________________________________________ _
中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/ |