Remote Desktop and Offscreen Bitmaps

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.



Comments (3)

  1. Randy Jean says:

    HI Calvin,

    Interesting post. I was just discussing RD vs. Citrix Metaframe, performance w/VFP, etc. with a colleague just yesterday.

    What’s the difference between COMMAND SYS(602,0) and BITMAP = OFF in config.fpw?

    Also, the VFP help says the following in the SYS(602) topic:

    If you want to determine whether an application is running on a Terminal Server, use OS(10).

    Would this work instead of using GetSystemMetrics to automatically toggle this?

    In production scenarios where users access the apps through RD they have their own config.fpw where their loader app sits. Could I not just hard-code BITMAP = OFF in this case?

    I am planning on trying this stuff out as soon as I get a chance.



  2. Calvin_Hsia says:

    SYS(602,0) does the same thing as BITMAP=OFF, but it is not limited to VFP startup. OS(10) and GetSystemMetrics are different: More on this in a future post.

Skip to main content