I read Raymond’s blog: Taxes: Remote Desktop Connection and painting, in which he describes offscreen bitmaps and why applications use them.

 

My home web server sits on top of a bookcase and I never touch it, except for any maintenance. However, I use Remote Desktop to access it all the time, from home and from the office. In my VFP config file, I have COMMAND=SYS(602,0) to turn off offscreen bitmaps.

 

A few decades ago, I used a product called Carbon Copy which allowed me to connect to a remote machine from a local machine. It allowed me to run an application on the remote machine, and it just sent keystrokes and screen changes across the wire (literally a 2400 baud modem). It was fairly slow, but a lot better alternative than sending the entire application or its data across the wire. In those days before Windows and Graphical User Interfaces, this primitive precursor to remote desktop was useful.

 

Now use RD to connect to a machine. Change Remote Desktop Connection's options: on the Experience tab enable 'Show contents of window while dragging'

Start VFP9 and set the background picture: ( _screen.Picture=”some picture file”) to exaggerate the performance difference. Using a low connection speed will also pronounce the difference. On our high speed internal network, I couldn’t see a difference, but connecting over the internet to my server I saw it.

 

Continually resize the VFP window and notice how long it takes to repaint the _screen background.

 

Now toggle VFP’s offscreen bitmap drawing. You can use the F5 key:

 

            ON KEY LABEL f5 ?SYS(602,1-VAL(SYS(602)))

 

 

A value of 1 means offscreen bitmaps are on, and VFP draws to an offscreen bitmap, which is then BitBlted to the display. 0 means writing to the display directly.

 

GetSystemMetrics with SM_REMOTESESSION shows if the active session is using Remote Desktop. You can tie both of this code into Detecting Workstation state changes for automatic offscreen bitmap setting.