PRB: Windows Applications Cannot Share File Handles

ID Number: Q22379

2.00 2.03 2.10 3.00 3.10

WINDOWS

Summary:

SYMPTOMS

One application initializes a file, and receives the handle of

x '0005'. The application then takes the handle and places it into

global memory. The SetClipboardData function is then called using

a format returned by the RegisterClipboard function. A second

application then opens the Clipboard and retrieves the handle

correctly; however, when the application tries to write to the

handle, MS-DOS returns AX=0000, indicating that it did not write

any information.

RESOLUTION

Applications cannot share file handles. This is a feature of the

MS-DOS filing system.

The file handle table is part of each application's environment;

the file handle itself is an offset into this table. Although an

offset of 5 might be valid for two applications, the file

information at that offset in the respective file handle tables

will be very different.

Passing the filename to the second application is recommended.

Additional reference words: TAR60849 2.x 2.00 2.03 2.10 2.x 3.00 3.10 3.x