
		      Windows Server Package 95
			   Windows Library
			 --------------------
			 compatibility issues


Windows Library included in Windows Server Package 95 doesn't provide
the full compatibility with programs created with Windows Library 2.x
(included in Windows Server Package 3.x/4.0). However, converting the
source code is quite simple.

Here is a list of changes in Windows Lbrary (compared to version 2.2)
with some comments. Note that functions which use UINT (32-bit)
instead of UINT (16-bit) or have similar differences due to new
(changed) Windows 95/NT types are not listed here.

The functions listed by the following categories:

	- functions removed (comments contain recommendations what
	  functions you should use instead);
	- new functions (see the reference);
 	- changed functions - major updates (list of functions where
	  the parameter types and/or return value were seriously 
	  changed);
	- changed functions - minor update (list of functions where
	  parameters/return value become 32-bit instead of 16-bit).

Other changes described at the end of this document.


Functions removed (obsolete)
----------------------------------------------------------------------

_lclose			use CloseFile
_lcreat			use CreateFile
_llseek			use SetFilePointer
_lopen			use CreateFile
_lread			use ReadFile
_lwrite			use WriteFile
AppExec			use WinExec
DefWindowProc		doesn't needed anymore
Escape			use AbortDoc, EndDoc, EndPage, StartDoc & StartPage
GetBitmapFromDC		SaveBitmapFile now accepts HDC as parameter
GetBitmapSize		doesn't needed anymore
GlobalCompact		no meaning in the 32-bit environment
SetMenu			use AssignMenu


New functions
----------------------------------------------------------------------

AbortDoc
CloseFile
CopyFile
CreateFile
DeleteFile
EnableWLib
EndDoc
EndPage
FreeDDElParam
GetFileAttributes
GetFileSize
GetLastError
GlobalMemoryStatus
GlobalReAlloc
LoadProtocolExtension	
MoveFile
ReadFile
RetrieveMessage
SetFilePointer
StartDoc
StartPage
UnloadProtocolExtension
UnpackDDElParam
WinExec
WriteFile


Changed functions (major updates)
----------------------------------------------------------------------

DispatchMessage		now accepts message as a parameter
AssignMenu		parameter becomes 'HMENU' instead of 'char *'
GetCursorPos		returns 'BOOL'
SetCursorPos		parameters become 'int' instead of 'short',
			returns 'BOOL'
GetWindowScrollerPos    returns 'BOOL'
MessageBeep		accepts 'UINT' as a parameter
DrawMenuBar		returns 'BOOL'
CreateWindow		parameters order changed
CloseWindow		returns 'LONG'
SetWindowText		returns 'BOOL'
GetWindowText		returns	'int'
ReleaseCapture		returns 'BOOL'
DisableDCBuffering	returns 'BOOL'
FlushDCBuffer		returns 'BOOL'
ReleaseDC		returns 'int' instead of 'HDC'
LoadBitmapFile		parameter becomes 'int *' instead of 'short *',
			returns 'PDIB' instead of 'HDIB'
SelectBitmapToDC	almost all parameters changed,
			returns 'BOOL'
SaveBitmapFile		parameter becomes 'DIB' instead of 'HDC'
PostMessage		almost all parameters changed
SendMessage		almost all parameters changed
PeekMessage		almost all parameters changed


Changed functions (minor updates)
----------------------------------------------------------------------

GetWindowWord		parameter becomes 'int' instead of 'short'
SetWindowWord		-"-
GetClassWord		-"-
SetClassWord		-"-
GetWindowLong		-"-, returns 'LONG' instead of 'DWORD'
SetWindowLong		-"-
GetClassLong		-"-
SetClassLong		-"-
ExitWindows		parameter becomes 'UINT' instead of 'WORD'
MessageBox		parameter becomes 'UINT' instead of 'WORD',
			returns 'int' instead of 'short'
ChildWithId		parameter becomes 'int' instead of 'short'
LoadIcon		parameter becomes 'int' instead of 'short'
LoadCursor		-"-
GetSystemMetrics	parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
SetTimer		parameters become 'UINT' instead of 'short'
			and 'WORD', returns 'UINT' instead of short
KillTimer		parameter becomes 'int' instead of 'short',
AppendMenu		parameters become 'UINT' instead of 'WORD'
CheckMenuItem		parameters become 'UINT' instead of 'WORD',
			returns 'DWORD' instead of 'BOOL'
EnableMenuItem		parameters become 'UINT' instead of 'WORD'
GetMenuItemCount	returns 'int' instead of 'WORD'
GetMenuItemID		parameter becomes 'int' instead of 'short',
			returns 'UINT' instead of 'WORD'
GetMenuState		parameters become 'UINT' instead of 'WORD'
			returns 'UINT' instead of 'WORD'
GetMenuString		parameters and return value become 'UINT'/'int' 
			instead of 'WORD'/'short'
