Thanks for the suggestion. I read up a fair bit on that earlier on and was in two minds as to whether it could be although I didn't have as much info as I have now and you might be right.

After a fair bit of testing (and getting past my antivirus apps that detected possible harmful virus activity on account of Spy++ and me using hooks) I got the following results:

Surface 4 screen; DOES NOT WORK
~~~~~~~~~~~~~~~~~~~
- Spy++ Rectangle: (11, 98) - (668, 235) This represents the ActiveX keyboard control rectangle/area, that is correct
- Hook: X=27, Y=199 Hook event values after I clicked in top left corner of the ActiveX keyboard control (digit 1)

Surface 4 connected to a large monitor; WORKS OK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Spy++ Rectangle: (11, 98) - (668, 235) This represents the ActiveX keyboard control rectangle/area, that is correct (same as above)
- Hook: X=12, Y=98 Hook event values after after I connected an external monitor and clicked in top left corner of the ActiveX keyboard, same as above


Looking at the values above, with a monitor connected to the tablet the Hook event X & Y values are 12 & 98, and fall within the ActiveX keyboard control rectangle and identify the correct key.

When I then do nothing else other than simply connect an external monitor to the tablet and click in exactly the same spot as above the Hook event values are 27 & 199 and (in this case) instead of identifying the key in the top left corner of the keyboard rectangle it identified the key that is at the bottom left side of the keyboard, which that makes sense because the hook Y value (199) is just within the bottom part of the rectangle, being 90-235.

Looking at the above results and me doing absolutely nothing other than connecting a monitor to the tablet, I still feel that some Windows setting comes into play with the external monitor.

I can (just for now) deduct 11 & 98 from the Hook values and see if that works consistently but of course that is unlikely to solve the problem as not knowing what's causing it I have no idea how different tablets/windows settings will be and what offset will they have so this should be done properly.

I was going to take a look at SystemParametersInfo API to see if it shows any parameter that relate to the monitor, virtual displays, DPI or anything along those lines and of course any input or suggestions will be most welcome.