Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

OCTOBER 1986 VOL 1 N01 MICR~SOFt

Special
Windows
Issue
SystemsJournal
a Advanced Reuter Terminal Gives
Traders Windows on Financial World
The Advanced Reuter Terminal (ART), a dedicated hardware and software system that
runs under Microsoft® Windows, enables currency traders to view and analyze up-to-the-
minute financial data. An exclusive interview reveals the developing team's experiences .

• DOE: A Public Protocol for


Advanced Application Linkages
An extension of Microsoft Windows data exchange facilities , the Dynamic Data
Exchange (ODE) protocol allows developers to establish sophisticated application link-
ages, ranging from automatic updating of documents to processing of real-time data .
. 6 AXP 61 .1 HSV I. PR" 1.1 It! I 4 A. I 1

II New Intel Graphics Coprocessor


Makes Windows Sparkle
Intel ® has a new way to boost the display speed of Microsoft Windows and other
graphics applications: the 82786, a high-powered coprocessor that improves workstation
performance, moving graphics functions from software to high-speed hardware.

II Tl's Programmable Graphics


Processor Perks up PC Pixels
The first true graphics microprocessor, Texas Instruments' 32-bit TMS34010 executes at
6 MIPS , addresses up to 4 gigabytes of memory, supports displays of up to 64K by 64K
pixels, and includes high-speed pixel-processing instructions.

