Guest User

Crossfire Menu VB Flickers

a guest
Oct 21st, 2013
2,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. Module1 - Holds Item Properties (PUBLIC for Form1)
  2.  
  3. Module MenuItems
  4. Public Item1 As String = "WallHack;off"
  5. Public brushcoloritem1 As Brush = Brushes.White
  6. Public Item2 As String = "NoRecoil;off"
  7. Public brushcoloritem2 As Brush = Brushes.Red
  8. Public Item3 As String = "NoReload;off"
  9. Public brushcoloritem3 As Brush = Brushes.Red
  10. Public Item4 As String = "SpeedHack;off"
  11. Public brushcoloritem4 As Brush = Brushes.Red
  12. End Module
  13.  
  14.  
  15.  
  16. Form1
  17.  
  18. Public Class Form1
  19. Private Declare Function InvalidateRect Lib "user32" (ByVal hwnd As IntPtr, ByVal lpRect As IntPtr, ByVal bErase As Boolean) As Boolean
  20. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As IntPtr) As IntPtr
  21. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
  22.  
  23. Dim MenuWidth As Integer = 365
  24. Dim MenuHeight As Integer = 125
  25. Dim MenuIndex As Integer = 1
  26. Dim MenuItemSpaces As Integer = 5
  27.  
  28. Public selectedbrush As Brush = Brushes.White
  29. Public nonselectedbrush As Brush = Brushes.Red
  30.  
  31. Private Sub update_menu()
  32. Dim TargetProcess As Process() = Process.GetProcessesByName("Crossfire")
  33. If TargetProcess.Length = 1 Then
  34. Else
  35. DrawMenuBorder(10, 10, Pens.Red, MenuWidth, MenuHeight)
  36. DrawTitle(10, 10, "LucasHeer715 Menu V1.0", Brushes.Red, 25)
  37. MenuItemSpaces += 40
  38. DrawString(10, MenuItemSpaces, Item1.Split(";")(0), brushcoloritem1, 15)
  39. DrawString(320, MenuItemSpaces, Item1.Split(";")(1), brushcoloritem1, 15)
  40. MenuItemSpaces += 20
  41. DrawString(10, MenuItemSpaces, Item2.Split(";")(0), brushcoloritem2, 15)
  42. DrawString(320, MenuItemSpaces, Item2.Split(";")(1), brushcoloritem2, 15)
  43. MenuItemSpaces += 20
  44. DrawString(10, MenuItemSpaces, Item3.Split(";")(0), brushcoloritem3, 15)
  45. DrawString(320, MenuItemSpaces, Item3.Split(";")(1), brushcoloritem3, 15)
  46. MenuItemSpaces += 20
  47. DrawString(10, MenuItemSpaces, Item4.Split(";")(0), brushcoloritem4, 15)
  48. DrawString(320, MenuItemSpaces, Item4.Split(";")(1), brushcoloritem4, 15)
  49. MenuItemSpaces = 5
  50. End If
  51. End Sub
  52.  
  53. Private Sub DrawMenu_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrawMenu.Tick
  54. update_menu()
  55. End Sub
  56.  
  57. Private Sub DrawTitle(ByVal X As Integer, ByVal Y As Integer, ByVal TextI As String, ByVal brush As Brush, ByVal fontsize As Integer)
  58. Dim Crossfire As Graphics = Graphics.FromHwnd(New IntPtr(FindWindow("CrossFire", "CrossFire")))
  59. Dim MenuTitle As Font
  60. MenuTitle = New System.Drawing.Font("Times", fontsize, FontStyle.Regular)
  61. Crossfire.DrawString(TextI, MenuTitle, brush, X, Y)
  62. SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  63. DoubleBuffered = True
  64. Crossfire.Dispose()
  65. End Sub
  66.  
  67. Private Sub DrawString(ByVal X As Integer, ByVal Y As Integer, ByVal TextI As String, ByVal brush As Brush, ByVal fontsize As Integer)
  68. Dim Crossfire As Graphics = Graphics.FromHwnd(New IntPtr(FindWindow("CrossFire", "CrossFire")))
  69. Dim MenuItem As Font
  70. MenuItem = New System.Drawing.Font("Times", fontsize, FontStyle.Regular)
  71. Crossfire.DrawString(TextI, MenuItem, brush, X, Y)
  72. SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  73. DoubleBuffered = True
  74. Crossfire.Dispose()
  75. End Sub
  76.  
  77. Private Sub drawmenuinside(ByVal X As Integer, ByVal Y As Integer, ByVal Color As Brush, ByVal Width As Integer, ByVal Height As Integer)
  78. Dim Crossfire As Graphics = Graphics.FromHwnd(New IntPtr(FindWindow("CrossFire", "CrossFire")))
  79. Crossfire.FillRectangle(Color, X, Y, Width, Height)
  80. SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  81. DoubleBuffered = True
  82. Crossfire.Dispose()
  83. End Sub
  84.  
  85. Private Sub DrawMenuBorder(ByVal X As Integer, ByVal Y As Integer, ByVal Color As Pen, ByVal Width As Integer, ByVal Height As Integer)
  86. Dim Crossfire As Graphics = Graphics.FromHwnd(New IntPtr(FindWindow("CrossFire", "CrossFire")))
  87. Crossfire.DrawRectangle(Color, X, Y, Width, Height)
  88. SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  89. DoubleBuffered = True
  90. Crossfire.Dispose()
  91. End Sub
  92.  
  93. Private Sub Hotkeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick
  94. Dim up As Boolean = False
  95. Dim down As Boolean = False
  96. Dim left As Boolean = False
  97. Dim right As Boolean = False
  98.  
  99. up = GetAsyncKeyState(Keys.Up)
  100. down = GetAsyncKeyState(Keys.Down)
  101. left = GetAsyncKeyState(Keys.Left)
  102. right = GetAsyncKeyState(Keys.Right)
  103.  
  104. If (up = True) Then
  105. If (MenuIndex = 1) Then
  106. Else
  107. MenuIndex -= 1
  108. End If
  109. System.Threading.Thread.Sleep(300)
  110. ElseIf (down = True) Then
  111. If (MenuIndex = 4) Then
  112. Else
  113. MenuIndex += 1
  114. End If
  115. System.Threading.Thread.Sleep(300)
  116. ElseIf (left = True) Then
  117. If (MenuIndex = 1) Then
  118. Item1 = "WallHack;off"
  119. ElseIf (MenuIndex = 2) Then
  120. Item2 = "NoRecoil;off"
  121. ElseIf (MenuIndex = 3) Then
  122. Item3 = "NoReload;off"
  123. ElseIf (MenuIndex = 4) Then
  124. Item4 = "SpeedHack;off"
  125. End If
  126. ElseIf (right = True) Then
  127. If (MenuIndex = 1) Then
  128. Item1 = "WallHack;on"
  129. ElseIf (MenuIndex = 2) Then
  130. Item2 = "NoRecoil;on"
  131. ElseIf (MenuIndex = 3) Then
  132. Item3 = "NoReload;on"
  133. ElseIf (MenuIndex = 4) Then
  134. Item4 = "SpeedHack;on"
  135. End If
  136. End If
  137. End Sub
  138.  
  139. Private Sub SelectionChanged_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectionChanged.Tick
  140. If (MenuIndex = 1) Then
  141. brushcoloritem1 = selectedbrush
  142. brushcoloritem2 = nonselectedbrush
  143. brushcoloritem3 = nonselectedbrush
  144. brushcoloritem4 = nonselectedbrush
  145. ElseIf (MenuIndex = 2) Then
  146. brushcoloritem1 = nonselectedbrush
  147. brushcoloritem2 = selectedbrush
  148. brushcoloritem3 = nonselectedbrush
  149. brushcoloritem4 = nonselectedbrush
  150. ElseIf (MenuIndex = 3) Then
  151. brushcoloritem1 = nonselectedbrush
  152. brushcoloritem2 = nonselectedbrush
  153. brushcoloritem3 = selectedbrush
  154. brushcoloritem4 = nonselectedbrush
  155. ElseIf (MenuIndex = 4) Then
  156. brushcoloritem1 = nonselectedbrush
  157. brushcoloritem2 = nonselectedbrush
  158. brushcoloritem3 = nonselectedbrush
  159. brushcoloritem4 = selectedbrush
  160. End If
  161. End Sub
  162. End Class
Advertisement
Add Comment
Please, Sign In to add comment