[comp.windows.ms.programmer] DosApps, DDE, and the Clipboard

bert@helix.nih.gov (Bert Tyler) (11/21/90)

I have an associate who has a large, existing MS-DOS program that
he would like to modify so as to be able to converse with his new Winapps
using DDE.  He would like to avoid converting the application itself to
a Winapp if he can - it involves a *lot* of text-based data entry,
and has been running for some time.
 
Using information gleaned from Ralf Brown's INTER590 listing,
I have been able to write tiny MS-DOS programs that can detect
whether or not they are running under Windows, and can read to
and write from the Windows clipboard using the "WINOLDAPP" 2Fh
interrupt routines.  The sparse comments for that interface in the
INTER590 listings begin by describing WINOLDAPP as
 
  "a Microsoft Windows extension supporting  "old" (character-mode)
   application access to Dynamic Data Exchange, menus, and the
   Windows clipboard"
 
but then go on to describe accessing the clipboard only.
 
Questions -
 
1) Is WINOLDAPP still supported under Windows 3.0?  Is it likely to
be supported in the future, or am I guiding this guy gently off a cliff?
 
2) Can this interface be used by MS-DOS programs for DDE?  If so,
where can he locate the specs for this?  (Purchasing the DDK just
to get these specs is not a problem, as this solution will still
be a *lot* cheaper than converting the entire MS-DOS app).
 
3) What is wrong with this approach that I'm not clever enough
to have thought about? 

paulb@minster.york.ac.uk (11/24/90)

In article <653@nih-csl.nih.gov> bert@helix.nih.gov (Bert Tyler) writes:
> 
>1) Is WINOLDAPP still supported under Windows 3.0?  Is it likely to
>be supported in the future, or am I guiding this guy gently off a cliff?
> 
To the best of my knowledge, it is (my windows 3 directory structure has
a file called winoldap.mod in the system directory).  However see answer
to 3) below.

>3) What is wrong with this approach that I'm not clever enough
>to have thought about?
>
I think a better solution would be to adopt the approach outlined in a
number of MSJ articles on the subject of communication between OS/2
kernel apps and PM apps.  I see no reason why a similar system under
windows shouldn't work.  First you write a windows app which registers a
window class, and creates an *invisible* window.  This window handles
all the DDE, clipboard etc. stuff for you.  It then communicates with
the DOS app by allocating memory in the low megabyte of RAM (through
GlobalDosAlloc), and placing the data there.  You can use whatever
protocol takes your fancy to communicate between the windows server and
your application.

Please note, I haven't tried this - it just seems like the most sensible
way to go about things.  Let me know if you have any success if you do
decide to go down this route.

Another avenue that may be worth looking at is the DPMI - although I
know even less about this than I do about the above.

Paul.

+--------------------------+-----------------------------------------------+
|Paul Butcher              | JANET:  paulb@uk.ac.york.minster              |
|Dept. of Computer Science | EARN:   paulb@minster.york.ac.uk              |
|University of York        | UUNET:  ..!uunet!mcsun!ukc!minster!paulb      |
|York  YO1 5DD  ENGLAND    | ARPA:   paulb%york.minster@nsfnet-relay.ac.uk |
|Tel: (0904) 432760        | Alternative address:                          |
|     (+44 904) 432760     |         PRAB1@uk.ac.york                      |
+--------------------------+-----------------------------------------------+

mojo@netcom.UUCP (Morris Jones) (11/25/90)

paulb@minster.york.ac.uk writes:
>                                            It then communicates with
>the DOS app by allocating memory in the low megabyte of RAM (through
>GlobalDosAlloc), and placing the data there.  You can use whatever
>protocol takes your fancy to communicate between the windows server and
>your application.
>
>Please note, I haven't tried this - it just seems like the most sensible
>way to go about things.  

I know, I haven't tried this either, but I see a problem with that approach.
To my knowledge, a DOS app that's running in a Virtual 86 segment doesn't
have direct access to real mode DOS memory.  But I could be wrong.

Yes, DPMI should provide some kind of access.

-- 
mojo@netcom.UUCP          Site Coordinating Instructor, San Jose South
Morris "Mojo" Jones       Skilled Motorcycling And Rider Training (S.M.A.R.T.)
Campbell, CA              800-675-5559 ... 800-CC-RIDER ...  408-423-2212
AA4KB @ N6LDL.#NOCAL.CA.USA.NA / aa4kb.ampr.org / netcom!mojo@apple.com