GetSubMenu		parameter become 'int' instead of 'short'
InsertMenu		parameters become 'UINT' instead of 'WORD'
ModifyMenu		parameters become 'UINT' instead of 'WORD'
ShowWindow		parameter becomes 'short' instead of 'int'
MoveWindow		parameters become 'int' instead of 'short'
CreateButton		parameter becomes 'int' instead of 'short'
CreateStatic		-"-
CreateGroupBox		-"-
CreateListBox		-"-
CreateComboBox		-"-
CreateCheckBox		-"-
CreateRadioButton	-"-
CreateScrollBar		-"-
CreateEdit		-"-
GetId			returns 'int' instead of 'short'
SetScrollPos		parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
GetScrollPos		returns 'int' instead of 'short'
SetScrollRange		parameters become 'int' instead of 'short'
SetScrollLine		parameter becomes 'int' instead of 'short'
SetScrollPage		-"-
GetCheck		returns 'UINT' instead of 'WORD'
GetRadio		-"-
SetCheck		parameter becomes 'UINT' instead of 'WORD',
			returns 'UINT' instead of 'WORD'
SetRadio		-"-
AddString		returns 'int' instead of 'short'
DeleteString		parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
GetCount		returns 'int' instead of 'short'
GetSelIndex		-"-
GetSelString		parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
GetString		-"-
GetStringLen		-"-
InsertString		-"-
SetSelIndex		-"-
SetSelString		-"-
GetEditText		returns 'int' instead of 'short'
GetEditInt		returns 'UINT' instead of 'WORD'
SetEditInt		parameter becomes 'UINT' instead of 'WORD'
GetDeviceCaps		parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
MoveTo			parameters become 'int' instead of 'short',
			returns 'BOOL' instead of 'DWORD'
GetCurrentPosition	parameter 'PPOINT' added
			returns 'BOOL' instead of 'DWORD'
LineTo			parameters become 'int' instead of 'short'
Rectangle		-"-
Ellipse			-"-
Arc			-"-
Chord			-"-
Pie			-"-
PatBlt			-"-
BitBlt			-"-
StretchBlt		-"-
TextOut			-"-
SetPixel		-"-
GetPixel		-"-
FloodFill		-"-
GetStockObject		parameter becomes 'int' instead of 'short'
CreatePen		parameters become 'int' instead of 'short'
SetTextAlign		parameter becomes 'UINT' instead of 'WORD',
			returns 'UINT' instead of 'WORD'
SetROP2			parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
GetROP2			returns 'int' instead of 'short'
SetStretchBltMode	parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
GetStretchBltMode	returns 'int' instead of 'short'
ExecFileDialog		parameter becomes 'int' instead of 'short',
			returns 'int' instead of 'short'
ExecInputDialog		returns 'int' instead of 'short'
SetClipboardData	parameter becomes 'UINT' instead of 'WORD'
GetClipboardData	parameter becomes 'UINT' instead of 'WORD'
RegisterClipboardFormat	returns 'UINT' instead of 'WORD'
CountClipboardFormats	returns 'int' instead of 'short'
EnumClipboardFormats	parameter becomes 'UINT' instead of 'WORD',
			returns 'UINT' instead of 'WORD'
GetClipboardFormatName	parameters become 'UINT'/'int'instead of
			'WORD'/'short', returns 'int' instead of 'short'
IsClipboardFormatAvail	parameter becomes 'UINT' instead of 'WORD'
GlobalAlloc		parameter becomes 'UINT' instead of 'WORD'


Other changes
-------------

1. Initializing Windows Library

In older versions of WSP, there were no special requirements for
initializing Windows Library, except the call to 'InitWLib'. This
function sets links channels for connection with host (if you use
configuration file for your program, or root transputer connected with
PC bus with the link other than 0). In this version, however, another
call is required (after 'InitWLib') - 'EnableWLib', which is actually
initialize the library - fills internal structures etc. If you'll not
make a call as 'EnableWLib(TRUE)', Windows Server may crash on any
library function.

2. Window function

Earlier, the window function had a 'TMessage' structure as a
parameter. Now it accepts parameters: Message, WParam and LParam
(note that WParam is 32-bit now). The typical window function looks
like following:

  BOOL MessageProc(UINT Message, WPARAM WParam, LPARAM LParam)
  {
    switch (Message)
      {
      case WM_COMMAND:
        if (!LOWORD(LParam))
          {
          /* dispatching menu items */
          switch (WParam)
            {
            case IDM_EXIT:
              DeleteWindow(hWnd);
              return FALSE;
              ...
            break;
            }
        /* dispatching other messages */
          }
      }
    return TRUE;
  }

3. Message processing

The old message loop was very simple had a call to only one function
- 'DispatchMessage', which had no parameters:

  while (DispatchMessage());

New programs should use two functions instead - 'RetrieveMessage'
(which accepts a pointer to TMSG structure and fills this structure
with the message, if one exists in window queue; otherwise, it fills
it with zeros), and 'DispatchMessage' (which calls the window
function, if one is defined and the message is not empty, i.e. there
is one in the window queue):

  RetrieveMessage(&Msg);
  while (DispatchMessage(&Msg))
    RetrieveMessage(&Msg);

If you'll initialize 'Msg' structure with zeros, you may skip the
first call to 'RetrieveMessage'.

4. Parameters validation

32-bit Windows processes parameters in API calls more carefully than
WIndows 3.x. For example, call to 'CreateCompatibleDC' function (which
is used internally in 'SelectBitmapToDC') with an invalid DC handle
always fails under Windows NT and may not work under Windows 95 (although
works under Windows 3.1). In most cases, such invalid call causes an
exception in Windows Server and sometimes allows you to continue
your session. The new function 'GetLastError' in Windows library
might give more information about the error occured.
