Makalele Posted May 28, 2008 Share Posted May 28, 2008 Hi! I have next problem with my bot. It works sweet but if i hide the Internet Explorer Window or i open another window function GetPixelColor doesn't work ;/ for example : PixelGetColor($X,$Y,$WinHandle) etc... i thought that if i add $WinHandle parameter it'll work when window is hidden... maybe any1 know another method to get pixel in hidden window ? Link to comment Share on other sites More sharing options...
Makalele Posted May 28, 2008 Author Share Posted May 28, 2008 any way to do it exist ? Link to comment Share on other sites More sharing options...
Makalele Posted May 29, 2008 Author Share Posted May 29, 2008 help me plz Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2008 Moderators Share Posted May 29, 2008 Well rather than having you rack your brain on this... the short answer is "no". There's no way currently to get the device content of a minimized or hidden window because it isn't drawn when in these states. 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...
Makalele Posted September 15, 2008 Author Share Posted September 15, 2008 Hello there,firstly the topics,http://www.autoitscript.com/forum/index.ph...mp;#entry528636http://www.autoitscript.com/forum/index.ph...mp;#entry567936I'm trying to do it from few months. Still no effect. But i know it's possible, but no by straight method - i got another idea. I'm sure it'll be working in C++. So it's possible to make the small dll library in C++ and use this by DllCall function. But there is a problem - i know C++ language very low. And now, i'm making a request for users of this forum to help me. I think if you know C++ well, you'll make it very fast. Someone told me that it's impossible to read the pixel from hidden window, because windows don't draw the pixel when they are hidden. It's true, BUT if you use command called "Send Message" the window can send the data to our script (http://www.fengyuan.com/article/wmprint.html) Looks good? I think yes. The rest are in these topics. If you don't want to help me, please don't post here. Sorry for my english - it isn't perfect yet ^^.Regards,Makalele Link to comment Share on other sites More sharing options...
DW1 Posted September 15, 2008 Share Posted September 15, 2008 If you are looking for C++ help, you should try a C++ forum, or perhaps put this in chat as it is not an au3 issue/request. Happy hunting. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Makalele Posted September 15, 2008 Author Share Posted September 15, 2008 If you are looking for C++ help, you should try a C++ forum, or perhaps put this in chat as it is not an au3 issue/request.Happy hunting.Thanks for a tip. I'll do it. But maybe someone want to help me here Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 15, 2008 Moderators Share Posted September 15, 2008 (edited) I've replied to one of these posts already. It isn't about a desire to help you or not, I personally would love for it to be possible. But you've answered your own question with a fact. I saw that cppman says it "should" be possible, but he's talking about Vista with no code to back it up. If you want to do it in XP, the fact that the last time you started a topic on this is still the same. Do not start another thread on the same topic. Edit: Topics merged Edited September 15, 2008 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...
Makalele Posted September 16, 2008 Author Share Posted September 16, 2008 I've replied to one of these posts already. It isn't about a desire to help you or not, I personally would love for it to be possible. But you've answered your own question with a fact.I saw that cppman says it "should" be possible, but he's talking about Vista with no code to back it up. If you want to do it in XP, the fact that the last time you started a topic on this is still the same.Do not start another thread on the same topic.Edit:Topics mergedSry for starting new topic, thanks for merge If it's working in C++ so it's possible in Windows XP >_< Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 16, 2008 Moderators Share Posted September 16, 2008 Sry for starting new topic, thanks for merge If it's working in C++ so it's possible in Windows XP >_<So where is this C++ code that it's working in? 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...
Makalele Posted September 16, 2008 Author Share Posted September 16, 2008 So where is this C++ code that it's working in? http://www.fengyuan.com/article/wmprint.html This is a guide how to capture the window to the clipboard. So someone can change this function: void PrintWindow(HWND hWnd) { HDC hDCMem = CreateCompatibleDC(NULL); RECT rect; GetWindowRect(hWnd, & rect); HBITMAP hBmp = NULL; { HDC hDC = GetDC(hWnd); hBmp = CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom - rect.top); ReleaseDC(hWnd, hDC); } HGDIOBJ hOld = SelectObject(hDCMem, hBmp); SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED); SelectObject(hDCMem, hOld); DeleteObject(hDCMem); OpenClipboard(hWnd); EmptyClipboard(); SetClipboardData(CF_BITMAP, hBmp); CloseClipboard(); } To something like that: int GetPixelColor(int x,y, HWND hwnd) { the code from last function ... } but on the end not copy bitmap to clipboard, just straight read the pixel using GetPixel or something like that Easy to make in my opionion, but i don't know how to do it exatcly. My c++ knowledge is bad >_< Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 16, 2008 Moderators Share Posted September 16, 2008 http://www.fengyuan.com/article/wmprint.html This is a guide how to capture the window to the clipboard. So someone can change this function: void PrintWindow(HWND hWnd) { HDC hDCMem = CreateCompatibleDC(NULL); RECT rect; GetWindowRect(hWnd, & rect); HBITMAP hBmp = NULL; { HDC hDC = GetDC(hWnd); hBmp = CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom - rect.top); ReleaseDC(hWnd, hDC); } HGDIOBJ hOld = SelectObject(hDCMem, hBmp); SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED); SelectObject(hDCMem, hOld); DeleteObject(hDCMem); OpenClipboard(hWnd); EmptyClipboard(); SetClipboardData(CF_BITMAP, hBmp); CloseClipboard(); } To something like that: int GetPixelColor(int x,y, HWND hwnd) { the code from last function ... } but on the end not copy bitmap to clipboard, just straight read the pixel using GetPixel or something like that Easy to make in my opionion, but i don't know how to do it exatcly. My c++ knowledge is bad >_<GetDC <-- And thus your problem. When the window is minimized or hidden, you can't get the correct Device Content. This C++ code does not do what you claim it does. 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...
Makalele Posted September 16, 2008 Author Share Posted September 16, 2008 GetDC <-- And thus your problem. When the window is minimized or hidden, you can't get the correct Device Content. This C++ code does not do what you claim it does.Hmm but maybe that method by making 3 functions:first (used on script start when window is visible)void RememberWindow(HWND hWnd){ HDC hDCMem = CreateCompatibleDC(NULL); RECT rect; GetWindowRect(hWnd, & rect); HBITMAP hBmp = NULL; { HDC hDC = GetDC(hWnd); hBmp = CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom - rect.top); ReleaseDC(hWnd, hDC); }}second int RefreshPixelData{ HGDIOBJ hOld = SelectObject(hDCMem, hBmp); SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED); SelectObject(hDCMem, hOld); DeleteObject(hDCMem);}int GetPixel(int x,y){ GetPixel(....}is it possible now ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 16, 2008 Moderators Share Posted September 16, 2008 What difference would it make if you divided the same function up into 10 individual functions? 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...
ofLight Posted September 16, 2008 Share Posted September 16, 2008 http://www.fengyuan.com/article/wmprint.htmlIs this not just showing how to rewrite an app to display the clientdata differently, so that it can be read while not visible? This can be done if you are creating the app from scratch or have access to the source, but for any other purpose this is unusable. For example if you wanted to read the pixels on a minimized game window, this code does not apply. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
Zedna Posted September 16, 2008 Share Posted September 16, 2008 I did some tests too but no luck on WINXPÂ Here is link to my post:http://www.autoitscript.com/forum/index.ph...st&p=523910 Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 16, 2008 Moderators Share Posted September 16, 2008 I did some tests too but no luck on WINXPÂ Here is link to my post: http://www.autoitscript.com/forum/index.ph...st&p=523910I translated it:expandcollapse popup_PrintWindow(WinGetHandle("")) Func _PrintWindow($h_wnd) Local Const $CF__BITMAP = 0x002 Local Const $PRF__CHILDREN = 0x0010 Local Const $PRF__CLIENT = 0x004 Local Const $PRF__ERASEBKGND = 0x008 Local Const $PRF__OWNED = 0x0020 Local Const $WM__PRINT = 0x00317 Local $h_gdi32 = DllOpen("gdi32.dll") Local $h_user32 = DllOpen("user32.dll") Local $h_dc_mem = DllCall($h_gdi32, "hwnd", "CreateCompatibleDC", "hwnd", 0) Local $t_rect = DllStructCreate("int left;int top;int right;int bottom") DllCall($h_user32, "int", "GetWindowRect", "hwnd", $h_wnd, "ptr", DllStructGetPtr($t_rect)) Local $h_dc = DllCall($h_user32, "hwnd", "GetDC", "hwnd", $h_wnd) Local $h_bmp = DllCall($h_gdi32, "hwnd", "CreateCompatibleBitmap", "hwnd", $h_dc[0], _ "int", DllStructGetData($t_rect, "right") - DllStructGetData($t_rect, "left"), _ "int", DllStructGetData($t_rect, "bottom") - DllStructGetData($t_rect, "top")) DllCall($h_gdi32, "int", "ReleaseDC", "hwnd", $h_dc[0]) Local $h_old = DllCall($h_gdi32, "hwnd", "SelectObject", "hwnd", $h_dc_mem[0], "hwnd", $h_bmp[0]) DllCall($h_user32, "int", "SendMessage", "hwnd", $h_wnd, _ "int", $WM__PRINT, "wparam", $h_dc_mem[0], _ "lparam", BitOR($PRF__CHILDREN, $PRF__CLIENT, $PRF__ERASEBKGND, $PRF__OWNED)) DllCall($h_gdi32, "hwnd", "SelectObject", "hwnd", $h_dc_mem[0], "hwnd", $h_old[0]) DllCall($h_user32, "int", "OpenClipboard", "hwnd", $h_wnd) DllCall($h_user32, "int", "EmptyClipboard") DllCall($h_user32, "int", "SetClipboardData", "long", $CF__BITMAP, "hwnd", $h_bmp[0]) DllCall($h_user32, "int", "CloseClipboard") DllCall($h_gdi32, "int", "DeleteObject", "hwnd", $h_dc_mem[0]) DllClose($h_gdi32) DllClose($h_user32) Return EndFuncBut the bmp is always black. 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...
Makalele Posted September 16, 2008 Author Share Posted September 16, 2008 I translated it:expandcollapse popup_PrintWindow(WinGetHandle("")) Func _PrintWindow($h_wnd) Local Const $CF__BITMAP = 0x002 Local Const $PRF__CHILDREN = 0x0010 Local Const $PRF__CLIENT = 0x004 Local Const $PRF__ERASEBKGND = 0x008 Local Const $PRF__OWNED = 0x0020 Local Const $WM__PRINT = 0x00317 Local $h_gdi32 = DllOpen("gdi32.dll") Local $h_user32 = DllOpen("user32.dll") Local $h_dc_mem = DllCall($h_gdi32, "hwnd", "CreateCompatibleDC", "hwnd", 0) Local $t_rect = DllStructCreate("int left;int top;int right;int bottom") DllCall($h_user32, "int", "GetWindowRect", "hwnd", $h_wnd, "ptr", DllStructGetPtr($t_rect)) Local $h_dc = DllCall($h_user32, "hwnd", "GetDC", "hwnd", $h_wnd) Local $h_bmp = DllCall($h_gdi32, "hwnd", "CreateCompatibleBitmap", "hwnd", $h_dc[0], _ "int", DllStructGetData($t_rect, "right") - DllStructGetData($t_rect, "left"), _ "int", DllStructGetData($t_rect, "bottom") - DllStructGetData($t_rect, "top")) DllCall($h_gdi32, "int", "ReleaseDC", "hwnd", $h_dc[0]) Local $h_old = DllCall($h_gdi32, "hwnd", "SelectObject", "hwnd", $h_dc_mem[0], "hwnd", $h_bmp[0]) DllCall($h_user32, "int", "SendMessage", "hwnd", $h_wnd, _ "int", $WM__PRINT, "wparam", $h_dc_mem[0], _ "lparam", BitOR($PRF__CHILDREN, $PRF__CLIENT, $PRF__ERASEBKGND, $PRF__OWNED)) DllCall($h_gdi32, "hwnd", "SelectObject", "hwnd", $h_dc_mem[0], "hwnd", $h_old[0]) DllCall($h_user32, "int", "OpenClipboard", "hwnd", $h_wnd) DllCall($h_user32, "int", "EmptyClipboard") DllCall($h_user32, "int", "SetClipboardData", "long", $CF__BITMAP, "hwnd", $h_bmp[0]) DllCall($h_user32, "int", "CloseClipboard") DllCall($h_gdi32, "int", "DeleteObject", "hwnd", $h_dc_mem[0]) DllClose($h_gdi32) DllClose($h_user32) Return EndFuncBut the bmp is always black. Finally i found that topic >_< http://www.autoitscript.com/forum/index.php?showtopic=55564 That section is the section that requires the assembly. So i think it'll only work in C++.. I need to read pixel's from Flash Object in Internet Explorer, maybe is another way to do it ? Maybe someone test it in C++ ? Link to comment Share on other sites More sharing options...
komalo Posted September 16, 2008 Share Posted September 16, 2008 (edited) okay , i don't have an answer for you but it is just an idea your problem starts on hiding the internet explorer window maybe you can just move the window off screen , show it and use the PixelGetColor Function then hide it and get it back to it's original position Edited September 16, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
Makalele Posted September 16, 2008 Author Share Posted September 16, 2008 okay , i don't have an answer for you but it is just an ideayour problem starts on hiding the internet explorer windowmaybe you can just move the window off screen , show it and use the PixelGetColor Function then hide it and get it back to it's original positionso you think i move visible window 2000pixels for right it will be working ? 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