inkey /m

Feb 25, 2009
16
0
#1
Is there a way when using inkey /m to obtain the row/col where the click took place? In console character row/column, not screen pixel row/column.

If not, this would be a good feature add. Either extend inkey /m to return three items, so the @ascii conversion would return the mouse button, then the row number, then the column number. Or, to retain compatibility, add a /L (location) switch to use with /M to include the location in the result.

In the meantime, is there a way, when inkey /m detects a mouse click, to determine the character row/col relative to the console where the click occurred? Something via @winapi perhaps?
 

rconn

Administrator
Staff member
May 14, 2008
10,753
97
#2
Is there a way when using inkey /m to obtain the row/col where the click took place? In console character row/column, not screen pixel row/column.

If not, this would be a good feature add. Either extend inkey /m to return three items, so the @ascii conversion would return the mouse button, then the row number, then the column number. Or, to retain compatibility, add a /L (location) switch to use with /M to include the location in the result.

In the meantime, is there a way, when inkey /m detects a mouse click, to determine the character row/col relative to the console where the click occurred? Something via @winapi perhaps?
No to the first, and a qualified maybe to the second. (There is no Windows API to return the console mouse position, but you can get the mouse position in screen coordinates & with a bit of number crunching get a row/column number.

I'll add the request for a row/column indicator for INKEY /M to the suggestion list for a future version.