主题:[转帖]VB如何获取QQ登陆版本?在帮忙写个(急)
获取 机器上安装的QQ登陆器是多少版的·
一个COMMAND1按钮
打开 程序 检测电脑上是否安装了QQ 就获取QQ是多少版本·
单击COMMAND1
则判断,
IF 是2008版本登陆器 THEN
msgbox"你正在使用2008QQ登陆器“
else
if 是2008一下版本 THEN
msgbox "你使用的是" & 获取版本登陆器 比如是2005 & "使用的版本较旧"
就是这样 msgbox "你使用的是" & 2005QQ登陆器 & "使用的版本较旧"
en dif
if 是2008以上的版本 then
msgbox "你使用的是" & 获取版本登陆器 比如是2009或者2010 & "使用的版本是最新版"
就是这样 msgbox "你使用的是" & 2009(或2010)QQ登陆器 & "使用的版本是最新版"
end if
高手帮忙··追分···急用啊··要代码···
这有个代码 参考·
Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds 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
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ShowWindow Lib "User32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetForegroundWindow Lib "User32" () As Long
Private Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SetForegroundWindow Lib "User32" (ByVal hwnd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_NOTOPMOST = -2
Private Const HWND_TOPMOST = -1
Private Const WM_NCACTIVATE = &H86
Const CB_SHOWDROPDOWN = &H14F
Dim ma As Long
Dim mx As Long, mi As Long, j As Integer
Private Sub Timer1_Timer()
If FindWindow(vbNullString, "QQ2009 Beta2") <> 0 Then '如果发现就隐藏它
ma = FindWindow(vbNullString, "QQ2009 Beta2") '获得QQ.EXE的窗口句柄
zhlm = "ATL:006CC4D0"
mill = "Edit"
mx = FindWindowEx(ma, 0, zhlm, vbNullString)
mi = FindWindowEx(ma, 0, mill, vbNullString)
If mx <> 0 And mi <> 0 Then
If j = 0 Then
Call ShowWindow(ma, 0)
j = 1
Me!Timer3.Enabled = True
End If
End If
End If
End Sub
Private Sub Timer2_Timer()
Me!Timer1.Enabled = True
End Sub
Private Sub Timer3_Timer()
If GetForegroundWindow <> Me.hwnd Then
msgbox ""
Me.SetFocus
End If
Me!Timer3.Enabled = False
End Sub
但要的不是这个效果··而是上面 的那个效果···
一个COMMAND1按钮
打开 程序 检测电脑上是否安装了QQ 就获取QQ是多少版本·
单击COMMAND1
则判断,
IF 是2008版本登陆器 THEN
msgbox"你正在使用2008QQ登陆器“
else
if 是2008一下版本 THEN
msgbox "你使用的是" & 获取版本登陆器 比如是2005 & "使用的版本较旧"
就是这样 msgbox "你使用的是" & 2005QQ登陆器 & "使用的版本较旧"
en dif
if 是2008以上的版本 then
msgbox "你使用的是" & 获取版本登陆器 比如是2009或者2010 & "使用的版本是最新版"
就是这样 msgbox "你使用的是" & 2009(或2010)QQ登陆器 & "使用的版本是最新版"
end if
高手帮忙··追分···急用啊··要代码···
这有个代码 参考·
Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds 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
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ShowWindow Lib "User32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetForegroundWindow Lib "User32" () As Long
Private Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SetForegroundWindow Lib "User32" (ByVal hwnd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_NOTOPMOST = -2
Private Const HWND_TOPMOST = -1
Private Const WM_NCACTIVATE = &H86
Const CB_SHOWDROPDOWN = &H14F
Dim ma As Long
Dim mx As Long, mi As Long, j As Integer
Private Sub Timer1_Timer()
If FindWindow(vbNullString, "QQ2009 Beta2") <> 0 Then '如果发现就隐藏它
ma = FindWindow(vbNullString, "QQ2009 Beta2") '获得QQ.EXE的窗口句柄
zhlm = "ATL:006CC4D0"
mill = "Edit"
mx = FindWindowEx(ma, 0, zhlm, vbNullString)
mi = FindWindowEx(ma, 0, mill, vbNullString)
If mx <> 0 And mi <> 0 Then
If j = 0 Then
Call ShowWindow(ma, 0)
j = 1
Me!Timer3.Enabled = True
End If
End If
End If
End Sub
Private Sub Timer2_Timer()
Me!Timer1.Enabled = True
End Sub
Private Sub Timer3_Timer()
If GetForegroundWindow <> Me.hwnd Then
msgbox ""
Me.SetFocus
End If
Me!Timer3.Enabled = False
End Sub
但要的不是这个效果··而是上面 的那个效果···