| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 358 人关注过本帖
标题:CF 准星 如何实现窗口化--白色鼠标一直跟着准星无法游戏
只看楼主 加入收藏
nrqxuanlv
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-12-21
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
CF 准星 如何实现窗口化--白色鼠标一直跟着准星无法游戏
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) 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 SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Private Const HWND_TOP = 0
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1


Dim rtn As Long
Dim X0 As Long
Dim Y0 As Long

Private Sub Form_Load()
Form2.Show
Me.AutoRedraw = True
Me.BackColor = vbBlack
Me.ForeColor = vbRed

Me.Line (Me.ScaleWidth / 2 - 50, Me.ScaleHeight / 2)-(Me.ScaleWidth / 2 + 50, Me.ScaleHeight / 2)
Me.Line (Me.ScaleWidth / 2, Me.ScaleHeight / 2 - 50)-(Me.ScaleWidth / 2, Me.ScaleHeight / 2 + 50)

rtn = GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes Me.hwnd, vbBlack, 180, LWA_COLORKEY Or LWA_ALPHA
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
End Sub


Private Sub Form_Resize() '设置窗体出现在屏幕中央

'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0

End Sub




Private Sub Timer1_Timer()
If MyHotKey(vbKeyF8) Then
Unload Me
Load Me
Me.Show
Load Me
Me.Move X0 - 10, Y0 - 10
End If
If MyHotKey(vbKeyF9) Then
Me.Hide
End If
If MyHotKey(vbKeyF10) Then Unload Me
End Sub
================模块====================

Public Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vkey As Long) As Integer

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
搜索更多相关主题的帖子: 如何 游戏 
2013-12-21 18:23
nrqxuanlv
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-12-21
收藏
得分:0 
想学VB 想找个耐心点的老师 有酬……
2013-12-21 18:24
vbvcr51
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:18
帖 子:364
专家分:1724
注 册:2013-11-3
收藏
得分:20 
我可以试试。发站内信。
2013-12-22 13:37
快速回复:CF 准星 如何实现窗口化--白色鼠标一直跟着准星无法游戏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016008 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved