Rhyono Posted December 4, 2012 Share Posted December 4, 2012 Using #include <ScreenCapture.au3> $MGP = MouseGetPos() $hBitmap = _ScreenCapture_Capture("",$MGP[0]-3,$MGP[1],$MGP[0]+24,$MGP[1]+31,True) I believe I'm properly getting an oversized, custom mouse cursor, but how would I then use PixelGetColor or another method to look at the pixels of that image? I do not want to save it. Link to comment Share on other sites More sharing options...
Xandy Posted December 4, 2012 Share Posted December 4, 2012 (edited) Can you make some sense of this? I think this is the idea you are after. $hscreen= _ScreenCapture_Capture("",$MGP[0]-3,$MGP[1],$MGP[0]+24,$MGP[1]+31,True) $hbmpscreen= _GDIPlus_BitmapCreateFromHBITMAP($hscreen) ;free the handle _WinAPI_DeleteObject($hscreen) for $y= 0 to $h for $x= 0 to $w if _GDIPlus_BitmapGetPixel($hbmpscreen, $x, $y)= $pixelcolor then $pixelmatch+= 1 endif next next _GDIPlus_BitmapDispose($hbmpscreen) Get GDIP here (gdiPlus) Edited December 4, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Rhyono Posted December 5, 2012 Author Share Posted December 5, 2012 (edited) When my code wasn't working right, I turned to the example of _GDIPlus_BitmapGetPixel, modified the code, and... #include <GDIP.au3> #include <ScreenCapture.au3> Opt("MustDeclareVars", 1) _Example() Func _Example() Local $hBmp, $hBitmap, $iColor, $MGP ; Pause Sleep(3000) ; Initialize GDI+ _GDIPlus_Startup() $MGP = MouseGetPos() $hBmp = _ScreenCapture_Capture("",$MGP[0]-3,$MGP[1],$MGP[0]+24,$MGP[1]+31,True) ; Create GDI+ Bitmap object from GDI Bitmap object $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $iColor = _GDIPlus_BitmapGetPixel($hBitmap, 10, 14) MsgBox(0x40, "Color", "Bitmap Pixel Color at [10, 14] is: 0x" & Hex($iColor,6)) ; Clean up _GDIPlus_ImageDispose($hBitmap) _WinAPI_DeleteObject($hBmp) ; Uninitialize GDI+ _GDIPlus_Shutdown() EndFunc There we go. Edited December 5, 2012 by Rhyono Xandy 1 Link to comment Share on other sites More sharing options...
Xandy Posted December 5, 2012 Share Posted December 5, 2012 (edited) #include <ScreenCapture.au3> #include <GDIP.au3> _gdiplus_startup() Sleep(3000) $MGP = MouseGetPos() $hscreen= _ScreenCapture_Capture("",$MGP[0]-3,$MGP[1],$MGP[0]+24,$MGP[1]+31,True) $hbmpscreen= _GDIPlus_BitmapCreateFromHBITMAP($hscreen) ;free the handle _WinAPI_DeleteObject($hscreen) $color = _GDIPlus_BitmapGetPixel($hbmpscreen, 10, 14); MsgBox(0,"",Hex($color,6)); _GDIPlus_BitmapDispose($hbmpscreen) _GDIPlus_ShutDown () returns msgbox F0F4F9 for me on XP 32bit on vista and win_7 you may need to compile then tell the exe to run in compatibly mode for XP and disable the desktop composition in the comparability tab. Those are things that I have done in the past for pixel detection. Edited December 5, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now