Splash Posted February 10, 2009 Share Posted February 10, 2009 It's possible get a pixel color from a minimized window with the Windows API? I need this to make a game automation. Sorry my poor english, is not my primary language Thanks, Splash Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: Link to comment Share on other sites More sharing options...
Reyzor Posted February 10, 2009 Share Posted February 10, 2009 It's possible get a pixel color from a minimized window with the Windows API?I need this to make a game automation.Sorry my poor english, is not my primary language Thanks, SplashI need to know for my game too.. =( Link to comment Share on other sites More sharing options...
Marlo Posted February 10, 2009 Share Posted February 10, 2009 I'm not 100% sure but i think that if a window is hidden/minimized then you cannot retrieve the pixel color as the window has not been "drawn". There could be a way however but im just not aware of it. Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Reyzor Posted February 10, 2009 Share Posted February 10, 2009 I'm not 100% sure but i think that if a window is hidden/minimized then you cannot retrieve the pixel color as the window has not been "drawn". There could be a way however but im just not aware of it.Thanks, anyone have an ideia about it? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 10, 2009 Moderators Share Posted February 10, 2009 Thanks, anyone have an ideia about it?Something wrong with your search feature?http://www.autoitscript.com/forum/index.ph...xel%2BMinimized Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted February 10, 2009 Share Posted February 10, 2009 I'm not 100% sure but i think that if a window is hidden/minimized then you cannot retrieve the pixel color as the window has not been "drawn". There could be a way however but im just not aware of it.This is only true versions of windows before vista, nowadays with dwm everything is drawn all the time (well maybe not totally true, but at least when it's minimized), on xp it can be still be done with the PrintWindow function. This thread contains useful info:http://www.autoitscript.com/forum/index.php?showtopic=86061 Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 10, 2009 Moderators Share Posted February 10, 2009 (edited) This is only true versions of windows before vista, nowadays with dwm everything is drawn all the time (well maybe not totally true, but at least when it's minimized), on xp it can be still be done with the PrintWindow function. This thread contains useful info:http://www.autoitscript.com/forum/index.php?showtopic=86061Interesting enough... I heard Chris speak of the memory thing with Vista.However, the PrintWindow method you're speaking about with XP, still won't get the data from a minimized windows client area. It gets its taskbar window I believe. Edited February 10, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted February 10, 2009 Share Posted February 10, 2009 Interesting enough... I heard Chris speak of the memory thing with Vista.However, the PrintWindow method you're speaking about with XP, still won't get the data from a minimized windows client area. It gets its taskbar window I believe.Whose Chris? Nope, I think everything is copied, check the msdn page:http://msdn.microsoft.com/en-us/library/dd162869(VS.85).aspx Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 10, 2009 Moderators Share Posted February 10, 2009 (edited) Whose Chris? Nope, I think everything is copied, check the msdn page:http://msdn.microsoft.com/en-us/library/dd162869(VS.85).aspxIt says handle to the device context as the 2nd parameter. In XP the device context is not drawn other than the taskbar window when minimized. Edited February 10, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted February 10, 2009 Share Posted February 10, 2009 It says handle to the device context as the 2nd parameter. In XP the device context is not drawn other than the taskbar window when minimized.The DC does not belong to the window you're targeting, it's your dc with a bitmap selected into it. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 10, 2009 Moderators Share Posted February 10, 2009 (edited) The DC does not belong to the window you're targeting, it's your dc with a bitmap selected into it.Yeah, I tried that... Compatible DC from Bitmap, and still only got the taskbar window with Printwindow.Edit:Interesting enough, I think I got it to work hidden (not 100% tested), but it doesn't like minimized. No time to play at the moment.Edit2:Ok, so using the above method (PrintWindow).1. Check if window is minimized.2. If window is minimized - Get transparency level3. If window is not 100% transparent - Make window transparent4. Restore window5. Use PrintWindow/Compatible DC bitmap method6. Minimize window7. Restore original transparency state if necessaryThat could work more than likely (not tested).Or..1. Check if window is minimized.2. If window is minimized - Hide window3. Restore4. Use PrintWindow/Compatible DC bitmap method5. Minimize window6. Unhide windowThat might work as well other than the taskbar disappearing and reappearing, but you'll have action in the taskbar as well with restore/minimize.My preference, if/when I can verify 100% it's working, would be to just hide windows in restored mode, rather than worrying about always restoring or minimizing.Maybe even make a dummy taskbar window minimized, that when activated it shows the window and deletes the dummy gui so you have something in the taskbar. Edited February 10, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted February 10, 2009 Share Posted February 10, 2009 It looks like it could work, however I don't think you'll ever get a result that is comparable to what you can get on vista/win7, and yeah hidden restored state is much better than that transparency stuff, seems like an dirty hack to me.Oh and I hope you also tried the WM_PRINT message, I don't think PrintWindow and WM_PRINT are very different, but still Broken link? PM me and I'll send you the file! 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