Drawing with Low Level XY
One of the tests my company has always had to do manually is drawing on calibrated bitmap images, clicking at labelled points in the picture to calibrate medical protocols.
I can record the test with a Low Level procedure, and generate the list of X-Y coordinates and interactions, and the test will run fine on the machine I record the test with. However, if the playback machine has a different resolution it will not play back properly.
I can get the resolution of the playback machine, and the twips conversion they have as a result (see below for the code I found), but I don't know how to apply the conversion during playback. I would really rather not have to manually convert all the coordinates even once, let alone doing it for each possible resolution.
Is there a way to convert X-Y playback on the fly with a conversion formula for different resolutions?
How to extract Twips on the playback machine:
This will return the machine's Twips per Pixel. Just call the function when you need to insert the Twips into a formula instead of "magic numbers" like 12 or 15 (that may or may not be correct).
function Twips() { var hWnd = Win32API.GetDesktopWindow(); var hDC = Win32API.GetDC(hWnd); var logPixY = Win32API.GetDeviceCaps(hDC, Win32API.LOGPIXELSY); Win32API.ReleaseDC(hWnd, hDC); return 1440 / logPixY; }