Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,

Not sure where to ask this.

I have a dialog application that is doing some screen scrapping.
I have been able to get it to work on 1 machine. I have reconfigured a second machine with the same resolution. I am having an issue on the second machine.

The issue is, Lets say we have a grid of 9 x 9. On the first machine I have been able to get the full grid of 9 x 9 with all the pixels from it, as it gets filled by the user of that machine.

However , second machine is where I am having issues with is, I am unable to get full 9 x 9 grid as the user fills the grid out. I get a partial grid. It could be only first 20 or 40 but never been able to get full 81 as I get from the first machine.

Can someone please help, what could be happening.

What I have tried so far: Short of the differences between physical devices, I have re-installed the operating system and set both machines to the same desktop resolution.

I have been able to send mouse clicks to both applications. My only issue is getting the pixel back from the second machine.

Any Ideas?

Modified to add the code:

C++
hWnd is a handle to the target window.
HDC DlgDC;
COLORREF Color;
DlgDC = ::GetDC(hWnd);
Color = ::GetPixel(DlgDC,x[a],y[b]);
if (Color == RGB(213,7,11))
{
Result = 2;
	}                                                          
	if (Color == RGB(3,16,255))
	{
		Result = 1;
	}
	if (Color == RGB(23,211,12))
	{
		Result = 0;
	
::ReleaseDC(hWnd, DlgDC);
DeleteObject(DlgDC);
Posted
Updated 14-Sep-14 18:18pm
v2
Comments
enhzflep 14-Sep-14 23:37pm    
Things that come to mind are different results for a call to GetSystemMetrics for various UI elements on each machine.This would be affected by the current Theme, for example.This can have effects ranging from how thick the non-client border of an element is, to the height of the title-bar etc, etc.

You also mention screen-scraping, a term I generally see applied to the retrival of text-content from the screen - a technique which, regardless of the target content, is frequently precarious and libel to break.

Are you able to edit your question to provide code which would illustrate your method of scrapping? Without seeing how you're doing what you're doing, you'll (I hope) understand if I say that it's more than a little difficult to suggest with any degree of certainty where abouts the short-coming of logic or approach lies, without seeing the logic or approach.

Lastly, knowing that your target is a 9x9 (81 pixels) is good, but it would also help quite a bit if you were able to specify that dimensions (and offset, if any) of the grid that is actually captured. While the total number of pixels is a part of the equation, knowing if your capture area is having its height or width truncated would also help to determine the source of the discrepancy. This would be of use particularly when understanding the method you use to select the screen area to be captured.

For instance, if an element is 100,100 compared to it's parent, it may be tempting to address this screen location with (screen-pos of parent's origin) + (100,100). However, if the control border was a different width, while the control would still start at 100,100 - the content may be offset by a further 2,2 or 3,3 pixels.

There's just too may unknown variables for me to be able to offer anything further, I think.

1 solution

This is not "desktop resolution". Resolution is majorly irrelevant. This is the size of the desktop screen in pixels. See the difference?

Of course, setting identical screen size of different systems would be a total lame, and not even always possible, because aspect ratio are different. Whatever you do, you can get the desktop size on a current system. This is how:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504%28v=vs.85%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900