From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.os2.misc,comp.os.os2.programmer
Subject: Re: Is Windows 3.0 programming very different from OS/2 PM  prog.?
Date: 9 Oct 92 18:48:48 GMT
Distribution: usa
Organization: New Jersey Institute of Technology, Newark, N.J.

In article <1992Oct7.170815.27871@msuinfo.cl.msu.edu> sundaram@cps.msu.edu (Divya Sundaram) writes:
>Hi,

Hello.

>I was wondering if programming for OS/2 is all that different from programming
>for MS-Windoze 3.x? I realize that the commands would be different, but are 
>the concept radically (if at all) different? What about similarities or 
>differences to X-WIndows programming?

The concepts are similar, but the syntax is different enough that it
will drive you up a wall!

1) Windows and PM both use an event-driven system.  That is, the app
   initializes itself, then enters a loop where it waits for messages
and calls an execute procedure for them.  In both cases, you register
a procedure for each "window class" you create.  This procedure gets
all the messages that the window (or windows, if one class has
multiple instances) and it either does something with the message or
it calls a system default handler.

2) Windows and PM use different graphics languages within their
   windowing systems.  PM uses the Graphics Programming Interface
(GPI) spec, which is based on IBM's GDDM graphics terminal language.
Microsoft's is the Graphics Device Interface (GDI) spec, which is
optimized for PC hardware.  They have similar, if not equivalent
functionality.   The biggest difference is that GPI uses a coordinate
system with (0,0) in the lower-left corner, while GDI places (0,0) in
the upper left corner.  The GPI method is familiar as the first
quadrant of a cartesian plane (as defined by math books), while GDI is
familiar to programmers for most other systems.

3) Windows seems to require some unnecessary calls.  For instance, you
   must call a "translate message" procedure with each message in
order for certain keyboard events to get processed properly.  This is
necessary under DOS.  OS/2 doesn't require this because it uses its
own keyboard driver.  There are a few other cases where Windows
(usually due to DOS being under it) requires you to make system calls
that seem unnecessary to the OS/2 programmer.

4) OS/2 is multithreaded.  Simply put, if you want your program to do
   two things at once, or at least look like it is, it's simple.  OS/2
provides system services for this.  Windows code is much like DOS code
in that you must do the work yourself to get this effect.

Note that I am ignoring NT here.  I don't know anything about it other
than what net people tell me, so I won't comment on programming for
it.

As for X-windows, again, you have the event-driven system, but it gets
a bit strange from there.  Instead of having one event procedure for
all the objects in a window, you have a separate procedure for each
object.  You have to program for the window manager (usually Motif
around NJIT, but it could be different) as well as for X-windows.  You
can ignore the window manager, but you'll be missing out on a lot of
useful facilities.

I don't know too much more about X, so I'll shut up now.
-- 
David Charlap         |"there aren't 50,000 things for which it's worth writing
dic5340@hertz.njit.edu| software; and the computer industry doesn't have enough
----------------------+ programmers to create that much good software.
Therefore, most of it must be worthless" -- Boris Beizer "The Frozen Keyboard"