December 16, 2004
ScriptHost version 2.7.12
Added a few scriptHost functions.
Function Win32API.XUGetForegroundWindow() As Long 'See GetForegroundWindow API microsoft.
Function Win32API.XUGetClientRect(ByVal hwnd As Long, lpRect As tagRECT) As Long 'See GetClientRect API from microsoft.
Function Win32API.XUScreenToClient(ByVal hwnd As Long, lpPoint As tagPOINT) As Long
Function Win32AP.XUClientToScreen(ByVal hwnd As Long, lpPoint As tagPOINT) As Long
I Also updated GetPixelColor to more accuretly reflect the color on the screen.
Public XUScriptHostGetPixelColor(ByVal X As Long, ByVal Y As Long, Optional hwnd As Long) As Long
The added optional hwnd is for the window handle. It will default to 0 (desktop) if not supplied for backwards compatibility. However, if you call XUScriptHost.GetForegroundWindow and pass that as the hwnd, it will get the pixel (x,y) of the game window. This is very handy for fullscreen applications that might cause the getpixelcolor function to return an invalid color.
The other functions may be needed to help with conversion form full screen to windowed coordinates. Ie, if you are getting the pixel location from the x,y passed from GetCursorPos, those will be in screen coordinates which will need to be converted to game coordinates via the XUScreenToClient function.
|