2014年3月23日 星期日

【VB6】好用的模組(遊戲置頂、隱藏遊戲)

這是我寫的模組 怎麼使用應該不用我說



Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
                                                                      ByVal lpWindowName As String) As Long
Private nhwnd As Long

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 As Long = -1
Const HWND_NOTOPMOST As Long = -2


Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
                                                  ByVal nCmdShow As Long) As Long
Const SW_SHOW As Long = 5
Const SW_HIDE As Long = 0


Public Sub HideGame()
ShowWindow nhwnd, SW_HIDE '隱藏遊戲
End Sub

Public Sub ShowGame()
ShowWindow nhwnd, SW_SHOW '回復正常
End Sub

Public Sub GameTOP()
SetWindowPos nhwnd, HWND_TOPMOST, 0, 0, 0, 0, 3  '遊戲置頂
End Sub
Public Sub GameNOTOP()
SetWindowPos nhwnd, HWND_NOTOPMOST, 0, 0, 0, 0, 3 '解除置頂
End Sub

Public Sub FINDGAME()
nhwnd = FindWindow(vbNullString, "MapleStory")
End Sub





沒有留言:

張貼留言