[gJ Bordet·
0 Capti on II Latest Dialog Editor Speeds
Windows Application Development
An improved version of the Microsoft Windows Dialog Editor (supplied with the
0 Group Bi t software development kit) simplifies designing and testing a dialog box-one of the key
[gJ Tab Stop Bi t elements of a Windows application . Here's how to use it and what to watch out for.

pcjs.org
EDITOR'S NOTE
his first issue of the Microsoft Systems Journal is devoted in its
entirety to Microsoft Windows operating environment, Microsoft's most im-
portant system software product since MS-DOS®.
Windows has encountered remarkable success both as a retail product and
as a development environment since its release last November. While much
of the product's initial popularity can be attributed to its flexibility as a "switcher" for tradi-
tional applications and the included sample applications, its ultimate success will depend on
the acceptance of native Windows applications.

Reuters' ART
As a definitive example of the capabilities of Microsoft Windows and its flexibility to serve
particular user interface designs, we examine the Advanced Reuter Terminal (ART), the
most sophisticated Windows application to date. A superb example of design and coding
craftsmanship, the ART would be worth featuring even if it were not based on Windows.
We also present profiles of two graphics processors that will have a significant impact on
future graphics systems: the Intel 82786 and the Texas Instruments TMS34010. And we
take a look at DDE, a new standard for interprogram data exchange, as well as examine the
improved Dialog editor. In addition, Dr. Bob tackles some questions about Windows from
developers. In sum, we hope to present a developer's view of Microsoft Windows.

Future Issues
In future issues we will focus on other areas of interest to developers, including C program-
ming, device drivers, extended and expanded memory, debuggers, code portability, and the
inside view of MS-DOS and Microsoft XENJX®. We will tackle the subjects that interest
serious developers most-from user interface design to guidelines for writing terminate-and-
stay-resident programs. Our aim is to confront rhe real issues confronting serious developers.

Write to Us
We invite you to write to us, to subscribe, and equally important, to tell us what you think
we should include in the Journal. Beginning in January 1987, our issues will expand to full
size, more than twice the length of this special issue.
We hope the Journal will become one of the most important publications you receive.

-Ed.

The Microsoft Systems Journal (ISSN #0889-9932) 1s published every other month by Microsoft Corporation, 10611 NE 36th Way. Box 97017, Redmond , Washington
98073-9717 . Officers : William H. Gates. Il l. Chairman of the Board and Ch ief Executive Officer: Jon Shirley . President and Chief Operating Officer: Francis J. Gaudette.
Treasurer : William Neukam . Secretary. Subscription rate : $50.00 per year (single copies $10.00). To order subscriptions or report change of address . write to the
Circulation Department, Microsott Systems Journal. Box 97017 , Redmond , Washington 98073-9717 . Manuscript submissions and all other correspondence should
be addressed to H. Roark & Associates , Suite804 , 141 East 44th St. , New York., NY 10017.
Copyright © 1986 Microsoft Corporation. All rights reserved; reproduction in part or in whole without permission is prohibited.

EDITOR .Jonathan D. Lazarus Michael Longacre DESIGN

pcjs.org
ART Showcases
Microsoft Windows
D
MSJ Interview

the currency changes, a new


tick is added to the graph.
The ART provides automatic
limit watching, using dialogs
options in which users enter upper and
lower limits for any currency
displayed on a stored page.
ART's Configuration When limits are broken, the
ART hardware consists of an ART gives audible and visible
80286-based (PC-AT com- signals allowing a dealer to ART HARDWARE
patible) NCR computer with react instantly. News watching
1.5 megabytes of RAM, a 20- works the same way; the ART
CONSISTS OF AN 80286-
megabyte hard disk, high-reso- immediately alerts the user BASED NCR COMPUTER, A
lution (EGA) display, 1200- when the prese lected word or
baud modem, Reuters proprie- phrase appears in a headline. In
REUTERS PROGRAMMABLE
tary communications board, a sum, the ART system allows KEYBOARD , AND , OF
Reuters programmable key- the user to determine the
board, and, of course, a mouse. screen's content and layout, an COURSE , A MOUSE.
But the heart of the system asset to active traders.

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
JOURNAL

REUTERS: We have to go experiences and exchange infor-

II through a lot of tricks to design


the system in such a way that
the time-critical aspects of the
application are catered to. There
must be an easier way.
mation on bugs and so on, we
would not be quite as forth-
coming as perhaps a company
that was trying to advertise
itself.
What's also a major problem MSJ: The keyboard used with
is 640K restrictions. It's im- ART is quite different from the
perative that we're able to normal PC-style keyboard. Tell
access lots of memory. For us something about it.
large data areas you can do REUTERS: The keyboard
something with RAM disks, uses an 80186, which gives it
but we really need MS-DOS more processing power than a
5.0. It seems to be receding in- PC. It is completely program-
to the far distance; every quarter mable, which we need since we
it seems to slip a quarter. The have many different instal-
whole point of a windows lations, which drive different
environment is to have mult- kinds of terminal keyboards.
iple simu ltaneous applications The keyboard we use lets us
running, and if memory limi- emulate any of these.
tations prevent loading more MSJ : What is the func tion of
than two applications, that's your proprietary communica-
really bad news. tions board?
If Microsoft is going to keep REUTERS : The board has its
faith with the developers of own processor and handles the
Windows applications, it has to commun ications link, which is
come out with MS-DOS 5.0- a multi-drop line protocol. The
or at least a mechanism for board also de-co uples communi-
THE ART PROVIDES LIM IT making large chunks of exe- cations process ing from Win-
cutable memory available. dows processi ng and does page-
WATCHING , USING caching. Information pages are
DIALOGS IN WHICH Cautious Interest put into cache memory so that
MSJ : You mentioned that in dealers will get a quicker
USERS ENTER UPPER the course of developing your response when changing pages.
product you had to come up· MSJ : Are you looking at any
AND LOWER LIMITS FOR
with some tricks to perform cer- of the new graph ics chips like
ANY CURRENCY. ain tasks. Do you ever share the Intel 82786 and TI34010 to
this information with other de- enhance the system?
velopers? Would, for instance, REUTERS: Yes. We've devel-
a user group benefit from your oped a super-high-resolution
experiences, or wou ld you graphics board that uses the
rather keep that kind of in- Intel chip, and we are waiting
fonnation to yourself? for Inte l to release the final ver-
REUTERS : I'd characterize sion. We were also impressed
our attitude as "cautious with the TI chip, and we're look-
interest." You must understand ing at it serious ly. We'll use the
that the major users of one that's up and running at
Microsoft Windows m the board production time.
U.K. are either our customers MSJ : Your windows work a
or competitors. And so, while little differently from the typical
we will certainly chat about our Microsoft windows. Why did

pcjs.org j
? . 000
DMPA +rrlt I ~.7300
II
? . 01" 400
1. 010 3~0

7 . 0(, ~ • ,00
? . 060
21SO
IH2 't3Q4

XAU
RHBG 376.00/377.30
PBlJS 3/6. 70/377. 70
RHOG :r/6.70/377.20
CSS(, 376.90/377.40
RHOG 3/6.80/377.30
XAG

17 : 12
17 : 04
16 ! 39
16 !41

The ART offers real-time graphics, user-defined montage pages, limit


and news watching, and graphics analysis. Individual currency
exchange rates are displayed in real-time graphs. Each time the value
of a currency changes, a new tick is added to the graph.

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
JOURNAL

you choose to have a common specialized applications within


menu bar? the financial marketplace.
REUTERS: We eliminated The thing that makes it so
the menus because we didn't useful is its ability to adapt
"WINDOWS IS AN want to waste any precious quickly to different high-reso-
screen space, and found that it lution screens. For example, we
EXTREMELY POWERFUL simplified usage. pulled in a Wyse PC with a
1280 by 786 monochrome
SET OF TOOLS. WE
Mouse-o-phobia? screen. In a couple of hours we
COULD NOT HAVE MSJ: What has been the reac- got the whole system running
tion of dealers to the mouse? in a totally different resolution,
BROUGHT TO MARKET REUTERS: We've had a different character sets, different
A PRODUCT OF THE positive response at demonstra- fonts and looking nice. If you've
tions we've given. No one who got a Windows driver for your
QUALITY OF THE ART has used it has ever let it go. display, you can port your
IN SUCH A We have found, however, that application onto it and make use
some people take time to adjust of the facilities provided by that
SHORT TIME FRAME to pointing with it-as long as display. It's that flexible.
WITHOUT IT." two to three hours. MSJ : Is there anything else?
MSJ: Now that you've had REUTERS: One of the most
considerable experience with it, imaginative ideas I've seen yet
what is your overall impression is that Microsoft has been adver-
of the Microsoft Windows en- tising in a specialist magazine,
vironment? called DOT.EXE. It's targeted at
REUTERS: Windows is an ISYs and offers, for four hundred
extremely powerful set of pounds, a one-day course in
tools. We could not have Microsoft Windows, which in-
brought to market a product of cludes an ISV tool kit and a
the quality of the ART in such Microsoft Mouse. We'll prob-
a relatively short time frame ably be plugging our new
without it. The learning curve people into it.
is reasonably short, too. An The credit for developing
experienced C programmer ART should go to a team of
will take only a matter of days high-powered programmers led
to get a simple application run- by Chris Oswald. They are the
ning. And in perhaps four to ones who deserve the credit for
five weeks he'll become fully doing an incredible job. •
productive, partly as a result of
support within the team.
A large number of people
on the team now know how to
use Microsoft Windows. Also,
the examples of working sys-
tems make the learning curve
easier. From that point of
view, I'm convinced Windows
is the right choice for Reuters.
As an environment for running
third-party applications, Win-
dows might not be the ideal
choice, but we're using it for

pcjs.org
OCTOBER 1986
Dynamic Data Exchange
Enhances Application
Connectivity
Harvey Berger

WINDOWS DYNAMIC
DATA EXCHANGE (DOE) IS
ment.
INTENDED TO FACILITATE
The Windows Clipboard is IMPLEMENTATION OF
what serves as the intermediate
repository for such information MORE COMPLEX
exchanges among applications.
A Step Forward
TRANSFERS THAN ARE
At your direction, information
is placed on the Clipboard by a The Clipboard's facilities are POSSIBLE WITH SINGLE
CUT or COPY operation in quite flexible, but they require
manual intervention for each
OR EVEN MULTIPLE
one application and then insert-
ed into the context of a second transfer, and the Clipboard can CLIPBOARDS.
application with a PASTE hold only one "item" at a time.
operation. In a multitasking environment
On the surface the process like Windows , the need rapidly
seems straightforward-a selec- develops for more sophisticated
tion, a CUT or COPY, and data exchange facilities. Win-
then a PASTE-and manual. dows Dynamic Data Exchange
But behind the scenes the two (ODE) is intended to facilitate
applications and Microsoft implementation of more com-
Windows combine to effect the plex information transfers than
actual transfer. The donating ap- are possible with single or
plication takes control of the even multiple clipboards.
Clipboard and places the ODE is a formal, public
selected information on it in protocol for data exchange built
one or a series of formats. The on Windows messaging. and
receiving application then the shared memory facility .
selects a format and requests the DOE is much more an
data from the Clipboard. agreement among cooperating
In many cases, to save applications than it is a partie-

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
JOURJ\'AL

Figure 1 : DOE Messages


of selected data to automatic par-
DOE Messages Purpose Argument 1 Argument 2
allel transfers of real-time data.
WM_DDE_INIT!A TE Ask if a window Atom ->Topic Since many ODE relationships
will exchange are likely to be more complica-
items related ted than those of the Clipboard,
to a topic DOE is described in terms of a
WM_DDE_TERMINATE End the exchange Atom ->Topic
server and client applications
of items related rather than in terms of a donor
to the topic and a receiver, where a si ngle
server may be supplying data to
WM_DDE_ACK Response to a Atom Acknowledge-
many clients and a single client
ODE message ment code
application may be commun-
WM_DDE_REQU EST Request a given Atom ->Item Name Desired data icating with many servers simul-
item format taneously.
WM_DDE_DA T A Contains a request- Atom ->Item Name Handle to Data Formats
ed data item data object DDE and the Clipboard share
a number of common facilities,
WM_DDE_ADV ISE Request a given Atom -> Item Name Desired data
item and automatic format most notably an extensible set
updating of data exchange formats. Ini-
tially Microsoft Windows recog-
WM_ DDE_UNADV!SE Request end of Atom ->Item Name Desired data nized a limited set of public
automatic updating format
formats for data exchange
for a given item
(TEXT, BIT MAP, META-
WM_DDE_POKE Contains an unsoli- Atom ->Item Name Handle to FILE, SYLK, DIF, and so
cited data item data object forth) and custom formats.
Concurrent with the announce-
WM_DDE_EXECUTE Request execution Handle to data
of indicated com- object contain- ment of DDE, Microsoft has
mand ing command announced five additional clip-
board data formats (Rich Text,
ular body of code or executable Table, Sub-Table, WKS, and
routine. It's a special usage of DBF).
Windows messages. Windows also allows cooper-
Windows applications rou- ating applications to register
tinely receive messages cor- custom formats for private
responding to user- and system- usage. The new formats allow
initiated actions ranging from the economical transfer of data
keystrokes to requests to re- with its formatting information.
paint the screen. DOE uses a Object Orientation
set of formerly reserved mes- A key distinction between
sage numbers to implement the Clipboard and DDE exchanges
protocol. In the Microsoft is DDE's object orientation. The
Windows environment any ap- Clipboard is used to transfer a
plication may send a message user selection from one applica-
to any other application, with- tion to another. Each Clipboard
out explicit knowledge of the transfer is independent; the se-
nature of the other application. quence of transfers corresponds
ODE is designed to facilitate to the sequence of user oper-
implementation of a wide vari- ations. With ODE each transfer
ety of data exchanges, ranging consists of an item associated
from sim p le one-time transfers with a "name."

pcjs.org
OCTOBER 1986
Names and Topics
typedef s t ruct (
When requesting or supply- WORD wDDEMODE ;
ing data, the names are provided WORD wFormat ;
DDEADVISEBLOCK ;
to allow the communicating typedef struct (
task to identify the source or WORD wClientRelease ;
WORD wFormat ;
disposition of the data item. WORD hServerWnd ;
Names describe either the loca- WORD ClipData ;
tion or the contents of a data UPD ATE I NFO ;
ATOM aCompare ;
item. In a spreadsheet, each cell
BOOL bAccepted ;
has an address (for example, lo ng FAR PASCAL Sa mpleRcvrW ndProc ( hWnd , message , wParam , lParam)
R2C3 for the cell in the second switch (message)
row and third column). Some
spreadsheets also have named
cell ranges (R I :4C5 , for ex- case WM_DDE_ ACK :
ample, might be named aCompare ~ HIWORD(lParam) ;
bAccepted ~ LOWORD ( lParam) ;
TOTALS). In either case, a /* Is this acknowledgement of first inquire message? */
natural relationship exists be- if ( (aCompare ~~ aStockinfo) && bAccepted)
hwndServer = wParam ;
tween names and data items. else I
With other kinds of applica- /* is this the acknowledgement of an advise message? * /
for (i ~ 0 ; i<NUMSTOCKS ; i++) (
tions, like word processors , if (aCompare ~~ stockinfo [ i] . Atom ) I
names are likely be to more /* Record Server ' s response to Stock Symbol * /

positionally oriented (page 3,


for example). The DOE proto-
col requires a name or a posi-
tional reference for each item to break ;
be transferred. case WM_DDE_DATA :
ProcessNewData(wParam , lParam) ;
By definition, each name, as break ;
recognized by the server, refers default :
return ( ( long ) DefWi ndo wProc (hWnd , message , wParam , lParam ) ) ;
uniquely to a specific data item.
break ;
The choice of names and topics
are the private concern of a return (OL) ;

server and its clients. Some


servers wi II associate names
relevant to a given subject with
a topic. Client applications document. With DOE it is pos-
typically ask potential servers sible to construct more com-
DoE IS DESIGNED TO
if they recognize (and can plex scenarios. In addition to FACILITATE
supply data about) the topic. saving the pasted chart, the
Where the server's names are in word processor might store the IMPLEMENTATION OF A
themselves very complete des- name of the chart, the file name WIDE VARIETY OF
criptions of data items, a worksheet it was associated
sample name may be used as with, and the file name of the DATA EXCHANGES,
the topic. Servers that define application program. Given RANGING FROM SIMPLE
topics should be worded care- that information , the word pro-
fully to avoid accidental dupl- cessor could ensure that it had ONE-TIME TRANSFERS OF
ication. the latest version of the chart. SELECTED DATA TO
First the word processor
Applications could, after verifying existence AUTOMATIC PARALLEL
In the first example the of the worksheet file, start exe- TRANSFERS OF
Clipboard is used to paste a cuting the spreadsheet appli-
chart into a word processing cation, specifying the work- REAL-TIME DATA.

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

Figure 3: Client's Window Creation Procedure


from the user repeating manual
SampleRcvrCreate(hwnd) steps (which he might forget) to
HWND hwnd ;
{
the PC using DDE.
HMENU hMenu ;
DDEADVISEBLOCK far *lpmem ; DOE Sequences
int i ;
/* DDEAddAtom is part of the global a t om manage r A sequence of DDE ex-
* in the dynamically li n ked library -- DDE . EXE * / changes between a client and a
aStockinfo- DDEAddAtom( (LPSTRI " NYSE . COM . STK " ) ;
/* For the first message , broadcast it to everyone ; server are referred to as
* When we return from this call , hwndServer will be valid sessions.(Figures 2, 3 , 4 , 5, 7,
* if a server exists. NULL as loword of lPararn means se r ver
* can be any application . */ 8, 9 show portions of sample
SendMessage( (HWND) - 1 , WM_DDE_INITIATE , hwnd , client and server applications.)
MAKELONG(NULL , aStockinfo)) ;
DDEDeleteAtom(aStockinfo) ; A session typically begins with
/* If Server isn ' t available , return . hwndServer an INITIATE message. A client
can ' t be null in a call to Post Message */
if (hwndServer -- NULL) return ;
application sends a WM_DDE_
/* Some Dummy Stocks for this e xample */ INITIATE to every other active
stockinfo [ 0) . Atom - DDEAddAtom ( (LPSTR) " T " ) ;
stockinfo{l) . Atom- DDEAddAtom( (LPSTR) " GM " ) ;
application (potential server) in
stockinfo[2) . Atom DDEAddAt om( (LPSTR ) " IBM " ) ; the system. The INITIATE
stockinfo[3) .Atom- DDEAddAtom( (LPSTR) " INDU " ) ;
message includes a topic or a
sample name. If an active server
is willing to exchange data re-
for ( i - 0 ; i< NUMSTOCKS ; i++ ) lated to the topic , it in turn
hmem[i) - GlobalAlloc (GHND , (DWORD ) 4 );
lpmem- (DDEADVISEBLOCK far *)GlobalLock(hmem[i)) ; responds with a WM_DDE_
lpmem->wDDEMODE- 0 ; /* I ' m not going to ACK his updates */ ACK message.
lpmem->wFormat - CF_TEXT ;
GlobalUnlock (hmem[i) l ; After establishing a session,
PostMessage( (HWND) hwndServer , WM DOE ADVISE , hwnd , the client and the server ex-
MAKELONG(hmem[i) , stockinf~{i) .Atom) I;
change messages according to
the operating rules of the server.
Servers may have implementa-
sheet file name and a DDE tion restrictions on the number
startup parameter. Then, using of clients or the types of
THE TERMS CLIENT AND DDE, the word processor could transfers it will honor. DDE
request retransfer of the graph. provides eight message types
SERVER ARE LARGLEY The exact procedures to be used that establish transfer protocols.
SEMANTIC, SINCE EITHER are left up to the developers of The terms client and server
the respective applications. are largely semantic, since either
APPLICATION CAN SEND Microsoft will most likely app li cation can send (or receive)
(OR RECEIVE) ANY issue guidelines soon for future any message type. In practice, a
application development. given application may be func-
MESSAGE TYPE. tioning as a server to one appli-
Chain Reaction cation and as a client to the
A scenario in which the chart same or another application.
is the result of calculations in a A simple example of a DDE
spreadsheet is also reasonable transfer would consist of the fol-
to envision. When printing the lowing sequence:
document, the word processor I. Application One broad-
might request the chart from casts an INITIATE message to
the graphics application, which those windows in search of a ser-
in tum might extract the ver that will discuss CHEM-
applicable data from the spread- ICAL FORMULAS.
sheet. The integration becomes 2. APP2, with a database of
involved, but the burden moves chemical formulas , responds to

pcjs.org
OCTOBER 1986
APPI with an ACK (acknow-
ledgement) message.
3. APPI then sends a RE-
QUEST message specifying
WATER as the desired item
P r ocessNe wDa ta (h wnd ,
HW ND hwnd ;
DWORD lStu ff ;
I
ATOM
HANDLE
aData
lStuff )

: HIWORD ( lStuff );
hDDEData: LOWORD ( lStuff ) ;
UPDATEIN FO far *lpDataBloc k ;
ID
name.
LPSTR lpData ;
4 APP2 responds with a text HDC h d c ;
string OAT A message pointing int i , c ;
/ * Make sure we ' re getting info only fro m our server * /
to WATER=H20. / * Note : hwndServer is a global variable * /
5. APPI then sends a if (h wnd !: h wn dServer )
re t ur n ;
REQUEST message for SALT. lpDataBlock : (UPDATEINFO far *) Global Loc k( hDDEData ) ;
6. APP2 responds with an for ( i : 0 ; i<NUMSTOCKS ; i++ ) {
if (aData : : stockinfo[i] . Atom )
OAT A message specifying
SALT=NaCI.

Real-Time Data GlobalUnlock ( hDDEData ) ;


DOE was developed in res- GlobalFree (hDDEData ) ;
ponse to the users' need for the
coupling of data from separate
applications. The stock market
is another classic example of
the need for ODE. During trad- ant Louis Cutrona, and the
iti:': FF: .; 1 ;; i•_ ~ h - H- 'l. ~7<'lV ll li }: ':.
ing hours there's a constant Charting program was written A.r.,;·. f:t<
ll::
t ~ ~- . to
Z!:N 1 ., 1! :: ll ~ 10 6 ~.,;-}: H !"'
.,
!l 0
~ t>t t> H N 1i
AE Wr! ':'"S .; -~ .; ':"t. :: "5 : ':'f -!-: ~ F }, 0
flow of data as each transaction by Mark Taylor of Microsoft. Ar'':'
A!:::
Etl ;: 4 -;: : '?':! 4 ·· : 1 ~· t<!.iK 1: t:
E~f: ~~ : _<.:; ~ ~~ S fll 7 ~•S-L ll t:
S 0
H' G
hY.C. •:.b'S ~.r 0 lC 0 14.:- : 14:0 l .<F!: '{ ! I tl l 10 S'? Hl
is processed by the exchanges. When brought together, the AV:. ·:F~ ~-, : ':'" 0 U '"J 3 t.~ ~- "·1-i: !i II t: ;,
Af:·~ 2I.7 : 1 :: l~ ::: 1 0 h S ,:,::;.r; }.' II A Y n
Market watchers need to filter two programs were able to com- Af':
iiE
i.~H :- - lS 1 l(: : 1- - H
?.Z'•' :.; f 1S 0 LS ~ H t;: li 1\ !I H'
t. ~ 1i i\
H ,
;..r:-~ ;.,~ ~ .; : s ~ t. : $ ~:o ; : l' » ·· N
the data stream and isolate the municate through DOE after .HJ'i ·': Ir:UJ !Hf S l3H -, nr~ " l: '~ ~ ;' 4!!
·u:c GE:c 101 : <~<; :? 10 .. l) lC!O o 1 :: t.l !l !' t<
transactions of interest to them. being developed 3,000 miles a- AE·:
J.F t;:;
~'11 ~rJ
~s
?t 0 ~·1
6~ o e.; 7 t:':
1 -~tl :; -;.:.01: :: ·; H :: : 1
:; ;3:; · 1> f :; :; :1
>~ iO

·A~:( r-.:..:
S3" S?- 0 S2 ::; S.3 0 .''"·K ti }l "i H ~-
The selected data is then ana- part. !1:: F"A: SB SB- 5 '"8: i: SB .;; ~:. !: ::' !-l ·; ti ·
u:-: ;,:~f .:.l e1 o ".? " t-~ o ~:: t: r :: ~- 1; ,'
lyzed to determine the required ,J,.r':!EY~c: s-1: ssos..;..:. <t-··i:t<!::~:: v
.U:: FF.!I 2>~ :0 i ~Q 7 ::0.4 S4·f: N !IN::')
A~:( r!.S -: -:- : 2 73 S 72 l l':!M: S 1i N f: D
action. One of the first demon- ADVISE-OAT A Ai:C EA: t.: 12 :< l3 ~ 11 :> ':'1111·: ? !1 Y H ';

strations of DOE modeled this In the first example above,


process. the transfers are relatively
A SignalTM receiver (sup- simple. For each REQUEST Mil 72.4 BAC 17.7
plied by Lotus Infonnation Net- message there's a corresponding
work Corporation) offered a con- OAT A . The ADVISE message
tinuous feed of stock prices (for allows for more complex trans-
up to 600 selected stocks). fers. In the following example
Normally the Signal receiver it accommodates the automatic
(connected to a serial port) sup- transfer of real-time data as it
plies data to special Lotus® changes.
software. For this demonstra- I. APP3 broadcasts an
tion Windows Terminal was INITIATE message to those
modified to detect price changes windows , looking for a server


and respond to ODE messages. with NY STOCK PRICES.
A simple bar-charting program
was then written to receive the
DOE DATA messages.
2. The Signal Monitor
Application Four (APP4) re-
sponds with an ACK.
I
Interestingly the SIGNAL 3. APP3 sends APP4 an
monitor program was written ADVISE message that specifies
in New York City by consult- IBM.®

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

Figure 5: Server's Window Procedure


in exchange for a 16-bit atom.
/* Procedures which make up the window class . */
The atom manager (a shared
long FAR PASCAL TermWndProc(hwnd, message , wParam , lParam ) executable library) will also
translate the atom to its corres-
ponding string. A single atom
switch (message) pool is maintained for all DDE
applications in the system.
In anticipation of sophisti-
case WM DDE INITIATE : cated client/server relationships,
dde_initiate( hwnd, wParam , lParam) ; DDE offers optional specifica-
break ;
case WM- DOE - ADVISE : tion of the Clipboard format for
dde advise( hwnd , wParam , lParam I ; data exchange, acknowledge-
break ;
case WM- ODE - UNADYISE : ment of messages, and shared
dde unadvise( hwnd , wParam , lParam I ; memory controls. Private client/-
break ;
case WM- DOE - TERMIN.'\TE : server priority schemes are also
dde - cancel ( hwnd , wParam , lParam I ; accommodated.
break ;
case WM- DOE- REQUEST :
Developers interested in the
dde request( hw n d , wParam , lParam I ; details of DDE, the central atom
break ;
case WM- DOE - EXEC UTE :
manager, or the new Clipboard
dde - execute( hwnd , wParam , lPara m I; formats can download the speci-
break ;
fications documents and sample
programs from either DIAL (see
page 28) or GENIE (see page
default : 16).
return(DefWindowProc(hwnd , message , wPa ram , lParam)) ;
break ; On the basis of early response
to the DDE design specification,
return (OLI ;
a significant number of the new
Microsoft Windows applications
now being developed will
4. APP4 responds with an incorporate DDE provisions.
ACK indicating that it recog- The nature of the implementa-
nizes IBM and can supply data tion depends on the type of ap-
about it. plication and its particular
6. APP4 then sends the features.
current price data for IBM.
7. Steps 3 to 5 are repeated Macros
for each stock of interest. Many applications, including
8. Each time APP4 learns of spreadsheets , databases , and
a new price for stock about charting programs, include user-
which it has received an AD- definable macros or other pro-
VISE, it sends an DATA mes- gramming capabilities. The DD-
sage with the new price. E design anticipates the comb-
ination of these applications
Atom Management based entirely on user pro-
To speed processing and gramming. If the application
simplify the development of implements a substantive part
DDE Servers, DDE applica- of DDE capabilities, the user
tions exchange "atoms" rather can supply the topics and item
than strings. A central atom names, constructing data rela-
manager allows all applications tionships not contemplated by
in the system to register strings the application developer. Gen-

pcjs.org
OCTOBER 1986
Figure 6: Foreign Intrigue

APP 5 LOCAL LOCAL AREA FOREIGN APP 6

~ <€]
CLIENT AGENT NETWORK AGENT SERVER

K K

eralized applications can thus


be combined into tightly Outside Influence
coupled customized applica- So far this discussion has
tions suites. been limited to communica- WHEN AN AGENT
This process is not as tions among applications run-
APPLICATION RECEIVES
complex as it might sound. In ning on the same PC. The
the bar chart example described principles of DDE are, how- A REQUEST
above, the user can spec ify , via ever, applicable to transfers of
data across machines, even com-
FOR OATA ABOUT A
a dialog box , the particular
stocks to be tracked. In a more puters of different types. GIVEN TOPIC, IT
generalized implementation, the The DDE protocol assumes
that (if possible) a request for
DETERMINES WHETHER
user might also have been
allowed to specify the topic, data exchange will be satisfied IT CAN SATISFY
directing the DDE message to a by "broadcasting" a request to
different server. If, hypothetical- all other tasks in the PC and THE REQUEST BY
ly, another server existed in the that one of those contacted will IN TURN SENDING THE
PC, it could supply the data to supply the desired data. If the
be plotted. Thus one instance data desired is not available loc- MESSAGE TO ITS
of the bar chart program might ally, DDE provides for the use "CORRESPONDENTS" IN
display stock market data, of "agents."
while another instance displays An agent is an application OTHER MACHINES,
temperature, pulse , and blood that serves as the importer/ex- WHICH MAY BE ABLE
pressure from a server con- porter of data. When an agent
nected to appropriate sensors. application receives a request TO SATISFY THE
This example may be far- for data abou t a given topic, it REQUEST.
fetched in the choice of data to determines whether it can satis-
be displayed side by side, but fy the request by in turn send-
it's reasonable to imagine the ing the message to its "corres-
development of common analyt- pondents" in other machines,
ical software that can be applied which may be able to satisfy
to disparate tasks. Microsoft the request.
Windows and DDE expand the A given agent might use a
potential market for analytical local area network , micro-
software by providing a proto- mainframe link, or other com-
col that is truly application munications faci lity to reach
independent. its correspondents. The corres-

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

Figure 7: Server's Initialization Procedure


pondent agent may then issue a
typedef struct DOE INITIATE (if it is located
(
WORD wHandshake ; in a PC) to locate the ultimate
WORD wFormat; server. The exchange of data
HWND hServerWnd ;
char szData[ MAXDATACHARS ] ;
then proceeds without either the
DDEUPDATEBLOCK ; client or the server being aware
of the agents.
typedef struct
(
WORD DDEMode ; Access Control
WORD wFormat ;
DDEADVISEBLOCK ;
While DOE does not explicit-
ly provide for access control or
typedef struct data security, a server applica-
(
int cActive ; /* Number of active clien t s-*/ tion has a number of altern-
ATOM a SymboL I* Atom identifies symbol *I atives at its disposal to validate
char szSymbol[ MAXSYMCHARS ] ; I* Text of the symbol name *I
HWND hwndClient[ MAXCLIENTS ] ; /* Handles of active clients */ the authority of a given client
HOT ITEMS; before exchanging data with it.
static HOTITEMS ODE[ MAXHOTITEMS ] ;
static DDEUPDATEBLOCK DDE UpdateBlock ; The server could require a pass-
static ATOM aStockinfo ; word or other access parameter
I• This atom means DDE INITIATE is for us *I
void dde_init() to be sent along with the topic,
transmit a REQUEST message
I* Atoms for WM_DDE_INITIATE *I
aStockinfo - DDEAddAtom( (LPSTR) " NYSE . COM . STK " ) ;
back to the client for the
password , or using the window
handle provided, access a lot of
information (from Windows)
about the client.
The DOE protocol is a frame-
Figure 8: Server's INITIATE Response Procedure work on which software dev-
elopers can construct private or
void dde_initiate( hwnd , hwndClient , lData ) public exchange mechanisms.
HWND hwnd ;
WORD hwndClient ; I* Contains client ' s window handle *I When exchanging data with
DWORD lData ; private (well-known) clients,
(
ATOM atom ; servers can supplement DOE
atom- (ATOM) HIWORD( lData ) ; with message priority , data
if( atom-- aStockinfo ) (
if ( IsWindow ( (HWND) hwndClient ) ) queueing, and private message
SendMessage( (HWND) hwndClient,WM_DDE_ACK , protocols. In addition to Micro-
hwnd , MAKELONG( TRUE, atom ) ) :
soft Windows' built-in facilities
for inter-application communi-
cation, very complete com-
munication facilities designs
can be implemented.

The Future
The fact that Microsoft Win-
dows is independent of any
physical device permits applica-
tions to take full advantage of
the capabilities of a wide var-
iety of current and future
displays, printers, and pointing
devices. Application devel-
opers are freed from having to

pcjs.org
OCTOBER 1986
Figure 9: Server's Response to Advise Request
be concerned in their programs
with the peculiarities of partic-
ular devices. ODE extends the
same concept to data exchange.
If an application honors DOE
requests, it's then able to com-
void
HWN D
WORD
DWORD
{
dde_advise( hwnd , hwndClient , lData )
hwnd ;
hwndClient ; /*Contains client ' s window handle •/
lData ;

ATOM
BOOL
GLOBALHAND LE
atom ;
b;
gh;
m
municate with all other applica- DDEADVISEBLOCK FAR * lpDDEAdviseBlock ;
int i ' j ' k;
tions that do so, without hav- LPSTR lps ;
ing to consider their pecu- char * p;
char sz[ 20 J ;
liarities. b ~
FALSE ;
DOE is an important step atom = (ATOM) HIWORD ( lData ) ;
/* Lookup Symbol in Table */
forward m inter-application if ( SymbolisAvailable ( atom ) ) {
communication, since it pro- gh (HANDLE) LOWORD( lData ) ;
vides a public protocol that ap- lpDDEAdviseBlock ~ (DDEADVISEBLOCK FAR*) GlobalLock( gh ) ;

plications can subscribe to if( lpDDEAdvlseBlock - >wFormat == CF TEXT


for( i ~ 0 ; i < MAXHOTITEMS ; i++ ) {
rather than requiring each appli- if ( DOE [i] . aSymbol ~~ atom ) {
cation developer to have to for ( j - 0 ; j < MAXCLIENTS ; j++
if( DDE[i] . hwndClient[j]~~(HWND)hwndClient)
consider all the possible appli- b = TRUE ; /*Already there * /
cations that users might want break ;
to exchange data with. The user if( !b /* if atom is there but client isn ' t */
can then combine programs and { for( ~ 0; j < MAXCLIENTS ; j++ )
I / * Look for an empty slot */
achieve results that no single if! DDE[i] . hwndClient[j]~~(HWND)NULL
application can offer. • DDE[i] . hwndClient[j]~ (HWND) hwndClient ;
DD E [i] . cActive++ ;
b ~ TRUE ;
break ;

if( b break ;

if( !b /* If atom is not already in the table */


{ for( i ~ 0 ; i < MAXHOTITEMS ; i++
{ if ( DDE[i] . cActive <~ 0 )
{ DDE[i] . aSymbol ~ atom ;
DDEGetAtomName( atom , (LPSTR) DDE[i] . szSymbol,
MAXSYMCHARS - l ) ;
DDE[i] . szSymbol[MAXSYMCHARS - l ] ~ ' \0 ' ;
DDE[i] . hwndClient[ 0 ] ~(HWND ) hwndClient ;
DDE[i] . cActive ~ l ;
b - TRUE ;
break ;

GlobalUnlock( gh ) ;

/* Acknowledge one way or the other */


i f ( IsWindow ( ( HWND) hwndClient ) )
SendMessage( (HWND) hwndClient ,
WM_DDE_ACK ,
hwnd ,
MAKELONG{ b , atom )
) ;
if ( b )
{
I* Transmit latest data we received */
if I gh = GlobalAlloc { GMEM_MOVEABLE ,
(DWORD) sizeof{DDEUPDATEBLOCK)))
&& lps (LPSTR) GlobalLock ( gh ) ) )
for { p ( char *) &DDEUpdateBlock , k = 0 ;
k < sizeof( DDEUPDATEBLOCK );
*lps++ = *p++ , k++ ) ;
GlobalUnlock ( gh ) ;
PostMessage( (HWND) hwndClient , WM_DDE_DATA , hwnd ,
MAKELONG( gh , atom) );

return ;

OCTOBER 1986

pcjs.org
MICROSOFT
SYSTEMS
.JOURNAL

GE's GENIE On-line Network Offers Expert Support for


Microsoft Windows Developers

General Electric Information Services' worldwide teleprocessing network is offering 24-hour on-line support for
Windows software applications developers through GENIE (General Electric Network for Information
Exchange). Access to GENIE and its variety of GE computer support services is through PCs and terminals via
a local phone line available in 450 U.S. cities.
The keystone of GENIE is the Microsoft Windows Developers RoundTable, an electronic interchange for
Windows developers. The RoundTable is sponsored and maintained by Microsoft and allows applications
developers to scan posted messages on the most recent Windows applications developments, access and
download technical updates on Windows, and electronically discuss with experts and other developers ideas on
multitasking, visual interface, and hardware independence capabilities.
GENIE's Developers RoundTable also includes such topics as Business-Band Real Time Conferencing,
electronic bulletin boards, and a downloadable library of software programs.
Additionally, GENIE supplies a full-service electronic mail system, GE Mail and current news about the
personal computing industry through the ISIS High Tech News Wire, the Networker's Journal, and Computing
Today! through GENIE's News and Commentary.
Requirements: IBM PC or compatible computer, asynchonous modem (either 300 or 1200 baud),
communication software package, telephone.
Current subscription rates for GENIE are $18.00 one-time enrollment charge, $35.00 per connect hour during
prime time (8 a.m. to 6 p.m. daily, including weekends and holidays), $5.00 per connect hour during
nonprime time (6 p.m. to 8 a.m. daily, including weekends and holidays).
Forfurther information about GENIE, call (800) 638-9636.

pcjs.org
SEPTEMBER 1986
New Intel Graphics
Coprocessor Makes
m
Windows Sparkle
Joe Desposito

new graphics coprocessor


from Intel, the 82786, is expected to substantially
enhance the performance of Microsoft Windows
and other graphics applications on the IBM PC,
XT, AT, and compatibles. The chip perfonns near-
instantaneous screen updates , draws graphic primitives such as
lines and circles at more than 2 million pixels per second, and cre-
ates text at a rate of 25,000 commands such as BitBLT (bit
characters per second. It also block transfer), ChaBLT (char-
supports multitasking and ultra- acter-block transfer), Increment-
high-resolution displays. at Point, and Fill. BitBLTs are
The 82786 has four major performed upon request from
components: a graphics proces- the CPU at a rate of 24 mega-
sor, display processor, bus in- bits per second. ChaBLTs occur
terface unit, and dynamic RAM at the rate of 25,000 characters
controller. These parts of the per second. The Incremental
chip communicate over a built- Point command is used to draw
in asynchronous bus. more complex figures. An incre-
The graphics processor ac- mental point list describes the
THE CHIP DRAWS
cepts commands from appli- figure's shape, and , once the GRAPHIC PRIMITIVES
cations programs to draw bit CPU sends the list to the
maps, which create objects in 82786, the graphics processor SUCH AS LINES AND
memory. The processor con- draws the shape at a rate of 2 CIRCLES AT MORE
tains a set of on-chip graphics million pixels per second. The
commands that draw points, Fill command instructs the THAN 2 MILLION
l lines, rectangles, circles, poly-
gons, and other primitives, to
graphics processor to fill in any
shape with horizontal lines.
PIXELS PER SECOND.
relieve the host CPU of the The coprocessor also has non-
task of creating these figures drawing instructions. For exam-
from scratch. To display any of pte, the Link command exe-
these figures on the screen , the cutes an unconditional jump to
CPU sends a single 16-bit another command, and Enter
request to the 82786 graphics Macro and Exit Macro are used
coprocessor. to call and return , respectively ,
To handle specialized drawing from a subroutine.
functions, the 82786 inc! udes The 82786 can receive a

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
JOURNAL

block of commands at one time handles up to 4 megabytes of


from the CPU, and do it while graphics memory and screen
executing other commands. rereshing.
Many of the graphics pro-
cessor's functions are imple- 82786 and Windows
mented in hardware rather than What will the 82786 do for a
Features
software. These include clip- product like Microsoft Win-
ping, mouse support, character- dows? According to Richard
• High-performance graphics set support, logical operations, Bader of Intel, "The 82786 will
and bit-plane masking. make Windows so responsive
• Fast polygon and line drawing The amount of display mem- that a computer like the IBM
ory is the only limitation on PC will no longer stand in the
• High-speed character drawing the number of character sets way of what the user wants to
that the 82786 can support. do . Operations that took seconds
• Advance DRAM controller for Any one can be activated by a to execute previously will now
graphics memory up to 4 megabytes single command. All character happen instantaneously. The
sets can have proportional 82786 enhances the intimacy be-
• Supports up to 200-MHz CRTs spacing or kerning. tween user and machine, and
-up to 640 by 480 by 8 bits The nex t major functional thus enhances productivi ty."
(1K•1 K•8) or 1400 by 1400 by block of the 82786 is the dis- Will W indows developers
1 bit (2K•2K•2) play processor. This part of the need to unders tand the intricacies
82786 is independent of the of the 82876 in order to achieve
• Up to 1,024 simultaneous colors graphics processor. Microsoft this high performance? Says
Windows would use the disp lay Bader, "When an 82786 board-
• Integral DRAM controller, shift processor to control display leve l product comes to market,
reg isters, and DMA Channel contents. it will have a Windows driver,
The display processor trans- which would then make the
• IBM PC Computer Graphics fers multiple bit maps from 82786 virtually transparent to
Adaptor compatbility memory to window areas on the applications program-
the screen. It also prov ides a mer-as transparent as the
• Hardware windows hardware cursor and colored Microsoft Graphics Device In-
borders around the windows. terface allows. When an app li-
• Fast bit-block copies between An almost un limited number of cations programmer uses any
system and bit-map memories windows can be displayed on graphics board, he needs to in ter-
the screen. rogate the GD I interface to find
• Integral video DRAM support To create windows , the dis- out specific characteristics of the
- up to 1900 by 1900 by 8 play processor divides the board such as the reso lution it
screen into strips and tiles. A supports and whether or not it
• Multitasking support strip is one or more horizontal supports color. The application
scan lines, and a tile is a is then adapted to those physical
• International character support section of a strip. A collection characteristics. But for the most
of tiles forms a window. part there is a great deal af
• Provides support for rapid filling Un like the graphics and dis- transparency provided by GO! ,
with patterns play processors , the bus-inter- and this will be applicable to
face unit and dynamic RAM new 82786 graphics boards."
• 88- pin grid array leadless contro ll er are invisible to the
chip carrier CPU software. The bus inter- An Ideal Application
face unit maintains the integ- One application that stands to
• Advanced CHMOS technology rity of a display by arbitrating gain significantly from the
requests for graphics memory. appearance of 82786 boards is
The dynamic RAM controller desktop publishing. Intel's Bader

pcjs.org
OCTOBER 1986
points out, "As Windows
evolves, we expect that it will
be ideally suited for desktop
publishing. And since the
82786 is so well suited as a
GDI device, we believe that the
82786 is also applicable to that
market." Many of the desktop
publishing packages currently
on the market take quite a long
time to reformat information
on the screen. And displaying a
variety of fonts on the screen is
time consuming and awkward.
Continues Bader, "The speed of
the 82786 will change all that.
Microsoft Windows in conjunc-
tion with the 82786 will give a
good performance."
The 82786 supports a wide
range of monitors, which is that 17-inch high-resolution
also a plus for desktop pub- monochrome monior. They're
lishing. It easily supports sys- looking for extremely crisp,
tems that are 640 by 480 with stable, high-performance text
64 colors. Additionally, Bader displays, and that's exactly
points out, "We can also sup- what the 82786 is capable of
port large-format screens, full- providing."
page displays, with a resolution Intel and Microsoft have
in the order of 1200 by 800, entered a cooperative program
1400 by 1400, or 1000 by 800 to provide Microsoft Windows
with gray scales. What we've software driver technology for
found in a number of instances systems designs using the Intel
is that people are looking for 82786. •

Graphics Instruction
64 Bit-Block Transfer Within Bit-Map 53 Draw Point
AE Bit-lock Transfer Across Bit-Maps B4 Draw Incremental Points
06 Define Texture: Opaque BA Draw Series of Horizontal Lines
07 Define Texture: Transparent 54 Draw Line
OA Define Character Set: Word 58 Draw Rectangle
OB Define Character Set: Byte 73 Draw Polygon
lA Define Bit-Map 74 Draw Polyline
3D Define Colors 8E Draw Circle
41 Define Logical Combination A6 Draw Character String: Opaque
46 Define Clip Rectangle A7 Draw Character String: Transparent
4D Define Inter character Space 44 Enter Pick Mode
4E Define Character Orientation 45 Exit Pick Mode
68 Draw Arc: Exclusion 4F Move to Absolute Position
69 Draw Arc: Inclusion 52 Move to Relative Position

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

Corporate software developers can receive introductory and advanced hands-on instruction on Windows
applications by participating in Windows development classes offered through Boeing Computer Services.
Microsoft Windows-Overview (Course No. 005)
This two-day course is designed for project managers, application development managers, application
designers, and programmers. Attendees should have experience in application development software.
Through lecture, instructor-led demonstrations, and student hands-on exercises, the course is a
comprehensive introduction to the Microsoft Windows environment. Subjects covered include the use of
Windows, the impact of a visual interface, resource management, use of the mouse, and basic application
development techniques.
Microsoft Windows-Application Programming Workshop (Course No. 006)
A five-day, hands-on workshop, this course is intended for software designers and programmers who are
interested in developing or converting applications to be used in the Microsoft Windows environment. To
take advantage of the many festures of Microsoft Windows, applications must be designed and written using
the Windows Development Tooolkit. This course covers the toolkit, structure of Windows' application,
and steps involved in builing the application. Team exercises are used to lead attendees through the
capabilities and complexities of Windows programming. The C programming language is used for all
exercises. Prerequisites for the course are successful completion of UNIX-C Programming Language
(Course No. 397), IBM PC/XT Hardware and Advanced DOS Concepts (Course No. 166), and Microsoft
Windows-Overview (Course No. 005), Applicable work experience may be substituted for the C
Programming.
Boeing Computer Services also offers its Windows training programs to developers on an on-site basis.
For additional information and scheduling, contact:
Boeing Computer Services
Education and Training Division
National Training Center
375 Corporate Drive South
Tukwila, Washington 98188.
Call, toll free, (800) 342-7700, or in Washington state, call collect, (206) 575-7700.

pcjs.org
OCTOBER 1986
Programmable Graphics
Processor from Tl
m
Perks up PC Pixels
I

Joe Desposito

exas Instruments® has developed Tffi53i010 PiHel Processing Demo


the first graphics microprocessor, the TMS340 l 0.
This is a significant development in the world of
graphics chips, which to date has been populated / ~ ~ !)
DST Sfl[ SRC AND AND- ZEH]
with less powerful graphics coprocessors and con-
~,: ~~ ~ ~~
trollers. The TMS3401 0 is a 32-bit processor that exec utes 6-mil-
lion instructions per seconds (MIPS), addresses up to 4-gigabytes
ofmemory, and includes special
pixel-processing instructions in
general registers contained in
the microprocessor than that
OR-

,·•:
/.NOR

(J "
DST-

tl
NOR

!il
DR

0
[l·iT

addition to a general-purpose in- found in general-purpose pro-


>JJR ·AND

;(i
ONE

~
-DR

9J
NAND

-<"".

,.
s~

struction set. cessors. Thirty 32-bit registers ..-mu ADDS SUB SUBS MA/. tt!N
The chip, which will en- are divided into an A fi le and a
2 2 PiHel Processing Options
hance all graphics applications, B file . This large number
is of particular interest to devel- prevents the shifting of bits
opers using Microsoft Win- between registers that often
dows on the IBM PC and com- occurs with graphics pro-
THE TMS3401 0 IS A
patibles, where up until now cessing. It uses a barrel shi fter 32-BIT MICROPROCESSOR
performance has been less than for high-speed bit rotations and
spectacular. The TMS340 l 0 can rotate a field of up to 32- THAT EXECUTES 6
will be contained in an add-on bits in a single instruction MILLION INSTRUCTIONS
board that will handle all the cycle.
graphics processing, replacing The microprocessor uses a PER SECOND,
the monohrome color graphics four-segment instruction cache ADDRESSES UP TO 4
or enhanced graphics display for loading instructions from
adaptor. memory before they are exe- GIGABYTES OF
cuted. Each segment has eight MEMORY, AND
Inside the TMS3401 0 subsegments, each holding
Like most microprocessors, eight bytes of code. Thi s 256- INCLUDES SPECIAL
the TMS34010 has an ALU, byte instruction cache speeds PIXEL-PROCESSING
general registers, stack pointer, up the execution of graphics
program counter, instruction algorithms by capturing loops INSTRUCTIONS IN
decoder, and control unit. How- of instructions. Once a loop is ADDITION TO A
ever, it also contains compo- captured, "fetch" memory
nents that optimize the chip for cycles in the loop halt. Loop GENERAL-PURPOSE
graphics processing. execution is fast because the
INSTRUCTION SET.
It has a far greater number of ch ip can access instruction

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

cache, internal register files , For multiple-bi t pixels,


and external memory simulta- which are usually associated
neously instead of sequentially. with color and gray-scale
The chip's input/output regis- graphics , the processor uses
ters include interrupt registers, arithmetic operations such as
host interface registers (for com- Maximum, Minimum , Add ,
municating with a host proces- Add with Saturate, Subtract, and
sor), video timing registers (to Subtract with Saturate. The
drive a CRT) , and local mem- Maximum and Minimum func-
ory control registers. tions are used to create a sense
To further increase speed , the of depth and to smooth jagged
TMS340 I 0 employs some of lines, a technique called anti-
the principles of reduced-in - aliasing. Add with Saturate and
struction-set computer (RISC) Subtract with Saturate are useful
chips; for example, it executes for dedicating multiple color
most of its instructions in a planes to each of the three pri-
THE TMS3401 0 USES single 160-ns cycle. mary colors.
A PixBLT instruction can
HIGH-SPEED
Pixel Processing expand a bit to one of two col-
INSTRUCTIONS CALLED In addition to approximately ors by taking one bit per pixe l
I 00 general-purpose instruc- data from memory, expanding it
PIXBLTs (PIXEL BLOCK to multiple-bit color data, and
tions, the TMS340 I 0 uses
TRANSFERS) TO HANDLE special high-speed instructions placing it anywhere in the frame
called PixBLTs (pixel block buffer. PixBLT instructions also
CHARACTER DISPLAY transfers) to handle character handle windowing, allowing the
AND BIT-MAPPED display and bit-mapped graph- placement of windows of vari-
ics . These instructions are an able size and content anywhere
GRAPHICS . PIXBLT extension of BitBLTs (bit- on the display, and cli pping,
INSTRUCTIONS INCLUD E block transfers) found in some which prevents drawing outside
graphics contro ll ers. Transfers the boundaries of a wi ndow.
BOOLEAN AND are made between source and The way the TMS34010
ARITHMETIC OPERATIONS , destination arrays using linear handles text generation is quite
addressing or X- Y coordinates. d ifferent from other processors.
EXPANSION OF A SING LE PixBL T instructions incl ude First , a display list, which
BIT TO ONE OF TWO Boolean and arithmetic opera- defines what is to be displayed,
tions , expansion of a single bit appears. For normal block text,
COLORS, TRANSPARENCY to one of two colors, trans- the list is simple; say , a list of
DETECTION , AND PLANE- parency detection , and plane- ASCII character codes. As text
masking. These types of in- becomes more complex , requir-
MASKING . structions can also be combined ing, for example , proportional
to perform a much larger set of spacing and kerning, the display
operations. list becomes more complicated.
The TMS340 I 0 operates on The TMS340 I 0 general-purpose
single-bit pixels, which are instructions typically break
usually associated with mono- down the display list, and then a
chrome graphics , by using its PixBLT is used to move this
Boolean operations on source image from off-screen memory
and desti nation arrays. The onto the screen.
common combining operations Texas Instruments is support-
are Replace, OR , NOT-AND, ing the TMS340 I 0 with a line
AND, and XOR. of software development and

pcjs.org
OCTOBER 1986
support products, including low- Microsoft's GDI (graphics de-
level assembly language tools, vice interface), many applica-
a C compiler with a run-time tions can be ported by using
support package, a function these standards.
library, and support of the CGI One way that developers can
(computer graphics interface) tap the potential of the chip is T HE DISTINGUISHING
standard. Hardware and software to port a graphics environment FEATURE OF THE
development systems are also like Microsoft Windows to it
available. at GDI levels. Thus any TMS34010 IS THAT THE
software application running PROCESSOR IS NOT
Building Applications through Windows could be ac-
Since the TMS340 lO is a celerated by a 32-bit graphics LIMITED TO A FEW
microprocessor, a software de- processor.
veloper has a great deal of However, many of the graph-
ALGORITHMS.
flexibility in determining what ics cards being developed are
runs on the graphics processor relatively "soft" cards, in that
and what runs on the host pro- they are RAM based. In effect,
cessor. Since the chip will also the command set for the board
support a number of graphics will be downloaded to it. As
standards such as CGI and Kevin McDonough of Texas In-

Graphics Instruction
ADDXY RS,RD Add Registers in XY Mode
CMPXY RS,RD Compare X and Y Halves of Registers
CPW RS,RD Compare Point to Window
CYXYL RS,RD Convert XY Address to Linear Address
DRAY RS,RD Draw and Advance
FILL L Fill Array with Processed Pixels: Linear
FILL XY Fill Array with Processed Pixels: XY
MOVX RS,RD Move X Half of Register
MOYY RS,RD Move Y Half of Register
PIXBLT B,L Pixel Block Transfer: Binary to Linear
PIXBLT B,XY Pixel Block Transfer: Binary to XY
PIXBLT L,L Pixel Block Transfer: Linear to Linear

.
r
PIXBLT
PIXBLT
L,XY
XY,L
Pixel Block Transfer: Linear to XY
Pixel Block Transfer: XY to Linear
PIXBLT XY,XY Pixel Block Transfer: XY to XY
PIXT RS,*RD Pixel Transfer: Register to Indirect
PIXT RS,*RD.XY Pixel Transfer: Register to Indirect XY
PIXT *RS,RD Pixel Transfer: Indirect to Register
PIXT *RS,*RD Pixel Transfer: Indirect to Register
PIXT *RS.XY,RD Pixel Transfer: Indirect XY to Register
PIXT *RS.XY, *RD.XT Pixel Transfer: Indirect XY to Indirect XY
SUBXY RS,RD Subtract Registers in XY Mode
LINE z Line Draw
Key to abbreviations: S (source register), D (destination register), R (register file select),
K (constant) , Z (draw option)

pcjs.org
OCTOBER 1986
:\11CROSOFT
SYSTEMS
.JOUR~AL

• 160-ns instruction cycle time

• Fully programmable 32-bit


general-purpose processor
with 128-megabyte
address range

• Pixel processing, X-Y


addressing , and window
clip/pick built into the
instruction set

• Programmable 1-,2-,4-,8-, or
16-bit pixel size with 16 struments points out, "This performing data compression
Boolean and 6 arithmetic pixel will give the cards tremendous algorithms. "You know that
processing options flexibility and tremendous when you draw images, they
(Raster-Ops) performance advantages. For ex- have to be stored on disk . And
ample, a program such as Auto- since the images take up a lot of
• 31 general-purpose 32-bit CAD running under Microsoft disk space, it makes sense to
registers Windows will run much faster compress them. Data com-
in the Windows environment. pression mostly involves bit
• 256-byte LRU on-chip You can probably gain another manipulation , which the TMS-
instruction cache performance factor of I 0 by 340 I 0 excels at, so it turns out
doing specific algorithms and that this chip is better than any
• Direct interfacing to both downloading them to the general-purpose processor for
conventional DRAM and graphics processor for specific doing image compression ."
multipart video RAM applications." Texas Instruments and Micro-
According to McDonough , soft have entered a cooperative
• Dedicated 8/16-bit host graphics boards incorporating program to provide Microsoft
processor interface and the TM340 I 0 processor are cur- Windowssoftwaredrivertechnol-
HOLD/HLDA interface rently under development at Vi- ogy for systems designs using
deo 7, Number 9, and other ven- the TMS340 I 0.
• Programmable CRT control dors. With graphics boards that
(HSYNC,VSYNC,BLANK) The distinguishing feature of incorporate the TMS340 I 0 pro-
the TMS340 I 0 is that the pro- cessor now under development,
• High-level language support cessor is not limited to a few a new world of graphics will
algorithms. Rather, any algo- soon open up to personal com-
• Full line of hardware and rithm, be it line , ellipse, circle, puter users. •
software development tools or whatever, can be program-
including a C compiler med . And similarly, for text,
the chip can be programmed for
• 68-leaded packaging (PLCC) any f01mat.
Karl Guttag, also of Texas
• 5-volt CMOS technology Instruments , points out that the
chip is also excellent at

pcjs.org
OCTOBER 1986
Developers' Aid :
Dialog Editor
Charles Petzold

,,
' "
he Microsoft Windows dialog box file Edit Stoles Control ODtlORS

is both one of the most important elements of a - " ·'


Windows application and the most difficult element
to design. Since dialog boxes allow the user to
, ,.,ooer
Fornat-
: General
: Fmd
Default Colunn lhdth: :~:
Detln.Jl Places: QJ
...
~:. Scient! he
se lect or enter information too complex for an ap- 0 Fast [ntr·y !lode i f.;
': Currency
plication's menu, they must be clearly and logically organized. Yet Ori•g Cu·cular· Cales
i
_c, conna
the graphical image of the dialog box is normally derived from a
template in a Resource Script dows applications, DIALOG is
rlext rornat-
) left
Q R!ght
Recalculation -------,
.) Auto
,) llanual
(. Rou-Utse
1:1Col -Utse
I
(. RC) file, where all the also an excellent tool to learn
coordinates and sizes are spec i- about the various styles , con-
I 1.::, Centered :. ttatural
-·--- l X
y : lt
:1~6

fied as numbers. For the pro- trol s, and options of dialog I


QQ ~ cx:13
~· : 12
I vork 1104e
grammer, editing the .RC file to boxes. The only problem is
get these coordinates and sizes that it is distributed without I Edt!
u
right (both in term s of clarity documentation . But like most
and aesthetics) is mostly a mat- Windows applications, some
ter of trial and error. creative playtime unlocks most
of it's treasures. T HE NEW DIALOG EDITOR
New Dialog Editor DIALOG saves files in two
The only help the original different formats : a .RES for- IS DISTRIBUTED AT
Microsoft Window s Software mat (the compiled format that WINDOWS DEVELOPMENT
Development Kit offered in it uses for later editing) and a
designing dialog boxes was the human-readable ASCII format SEMINARS AND CAN
barely adequate DLGEDIT- with the extension DLG. The ALSO BE DOWNLOADED
.EXE. If you've tried DLG- .DLG file contains the com-
EDIT and rejected it, don't over- plete dialog template as it FROM THE MICROSOFT SIG
would normally appear in a
look version 2 of the dialog
.RC file , with style parameters
ON COMPUSERVE .
editor, now called DIALOG.-
EXE. It's a complete rewrite expressed in terms of the macro
and a major improvement. A definitions from WINDOWS.H
beta test version of the new (such as Bs_pusHBUTTON)
dialog editor is distributed at and IDs identifying each control
Windows Development Semi- as specified in a header file for
nars and can also be downloaded the application.
from the Microsoft SIG on One .RES file created by
CompuServe. DIALOG can contain many
Aside from it's practical different dialog templates for
value in helping you create the application. You can begin
attractive dialog boxes for Win- a new file within DIALOG by

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOURNAL

selecting New from the File with something else, and assign
menu. To start a new dialog an ID to each control. These IDs
template, select New Dialog are usually macro definitions
from the Edit menu and switch from the application's header
between dialog templates by (.H) file. Your source program
using the View Dialog option can then reference each control
THE STYLES MENU of the File menu. by these names.
ALLOWS YOU TO FURTHER To fill up the dialog box Although DIALOG can read a
with various controls, use the header file and let you use the
REFINE THE CONTROLS, Control menu, which lists 12 name (rather than the number),
REPLACE THE WORD TEXT basic types of controls (such as it asks for the header file only
Check Box , Radio Button, when reading an existing RES
WITH SOMETHING ELSE, Push Button). If the control file. So, before you get too far,
AND ASSIGN AN ID TO uses text, it will simply show you'll want to save a new fi le
the word TEXT. You can select using the Save As option from
EACH CONTROL. the control for editing simp ly the Files menu , create a header
by clicking on it. By hooking file with define statements for
Glob•l W1ndow S t y l e s - - - - - -- - - - - , the sides or corners you can the IDs , read the file back into
0 CI ose Box I Sys tlenu Box 2
Border stretch and size it, and by DIALOG with File Open, and
0Horz Scroll Style 0 Capt 1on hooking the center you can enter the name of the header file
[]Group B1t
8 UPrt Scr oll Style
D1alo9 fr•.,.. rJ lab Stop B1t
move it around. when DIALOG asks for it.
From the Styles menu you
W1ndow !ext: [ 9 [
A Matter of Style have a choice of Class Styles
L---------------~ The Control menu lets you and Standard Styles. The op-
Ok Cance I se lect from the basic types of tions here let you refine the way
controls. The Styles menu the control appears on the screen
al lows you to further refine and how it works.
them, replace the word TEXT For instance, you might
llol lllll=-:

TRYOUT DIALOG 11 , 18 , 208 , 165


CAPTION " Mythical Windows Spreadsheet "
STYLE WS_BORDER I WS_CAPTION I WS_DLGFRAME I WS_SYSMENU WS POPUP
BEGIN
CONTROL " Number Format " 11 , " button ", BS GROUPBOX WS_CHILD , 12 , 4 , 64 , 76
CONTROL " General " ID_GEN , " button " , BS RADIOBUTTON WS_ GROUP I WS_TABSTOP I WS_ CHILD , 16 , 16 , 44 , 12
CONTROL " Fixed " ID_FIX , " button " , BS RADIOBUTTON WS_ CHILD , 16 , 28 , 40 , 12
CONTROL " Scientific " ID_SCI , " button " , BS RADIOBUTTON WS_CHILD , 16 , 40 , 53 , 12
CONTROL " Currency " ID_CUR , " button ", BS RADIOBUTTON WS_'CHILD , 16 , 52 , 45 , 12
CONTROL " Comma " ID_COM , " button " , BS RADIOBUTTON WS_CHILD , 15 , 65 , 46 , 12
CONTROL " Default Column Width :" 8 , " static ", SS_LEFT I WS_GROUP I WS_CHILD , 88 , 12 , 92 , 10
CONTROL " 9 " ID_DCW , " edit ", ES LEFT I ES_RIGHT WS BORDE R I WS_TABS TOP I WS_CHILD , 176 , 10 , 13 , 12
CONTROL " Decimal Places : " 17 , " static " , SS_LEFT I WS_CHILD , 88 , 28 , 66 , 10
CONTROL " 2 " ID_DPL , " edit " , ES_LEFT I ES_RIGHT I WS_BORDER I WS TABSTOP I WS_CHILD , 152 , 26 , 13 , 12
CONTROL " Fast Entry Mode " ID_FEM , " button ", BS_AUTOCHECKBOX I WS_TABS TOP I WS_CHI LD, 87 , 47 , 86 , 12
CONTROL " Flag Circular Cales " ID FCC, " button " , BS CHECKBOX I WS TABSTOP I WS_CHILD , 87 , 63 , 105 , 12
CONTROL " Text Format " 19 , " button " , BS_GROUPBOX-1 WS_CHILD , 12 , 84 , 64 , 52
CONTROL " Left " ID_LEF , " buLLon ", BS_RADIOBUTTON I WS_GROUP I WS _ TABSTOP I WS_CHILD , 16 , 95 , 28 , 12
CONTROL " Right " ID_RIT , " button ", BS_RADIOBUTTON I WS_CHILD , 16 , 108 , 48 , 12
CONTROL " Centered " ID_CEN , " button " , BS_RADIOBUTTON I WS_CHILD , 16 , 120 , 52 , 12
CONTROL " Recalculation " 3 , " button " , BS_GROUPBOX I WS_GROUP I WS_CHILD , 88 , 84 , 109 , 52
CONTROL " Auto " ID_AUT , " button " , BS RADIOBUTTON I WS GROUP I WS TABSTOP I WS CHILD , 96 , 97 , 28 , 12
CONTROL " Manual " ID_MAN , " button " , BS RADIOBUTTON I ws::::CHILD , 96 , -108 , 39 , 12 -
CONTROL " Row-Wise " ID_ROW , " button " , BS RADIOBUTTON I WS_CHILD , 148 , 96 , 47 , 12
CONTROL " Col-Wise " ID_COL , " button " , BS RADIOBUTTON I WS_CHILD , 148 , 108 , 45 , 12
CONTROL " Natural " ID_NAT , " button " , BS RADIOBUTTON 1 WS _ CHILD , 148 , 119 , 44 , 12
CONTROL " OK " 0 , " button ", BS_DEFPUSHBUTTON I WS_GROUP I WS_TABSTOP I WS _ CHILD , 48 , 1 44 , 47 , 14
CONTROL " Cancel " 0 , " button ", BS PUSHBUTTON WS TABSTOP WS_CHILD , 120 , 144 , 47 , 14
END

pcjs.org
OCTOBER 1986
fi.
select Push Button from the stop also, but you can pick
Control menu, which will dis- another control as the tab stop [dit Control Styles-----------,
play text in a rounded rectangle if you'd like the c ursor to jump ~ Left Aliqned 0 ~ltiple Lines
and is often used for things like to the middle of a group. r,Centered 0 Auto Uert. Scroll
OK and CANCEL If you want ~Right Ahgned O Auto Horz . Scroll
a default setting for the push Make Sure It Works
· 0 Ho Hide Selection
button (which has a bold out- Of course, now you' ll have Vindow Text: 9
line) , you first select the push to recompi le to see if the thing ID Syllt10l: r.jll~l========~
button control for editing, works right. Well, not quite
bring down the Class Styles yet. You can now pick Test Ok Cancel
option of the Styles menu , and Mode from the Options menu
select Def Push Button. An- and test the tab stops and
other example: The d ialog box groups from within DIALOG. Group I Control Ordering
itself is initially shown with a Thi s test mode is one of the
simple frame. You can add a nicest features of the program.
caption bar and a system menu DIALOG is not perfect. You
box by selecting those options
from Standard Styles.
Controls in a Windows dia-
log box are generally organized
by "groups" and "tab stops."
should watch out for a few
things: If yo u want to delete a
specific control from the dialog
box , first se lect it and then
pick Clear Control from the
. Col -llise
Hatural
I S~
I SS
a 10
I Radio B
I Radio 8
I Radio B
) ------------- ----- -- ----------------- .
Controls marked as tab stops Ed it menu. The Cut Dialog
can be navigated using the tab option of the Edit menu deletes
key . Within a group, however, the who le dialog box and every-
you can use the arrow keys.
You can mark controls as
thing in it. You can get it back
by selecting Paste Dialog from
You cAN
groups and tab stops from the the Edit menu, but it's a little REORDER THE
Standard Styles option of the disconcerting to see the whole
Styles menu. However, if thing disappear.
CONTROLS AND
you've been designing you r Icons do not work right. SELECT GROUPS AND
dialog box in a free-form You should be able to identify
manner, you'll find that the tab an icon by typing the name in TAB STOPS THROUGH
stops will bounce around from the Text field of the C lass THE ORDER GROUP
item to item in the order that Styles box . However, DIA-
you've created them rather than LOG will ignore this name. OPTION OF THE
a visually logical order. You can either avoid using OPTIONS MENU.
Fortunate! y, you can both re- icons in dialog boxes or enter
order the controls and select in the name later using a text
groups and tab stops through ed itor.
the Order Groups option of the The worst problem does not
Options menu . This shows a lie wi th DIALOG. Preferably,
li st of all the contro ls you've you should be able to include
Chapter 7 (pages 14 7 to 174) of the
created. Selecting a control the .DLG fi le created by
Microsoft Windows So./fware Del'e!op-
with the mouse and placing the DIALOG in the application's
ment Kit Programming Guide (for a
horizontal black bar cursor in a Resource Script (.RC) fi le, as:
general discussion of controls and dialog
different location moves the
boxes).
control. To define a group, yo u #include " myprog . dlg " Section 6.2.6 (pages 292 to 307) of the
have to mark only the first and
Programmer's Reference (for the forma t
last control of the group. You However, the RC.EXE re-
of the DIALOG template).
wou ld usually flag the first source compi ler version 1.00
contro l of the group as a tab will not correctly process an

pcjs.org
OCTOBER 1986
MICROSOFT
SYSTEMS
.JOUR~AL

include file in the resource


script unless the include file
contains only define state-
§ llyth1c.;l lhndo11s Spreadsheet ments. Until this problem has
been fixed, you'll probably
llllber For!W t
0 General
Default Colu.n ~idth: [JO have to copy the .DLG file into
your .RC file manually. You'll
0 Fixed DeciiWl Places :~
also want to use a different
0 Scientihc name for the .RES file that is
0 Currency [SJ Fast Entry Hode
created by DIALOG and used
0 CoMa 0 Flag C1rcular Cales for future editing. Otherwise,
DIALOG's .R ES file will be
Text ForiWt Recalculat 1on - - - - - - ,
overwritten when you run the
0 Left 0 Auto \,-. Row-Ill se
RC resource compiler. Al-
0 Right 0 Manual () Col - ~Ise
though DIALOG can read and
o -centered 0 Hatural properly modify a RES file that
it did not create and which
Cancel ) contains information other than
the dialog boxes, it would prob-
ably be safer to let DIALOG
work with its own .RES file. •

Microsoft's DIAL Offers Users Electronic Access to


Microsoft Customer Support

Microsoft Direct Information Access Line, DIAL, is an on-line data service offering Microsoft product users
electronic access to Microsoft's Customer Support Engineers. The program provides for the preparation,
transmission, and administration of Technical Assistance Requests used to report problems, request infor-
mation, make suggestions, and receive solutions and answers to inquiries.
In addition, DIAL provides direct acccess to Microsoft electronic mail (email) for communication with account
managers as well as access for bulletin boards that have information about known bugs, common questions and
answers, application notes by product, as well as other information.
DIAL also provides automatic code updates and the ability to transmit binary and ASCII files along with
Technical Assistance Requests.
Requirements: IBM PC or compatible with at least 128K of memory, asynchronous communications adapt-
er (RS232 card) or modem card, 1200- or 300-bps modem connected to a good-quality telephone line.
Additional information about DIAL can be obtained by calling: (206) 882-8080.

pcjs.org
OCTOBER 1986
Ask Dr. Bob!
message, the Windows appli-
Multitasking? cation dispatches it to the
Dear Dr. Boh, appropriate procedure in the pro-
I'm confused: Is Microsoft gram. This procedure can either
Windows a multitasking envir- act on the message or ignore it.
WHEN IT GETSA
onment or not? Sometimes it Microsoft Windows switches
seems like it is, and sometimes between applications when an MESSAGE, THE
it seems like it isn't. What's application polls for a message
the story, Dr. Bob ? -Confused by using the GetMessage call WINDOWS APPLICATION
or the similar WaitMessage
call. Once it has the message, DISPATCHES IT TO THE
Dear Confused, the application can take as long
Most people think of multi- as it wants, without interrup-
tasking as a process requiring tion. In the interim other appl-
APPROPRIATE
time-slicing. In a traditional ications (for instance, the
multitasking environment, the CLOCK) will stop working.
PROCEDURE IN THE
operating system switches be- Polite Windows applications
tween different tasks by allo- check frequently for messages
PROGRAM. THIS
cating short periods of time to while performing lengthy
each. Microsoft Windows does chores. This way they can yield
PROCEDURE CAN
not yet time-slice between ap- control to other applications
plications. Windows will proba- and give them an opportunity EITHER ACT ON THE
bly use time-slicing for multi- to run.
tasking only when MS-DOS However, if a Windows MESSAGE OR
also does so. application needs an unbroken
Instead, Windows has a non- chunk of time (say, for high- IGNORE IT.
preemptive multitasking sched- speed real-time data acquisi-
uler for running Windows appli- tion) , it can take it. The ap-
cations (programs written plication can interrogate the
specifically for Microsoft Win- mouse and the keyboard, write
dows) . A Windows application to the screen, and do everything
will not be interrupted if it does it needs to do-all without
not want to be interrupted; only interruption. It just has to
when it specifically relin- avoid looking for more
qui shes control do other appli- messages.
. cations get a chance to run . So Microsoft Windows is
A Windows application nor- multitasking , but it's up to the
mally sits in a loop waiting to individual Windows applica-
receive messages, usually exe- tions when to allow multitask-
cuting a GetMessage call. The ing with other applications and
messages it receives cover all when not to.
the events (keystrokes , mouse For "good old applications"
movements , window resizing, (MS-DOS applications that
and so forth) that affect the don't write directly to the dis-
application. When it gets a play and that can run in a

pcjs.org
OCTOBER 1986
I

MICROSOFT
SYSTEMS
JOURNAL

window), Windows yields con- segment references after moving included only graphics sup-
trol to other applications during data. port-would have to be more
keyboard input and screen complex.
output. But for old applications No Software
that do write directly to the
display , Microsoft Windows
Interrupt Executive
suspends all multitasking but Dear Dr. Boh, Dear Dr. Boh :
still allows the user (in most Is there some kind ()/' S()ftware Can I execute a Windows appli-
cases) to switch among appli- interrupt or other hook I can cation .fi"om within another
cations. use to access Microsoft Wind- Windows application?
ows procedures fi'om within a -Stumped
Compilers program I write in another Dear Stumped ,
language , such as BASIC or Sure. That's what the MS-DOS
Dear Dr. Boh. Turho Pascal ? Can I get at Executive does . The rec-
Why do I need to use Microsoft Windm1's graphics fi111ctions ommended method for executing
compilers for dneloping any other way? a program from a Windows ap-
Windows applications.? - Fmstrated plication is with an assembly
- Pu::::led language subroutine using the
Dear Frustrated, EXEC function call Ox4B .
Dear Puzzled , No. Windows functions are not Windows intercepts this MS-
Right now the only compilers accessed through a software DOS call and can correctly load
that support Microsoft Win- interrupt. The Windows loader the new format executable.
dows are the Microsoft C and resolves all function references The EXEC function call
Pascal compilers. You can also in the new format executable at returns to the calling program
program Windows applications load time. This means that right after the child process has
in assembler, but the most only programs in the new EXE been loaded . Under MS-DOS,
convenient way to do that format can access Microsoft the calling program doesn't get
would be to use assemb ler Windows functions. control back until the child
routines called from a C pro- It might be possible to write process has tenninated.
gram. Microsoft has made a shell program as a Windows You can even execute an old
public the relatively minor application that would provide application from a Windows ap-
support for Windows that a C a path for other programs that plication or vice versa. You can
compiler requires, and so other are not Windows applications to get a little sense of what hap-
compilers may also support call Windows procedures. But pens in this latter case by run-
Microsoft Windows. this task would be very diffi- ning COMMAND.COM from
A C compiler for Windows cult. Moveover, these programs Microsoft Windows. If you lie
requires procedures to be "Pas- would almost certainly have to in the PIF file and say that
cal" (arguments are pushed on be fixed in memory and could COMMAND.COM writesdirect-
the stack from left to right and not be moved . ly to the screen, you'll find that
that the procedure itself adjusts The WINOLDAP module executing a Windows appli-
the stack). Normally , C pushes allows some old applications to cation from the MS -DOS com-
arguments right to left and ad- run in a window, by providing mand level results in the "This
usts the stack after returning one type of shell that intercepts program requires Microsoft Win-
from the procedure . The C com- DOS and BIOS calls and trans- dows" message.
piler must also allow mixed- lates these calls into Windows If you run COMMAND-
model programming with the functions . This shell is one of .COM in a window and enter
"near" and "far" key words. Windows' more complex fea- the name of a Windows appli-
Procedures called from Micro- tures , since it must deal with cation , however. it wi II load cor-
soft Windows must have a many of the nasty things that rectly and take over the area of
small prolog and epilog so that old applications do. A more the screen occupied by
Windows can adjust data extensive shell--even one that COMMAND.COM. When you

pcjs.org
OCTOBER 1986
bring up COMMAND.COM These temporary files begin
again, you'll see the cursor with a tilde(-) and have the ex-
sitting at the MS-DOS prompt. tension TMP.
The Windows application has If you do Windows program
been loaded, and Windows has development, you should also
include the following statement
WINDOWS CAN TAKE
returned control back to
COMMAND.COM. in your AUTOEXEC.BAT:
SET TMP=D : \ ADVANTAGE OF A RAM-
This statement directs the
Expanded RAM Microsoft C Compiler to use DISK ON AN EXPANDED
Dear Dr. Boh. the RAM-Disk for its tem-
Can Microsoft Windows use Gil porary files. MEMORYBOARDBUTNOT
e.1panded memory hoard.7 To use drive D: as a swap-
- Fu::y
SwapDisk=? OF EXPANDED MEMORY
Dear Fuzzy,
with
Yes and no. Microsoft Win- ITSELF. HOWEVER ,
SwapDisk=D
dows can take advantage of a
RAM-Disk on an expanded ping disk for old applications,
memory board but not of ex- replace the line in your
WINDOWS SUPPORTS THE
panded memory itself. How- WIN.INI file that reads
ever, Windows supports the use Beyond using a RAM-Disk USE OF EXPANDED
of expanded memory by old ap- in expanded memory, neither
plications by preserving and Microsoft Windows nor Win- MEMORY BY OLD
restoring the state of the Ex- dows applications use expanded
panded Memory Manager. memory directly. (A future APPLICATIONS .
Let's look at these two version of Windows may have
topics separately. more support for expanded
The presence of any high- memory.)
speed disk storage will improve However, Microsoft Win-
Windows' performance. Win- dows can detect the presence of
dows uses the disk for storing an expanded memory board. If
temporary files from Windows it finds one, Windows can let
applications and for swapping old applications use expanded
old applications in and out of memory in the multitasking
memory . The disk used for environment without memory
these purposes can be any real contlicts. Windows will save
or virtual disk on your system , the contents of the expanded
including any type of RAM- memory board registers and
Disk. A RAM-Disk installed in restore them when switching
expanded memory is ideal. among applications.
If your RAM-Disk is in- Some early Expanded Mem-
.. stalled as drive D: (for in- ory Managers did not include
stance) , put the following state- full support of the "Get/Set
ment in your AUTOEXEC- Page Map" (function I 5) of the
.BAT: Expanded Memory Speci-
SET TEMP=D : \ fication Release 3.20. This call
This statement directs is the one Microsoft Windows
Microsoft Windows applica- uses to save the contents of the
tions to store temporary files expanded memory board reg-
(for instance , those created by isters. For this reason, Release
WRITE) on the RAM-Disk. 3.20 versions of the Expanded

OCTOBER 1986

pcjs.org
MICROSOFT
SYSTEMS
JOURNAL ~

Memory Manager are included subset of the IEEE standard, is If you need to write formatted
with Windows. These drivers faster and . smaller (but less text output to the screen, you
are called EMM.PC and accurate) than the 8087 -emula- can use sprintf and display the
EMM.AT; they work only tion code of the other floating resultant string with Windows
with the Intel Above Boards. point math libraries. The alter- TextOut procedure.
You can also use any Expanded nate math library does not use
Memory Manager, Release an 8087 even if one is present.
3.20 or later, supplied with an When the 8087 floating point
Intel Above Board. Before libraries are eventually modified Instances
using any other expanded for Windows, upgrading the pro- Dear Dr. Bah.
memory board, check with the gram should only require re- What happens when I run the
manufacturer to determine if the linking it with LINK4. same program simultaneously
Expanded Memory Manager In the interim, you could in Microsoft Windows? Are the
provides Release 3.20 support define your own floating point two versions entirely distinct or
of the "Get/Set Page Map" call. routines that use either the do they share code and data ?
regular C library routines or the --Unclear
assembly language subroutines
Math using the 8087, depending on Dear Unclear,
Coprocessor the presence of the math co- When an application is loaded
Dear Dr. Bah, processor. more than once, the loadings of
Can Windows applications use the application are referred to as
an 8087 or 80287 math different "instances." Generally,
coprocessor? Printf multiple instances of the same
-Pe1plexed Dear Dr. Bah, application share the same code
What happens in a Windows segment but have different data
Dear Perplexed, application if I try to write to segments. Windows applica-
Yes. Microsoft Windows pro- the Display in the conventional tions also share resources such
vides full support for saving way using the C function as menus, icons, cursors, and
the state of the math copro- printf? -Stymied bitmaps, since such resources
cessor and restoring it when are read-only data.
switching among applications. Dear Stymied, During initialization, an ap-
That's the good news. Nothing. Microsoft Windows plication can determine whether
However, Windows applica- intercepts all DOS and BIOS or not it is the first instance of
tions cannot yet use the 8087 output headed for the display that application. If it is not the
floating point libraries provided and dumps it into the bit first instance, it can retrieve
with the Microsoft C Compiler bucket, where it is never seen some data that must be shared
(version 3 or 4). This problem again. from the previous instance. •
lies with the libraries them-
selves rather than with Win-
dows support of the 8087.
If you want to use floating
point in a Windows application
written in C, you must cur- Dr. Bob wants to hear from you. Send him your questions
rently use the /FPa compiler and comments about Windows, DOS, C, Xenix, applications
switch and link with the development, romance, life after 40, life after death, love and
SLIBFA.LIB, MLIBFA.LIB, or money, life after marriage, war and peace, life on other
LLIBFA.LIB-depending on planets, the best restaurants, and life after applications devel-
your memory model-alternate opment. Address them to Dr. Bob, c/o H. Roark & Asso-
math library. The alternate ciates, 141 E. 44th St., Suite 804, New York, N.Y. 10017.
math library, which uses a

pcjs.org
OCTOBER 1986
Microsoft Corporation assumes no liability for any damages resulting from
. the use of the information contained herein .

Microsoft, the Microsoft logo, MS-DOS, and XENIX are registered


trademarks of Microsoft Corporation. Intel is a registered trademark of Intel
Corporation . IBM is a registered trademark of International Business
Machines Corporation. Lotus is a registered trademark of Lotus
Development Corporation. Texas Instruments is a registered trademark of
Texas Instruments, Inc.

pcjs.org
MICR~SOFt
pcjs.org
0000-00-201

You might also like