Advertisement
Guest User

PW Map

a guest
Jul 19th, 2010
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.41 KB | None | 0 0
  1. #NoTrayIcon
  2. #include <NomadMemory.au3>
  3. #include <GDIPlus.au3>
  4.  
  5. $vWinTitle = "PW Map"
  6. $vBase = 10437900
  7. $vBaseOffset = 32
  8. $vXOffset = 60
  9. $vYOffset = 68
  10. $bTimer = True
  11. $vRefreshTime = 2000
  12. $vDotSize = 6
  13.  
  14. $hGuiMain = GUICreate($vWinTitle, 986, 743)
  15. $hGuiPic = GUICtrlCreatePic("", 0, 0, 985, 742)
  16. GUISetState(@SW_SHOW)
  17.  
  18. _PWM_Refresh()
  19.  
  20. While 1
  21.     If GUIGetMsg() = -3 Then Exit
  22.  
  23.     If $bTimer = True Then
  24.         $vTimer = TimerInit()
  25.         $bTimer = False
  26.     EndIf
  27.     If TimerDiff($vTimer) >= $vRefreshTime Then
  28.         _PWM_Refresh()
  29.         $bTimer = True
  30.     EndIf
  31.  
  32.     $vCurInfo = GUIGetCursorInfo($hGuiMain)
  33.     If WinActive($hGuiMain) And $vCurInfo[4] = 3 Then
  34.         WinSetTitle($hGuiMain,"",$vWinTitle & " --- X: " & Round($vCurInfo[0] * 1.52 - 348) & " - Y: " & Round(-($vCurInfo[1] * 1.52 - 1116)))
  35.     EndIf
  36. WEnd
  37.  
  38. Func _PWM_Refresh()
  39.     _GDIPlus_Startup()
  40.     $hBitmap = _GDIPlus_ImageLoadFromFile("pwmap.bmp")
  41.     $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
  42.     $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
  43.     $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
  44.     $vList = WinList("[CLASS:ElementClient Window]")
  45.     For $i = 1 To $vList[0][0]
  46.         $vProcess = WinGetProcess($vList[$i][1])
  47.         $vOpen = _MemoryOpen(WinGetProcess($vList[$i][1]))
  48.         $vRead = _MemoryRead($vBase, $vOpen) + $vBaseOffset
  49.         $vMemX = _MemoryRead(_MemoryRead($vRead,$vOpen) + $vXOffset,$vOpen,"float")
  50.         $vMemY = _MemoryRead(_MemoryRead($vRead,$vOpen) + $vYOffset,$vOpen,"float")
  51.         $vX = Round(((($vMemX+4000)/10)+348)/1.52,2)
  52.         $vY = Round((-(($vMemY+5500)/10)+1116)/1.52,2)
  53.         _MemoryClose($vOpen)
  54.         _GDIPlus_GraphicsFillEllipse($hGraphic, $vX, $vY, $vDotSize, $vDotSize, $hBrush)
  55.         _GDIPlus_GraphicsDrawEllipse($hGraphic, $vX, $vY, $vDotSize, $vDotSize, $hPen)
  56.     Next
  57.     $hNewBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
  58.     _PWM_SetBitmapToCtrl($hGuiPic, $hNewBitmap)
  59.     _GDIPlus_BitmapDispose($hBitmap)
  60.     _GDIPlus_GraphicsDispose($hGraphic)
  61.     _GDIPlus_PenDispose($hBrush)
  62.     _GDIPlus_BrushDispose($hPen)
  63.     _WinAPI_DeleteObject($hNewBitmap)
  64.     _GDIPlus_Shutdown()
  65. EndFunc
  66.  
  67. ;Set a bitmap to a control - by Zedna
  68. Func _PWM_SetBitmapToCtrl($vCtrlID, $hBitmap)
  69.     Local $hWnd = GUICtrlGetHandle($vCtrlID)
  70.     If $hWnd = 0 Then Return SetError(1, 0, 0)
  71.  
  72.     Local $vOldStyle = _WinAPI_GetWindowLong($hWnd, -16)
  73.     _WinAPI_SetWindowLong($hWnd, -16, BitOR($vOldStyle, 0xE))
  74.  
  75.     Local $vOldBmp = _SendMessage($hWnd, 0x0172, 0, $hBitmap)
  76.     If $vOldBmp <> 0 Then _WinAPI_DeleteObject($vOldBmp)
  77. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement