www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/11/02:36:47

Date: Thu, 11 Nov 1999 08:27:04 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: lcl99 AT my-deja DOT com
cc: djgpp AT delorie DOT com
Subject: Re: Paste Win Clipboard in DOS?
In-Reply-To: <80ct0i$kie$1@nnrp1.deja.com>
Message-ID: <Pine.SUN.3.91.991111082323.16947V-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 10 Nov 1999 lcl99 AT my-deja DOT com wrote:

> > The size regs (dx:ax) always come back 0. Any idea why?
> >
> I found the problem myself. Before the 0x1704 call to get the size of
> the clipboard, I wasn't setting dx to 1 (the data type).

Setting DX to 1 is not a good idea.  Specifically, it will fail if the 
text in the clipboard was put there by a Windows (as opposed to DOS) 
application that used some non-ASCII characters.  You need to use format 
code 7 (OEM Text), because that's what DOS applications support with the 
installed codepage.  When you use OEM Text, Windows automatically 
converts any non-ASCII characters to their DOS encoding, which differs 
from the Windows encoding.

I even saw cases where using format 1 yields an incorrect length of the 
text in the clipboard, which produces garbage after you paste it.  7 is 
much better.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019