ADDRESS null
NUMERIC DIGITS 10
OPTIONS "WINFUNC NOSOURCE"
SIGNAL ON ERROR
RXERR('ERROR')
windowproc = "void, void, 32u, void, void"
FUNCDEF("SetWindowProc", "func WINDOWPROC, void, 32, func WINDOWPROC", "user32", "SetWindowLong")
FUNCDEF("UnsetWindowProc", ", void, 32, void", "user32", "SetWindowLong")
rxtype.1 = 'TEXT'
rxflags.1 = 'NOBORDER'
rxlabel.1 = 'X =||Y =||Mouse Position'
rxpos.1 = '2 10 20 50'
rx = ''
RXCREATE('RX', 1, 'Main Window', 'MIN')
err = RXQUERY(, 'HANDLE', 'WindowHandle')
IF err == "" THEN DO
origfunc = setwindowproc(windowhandle, -4, mywindowproc)
IF origfunc == 0 THEN DO
RXSAY("Error setting window procedure!")
RETURN
END
END
ELSE DO
RXSAY("Can't get window handle!")
RETURN
END
DO FOREVER
RXMSG()
IF rxid == '' THEN SIGNAL HALT
END
mywindowproc:
SIGNAL ON SYNTAX NAME mywindowerror
SIGNAL ON HALT NAME mywindowerror
message = ARG(2)
SELECT
WHEN message == '512' THEN DO
x = C2D(BITAND(D2C(ARG(4), 4), '0000FFFF'x, ' '))
y = X2D(LEFT(D2X(ARG(4), 8), 4))
RXSET(, "VALUE", x, 1, 2)
RXSET(, "VALUE", y, 1, 4)
END
OTHERWISE NOP
END
mywindowerror2:
RETURN origfunc(ARG(1), message, ARG(3), ARG(4))
mywindowerror:
CONDITION('M')
SIGNAL mywindowerror2
syntax:
error:
CONDITION('M')
halt:
IF SYMBOL(origfunc) == "VAR" THEN unsetwindowproc(windowhandle, -4, origfunc)
RXMSG(,'END')
RETURN
|