home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1996
/
ARCHIVE_96.iso
/
discs
/
mag_discs
/
volume_9
/
issue_08
/
mokady
/
!PtrCopy
/
!Help
next >
Wrap
Text File
|
1996-03-28
|
3KB
|
95 lines
This software is (C) 1990 by Ran Mokady. It has been placed in the public
domain, and may be copied used and distributed freely, as long as it is
distributed complete with this documentation file, and with the copyright
message intact.
The PtrUtils module provides SWI calls to read the (System font) character at a
given position on the screen, and to read the character under the pointer. A
task which seemed trivial at first but proved to be quite challenging to
implement. It is able to recognize the character from one pixel ! (I.E.
it'll recognize the character even if all of it but one pixel is hidden
under another window !)
This application demonstrates one possible use of this module.
It provides the equivalent of cursor copying under the desktop.
To use the application:
1. Double click on !PtrCopy. (Nothing happens)
2. You can now move the mouse pointer over any system font
character on the screen and press the CTRL and ALT keys to
copy the character to the current input focus.
To copy a string just move the pointer over the first
character, press CTRL-ALT, and then while holding CTRL-ALT
down move the pointer over the string you want to copy. For
people like me who can't move the pointer in a straight line
to save their lives the mouse is bounded to a horizontal
line while the CTRL & ALT keys are held down.
--------------------------------------------------------------------------------
For those of you interested in the SWI calls they are:
SWI Pointer_GetCharacter (&424c0)
Entry:
r0 - Requesting task's handle.
r1 - X position on screen (in OS units).
r2 - Y position on screen (in OS units).
Exit:
Registers preserved.
The task is later sent a Message_CharacterIs with the character
value, or 0 if there is no character at the given position.
Errors: Pointer module in use :
This call can only be made by one task at a time, it should never be
called from the redraw code of the calling task, otherwise you stand a good
chance of getting this error !
SWI Pointer_GetCharacterAtPointer (&424c1)
This is the same as GetCharacter only the position is implied by the
current WIMP pointer position.
Entry: r0 - Requesting task's handle.
Exit:
r0 - Preserved.
r1 - Current pointer X position. (As returned from
Wimp_GetPointerInfo)
r2 - Current pointer Y position. (As returned from
Wimp_GetPointerInfo)
The task is later sent a Message_CharacterIs with the character
value, or 0 if there is no character at that position.
Errors: Pointer module in use :
This call can only be made by one task at a time, it should never be
called from the redraw code of the calling task, otherwise you stand a good
chance of getting this error !
Message_CharacterIs (&424c0)
+20 : ASCII code (or 0 if no character at the requested position)
+24 : X position of the left most pixel in the character on the
screen (in OS units).
Any bugs found, or suggestions for improvements are gratefully accepted to
Me at RMokady@stnc.com
Ran.