ADC Home > Reference Library > Technical Q&As > Legacy Documents > Graphics & Imaging >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Including the Cursor in a Screen Capture when using CopyBits

Q: When I used CopyBits to do a screen capture, the cursor is not included. What is going on?

A: CopyBits calls ShieldCursor to hide the cursor before it does its actual work. That is why you never see the cursor in your bitmap. The following bit of code hides the cursor and decrements the cursor count in the low memory global to fool CopyBits not to call ShieldCursor. Just as a warning, using low memory globals is dangerous and is subject to future OS changes. Anyway, the OS screen dump behaves similarly.

			unsigned char oldCrsrVis;
			short oldCrsrState;
// Hide cursor
			oldCrsrVis = GetCrsrVis();
			oldCrsrState = GetCrsrState();
			SetCrsrVis((unsigned char) 0);
			SetCrsrState(oldCrsrState - 1);
// Restore old cursor

The functions are defined as:

enum {
    CrsrRect = 0x83C,   /*[GLOBAL VAR]  Cursor hit rectangle [8 bytes]*/
    TheCrsr  = 0x844,   /*[GLOBAL VAR]  Cursor data, mask & hotspot [68 bytes]*/
    CrsrAddr = 0x888,   /*[GLOBAL VAR]  Address of data under cursor [long]*/
    CrsrSave = 0x88C,   /*[GLOBAL VAR]  data under the cursor [64 bytes]*/
    CrsrVis  = 0x8CC,   /*[GLOBAL VAR]  Cursor visible? [byte]*/
    CrsrBusy = 0x8CD,   /*[GLOBAL VAR]  Cursor locked out? [byte]*/
    CrsrNew  = 0x8CE,   /*[GLOBAL VAR]  Cursor changed? [byte]*/
    CrsrState = 0x8D0,  /*[GLOBAL VAR]  Cursor nesting level [word]*/
    CrsrObscure = 0x8D2 /*[GLOBAL VAR]  Cursor obscure semaphore [byte]*/
int IsCursorHidden(void);
void SetCrsrVis(unsigned char cursorVisible);
unsigned char GetCrsrVis(void);
PicHandle DumpScreenArea(void);
void ModCrsrState(short del);
short GetCrsrState(void);
void SetCrsrState(short val);
void SetCrsrVis(unsigned char cursorVisible)
    *(unsigned char*)CrsrVis = cursorVisible;
unsigned char GetCrsrVis(void)
   return( *(unsigned char*)CrsrVis );
void ModCrsrState(short del)
	*(unsigned char*)CrsrState += del;
short GetCrsrState(void)
	return ( *(unsigned char*)CrsrState );
void SetCrsrState(short val)
	*(unsigned char*)CrsrState = val;
int IsCursorHidden()
	int retVal = 0;
    unsigned char cursorVisible;
    cursorVisible = *(unsigned char*)CrsrVis;
    if (cursorVisible)
        retVal = 0;
        retVal = 1;
    return (retVal);

You can find a screen dumping sample in the latest Dev. CD. The complete path is:

     Dev.CD Aug 96 TC
          Sample Code

[Sep 27 1996]

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.