回覆列表
-
1 # 紅淚偷垂南巷似水浮生
-
2 # pzyyo24296
新建工程,搞一個計時器(1000毫秒間隔)和一個文字框。程式碼:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate 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 LongDim WndHandel As LongPrivate Sub Form_Load()"WndHandel = FindWindow(vbNullString, "QQ") "透過標題名查詢標題名WndHandel = FindWindow("AfxFrameOrview42", vbNullString) "透過類名查詢,這裡示例類是:AfxFrameOrview42------是按鍵精靈7廣告的類名"輸入與視窗名字一模一樣的字串Text1 = WndHandel "如果Text1為0,則說明輸入字串有誤,未找到視窗End SubPrivate Sub Timer1_Timer()SetWindowPos WndHandel, -1, 0, 0, 0, 0, &H80End Sub
c#的Form1跳到Form2是Form2form=newForm2();form.Show();this.Hide();VB的PrivateSubForm_Click()Form1.ShowForm2.HideEndSub