Wine, WineLib and "Programming Windows 95"

Table of contents

  1. General
    1. Introduction
    2. News
    3. Testing configuration
    4. Statistics
    5. Installation
    6. Wine notes
    7. Winelib notes
  2. Test Results
  3. API Index

1. General

1.1. Introduction

This book came out soon after Windows 95 and explains how to use the, then new, Win32 API. The focus is on simple GUI applications so there is not much in terms of system level programming for instance. Also it does not make use of the MFC or C++ which means the sample programs test the Win32 API directly and should be relatively simple to compile.
French title Programmer sous Windows 95
French ISBN 2-84082-195-8
Original title Programming Windows 95
Original ISBN 1-55615-676-6 (or 0641025076 at B&N)
Author Charles Petzold, Paul Yao
URL Fourth edition's site (the one I used) on Charles Petzold's site
Fifth edition's site
Fifth edition's Errata
Buying online Barnes & Noble

Get the complete testing kit, including these pages, from:
(it's released under the X11 license)

1.2. News

1.3. Testing configuration

The tests have been performed on my Linux box:

I sometimes say that the values I get are different from what I get on Windows. In that case the reference is a Windows 98 laptop running in 1024x768x16. Of course I ignored differences related to the resolution.

1.4. Statistics

84 examples
84 have been tested (100%)
22 have Wine errors (26% of tested) 16 have warnings (19% of tested)
for a total of 38 errors for a total of 22 warnings
11 have Winelib errors (13% of total) 4 have warnings (5% of total)
for a total of 15 errors for a total of 5 warnings
79 executables 0 Winelib executables (0%)
5 libraries 0 Winelib libraries (0%)
102 C files 0 compiled (0%)
4 C++ files 0 compiled (0%)
27 RC files 0 compiled (0%)

1.5. Installation

To install this testing kit follow these steps:

 #Copy the contents of the CD to some directory.
 mkdir PrgWin95
 cd PrgWin95
 cp -r /cdrom/Code/* .
 # The directories and files will be read-only, make them read-write
 chmod -R u+w *
 # Run winemaker as follows
 winemaker --nogenerated-files .
 # Uncompress the contents of the testing kit. Adapt to the version you got
 tar xvfz ~/PrgWin95-0.2.1.tar.gz
 # Then complete the setup.
 ./generate --setup
 # And prepare the compilation
 ./configure --with-wine=$HOME/wine
 # Make sure you have set up the environment correctly for using Wine
 # Then recompile everything, keeping a log
 make 2>&1 | tee make.log

To compile and perform the tests with Wine you will need to set up the Wine environment (LD_LIBRARY_PATH and PATH) as you usually do when you want to use Wine.

1.6. Wine notes

  1. In desktop mode the background is initially all black but as windows are moved the real background color appears from under the window.
  2. 'Alt-F4' works but not 'Ctrl-Esc' ("Switch to ..."). Using the mouse I get the "Tasks" window so it must be something in the handling of the keyboard shortcut.
  3. In the "Tasks" window:
    1. "File/Run Application" does not work. I get the following message in the console:
       fixme:shell:RunFileDlg (0x00000570 0x0 0x0 "Run Application" "(null)" 0x0):stub.
    2. "Tile Windows" says
       fixme:mdi:TileWindows (0x00000000,0x00000001,...,0,...): stub
    3. "Shutdown Windows" does not seem to do anything.

1.7. Winelib notes

  1. Most compilation/link problems related to the C library have been solved now that we can link with msvcrt.dll (actually, crtdll.dll can be used too). We still get a few errors because we lack the proper C headers (e.g. we need to map atoi to _atoi). But that is coming too.
  2. Most cases where the Winelib version did not work as well as the native executable under Wine have been solved. I believe most were related to resource linking problems. There are still issues with 9/hugopoem, 15/poppad, 20/caller, 20/callpub

2. Test Results

  1. Chapter 2 - Hello, Windows 95 (Hello, Windows 95)
    1. hellowin
  2. Chapter 3 - Displaying text (Afficher du texte)
    1. sysmets1
    2. sysmets2
    3. sysmets3
  3. Chapter 4 - Graphism, the basics (Les bases du graphisme)
    1. bezier
    2. clover Wine: 1 error
    3. devcaps1 Wine: 1 warning
    4. emf1
    5. emf2 Wine: 1 warning
    6. endjoin Wine: 1 error
    7. justify1 Wine: 1 error
    8. linedemo
    9. metafile Wine: 1 error
    10. randrect
    11. scramble Wine: 1 error
    12. sinewave
    13. whatsize Wine: 1 warning
  4. Chapter 5 - The keyboard (Le clavier)
    1. keylook Wine: 1 warning
    2. sysmets
    3. typer
  5. Chapter 6 - The mouse (La souris)
    1. capture1
    2. capture2
    3. checker1
    4. checker2
    5. checker3
    6. connect
  6. Chapter 7 - The clock (L'horloge)
    1. anaclock
    2. beeper1
    3. beeper2
    4. bounce
    5. digclock
  7. Chapter 8 - The child windows (Les fenêtres enfants)
    1. btnlook Wine: 1 error
    2. colors1 Wine: 2 errors Winelib: 2 errors
    3. environ Winelib: 1 error
    4. head Winelib: 1 error
    5. ownerdrw
    6. poppad1 Wine: 1 warning
  8. Chapter 9 - Using resources (Utiliser les ressources)
    1. hugopoem Winelib: 1 error
    2. resourc1 Wine: 1 error, 1 warning
    3. resourc2 Wine: 1 error
  9. Chapter 10 - Menus and keyboard shortcuts (Menus et raccourcis clavier)
    1. grafmenu Wine: 1 error
    2. menudemo
    3. nopopups
    4. poormenu
    5. popmenu
    6. poppad2
  10. Chapter 11 - Dialog boxes (Les boîtes de dialogue)
    1. about1
    2. about2
    3. about3
    4. colors2
    5. colors3
    6. hexcalc Winelib: 1 error
    7. poppad3 Wine: 1 error, 2 warnings
  11. Chapter 12 - The modern user interface (L'interface utilisateur moderne)
    1. ctlmacro Wine: 1 error Winelib: 2 errors
    2. gadgets Wine: 3 errors, 1 warning
    3. property Wine: 8 errors, 2 warnings Winelib: 1 error
  12. Chapter 14 - Multitaksing and multithreading (Multitâche et multithreading)
    1. bigjob1
    2. bigjob2
    3. multi1 Wine: 1 error
    4. multi2 Wine: 1 error, 1 warning
    5. rndrctmt Wine: 1 warning
  13. Chapter 15 - Using the printer (Utilisation de l'imprimante)
    1. devcaps2 Wine: 2 warnings
    2. formfeed
    3. poppad Winelib: 2 warnings
    4. print1
    5. print2
    6. print3
    7. print4
  14. Chapter 16 - The clipboard (Le Presse-papiers)
    1. clipview Wine: 1 error, 1 warning
  15. Chapter 17 - Dynamic Data Exchange (DDE) (Echange dynamique de données (DDE))
    1. ddepop1
    2. ddepop2 Wine: 2 warnings
    3. showpop1 Wine: 2 errors
    4. showpop2 Wine: 2 errors
  16. Chapter 18 - The multi-document interface (MDI) (Interface pour documents multiples (MDI))
    1. mdidemo Wine: 5 errors, 3 warnings
  17. Chapter 19 - Dynamically linked libraries (DLL) (Bibliothèques de liens dynamiques (DLL))
    1. bitlib Winelib: 1 warning
    2. edrlib
    3. edrtest
    4. showbit
    5. strlib Winelib: 1 error
    6. strprog Wine: 1 error Winelib: 1 error
  18. Chapter 20 - Going further with OLE? (Pour aller plus loin avec OLE ?)
    1. caller Wine: 1 error Winelib: 3 errors
    2. callpub Wine: 1 warning Winelib: 1 error
    3. imalloc Winelib: 1 warning
    4. pubmem Winelib: 1 warning

3. API Index

This is an inverted list of the APIs used by the examples. Click on one of the functions to find which of the sample programs invoke it.

  1. COMCTL32
    CreateToolbarEx, ImageList_LoadImageA, PropertySheetA
  2. GDI32
    AbortDoc, BeginPath, BitBlt, CloseEnhMetaFile, CloseMetaFile, ClosePrinter, CombineRgn, CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateCompatibleDC, CreateDCA, CreateEllipticRgn, CreateEnhMetaFileA, CreateFontIndirectA, CreateHatchBrush, CreateICA, CreateMetaFileA, CreatePatternBrush, CreateRectRgn, CreateSolidBrush, DPtoLP, DeleteDC, DeleteEnhMetaFile, DeleteMetaFile, DeleteObject, Ellipse, EndDoc, EndPage, EndPath, EnumPrintersA, ExtCreatePen, ExtEscape, ExtTextOutA, GetBkColor, GetDeviceCaps, GetEnhMetaFileA, GetObjectA, GetStockObject, GetTextColor, GetTextExtentPoint32A, GetTextExtentPointA, GetTextMetricsA, LineTo, ModifyWorldTransform, MoveToEx, OpenPrinterA, PlayEnhMetaFile, PlayMetaFile, PolyBezier, Polygon, Polyline, PrinterProperties, Rectangle, RestoreDC, RoundRect, SaveDC, SelectClipRgn, SelectObject, SetAbortProc, SetBkColor, SetBkMode, SetGraphicsMode, SetMapMode, SetPixel, SetROP2, SetTextAlign, SetTextColor, SetTextJustification, SetViewportExtEx, SetViewportOrgEx, SetWindowExtEx, SetWindowOrgEx, StartDocA, StartPage, StretchBlt, StrokePath, TextOutA
  3. KERNEL32
    CloseHandle, CompareStringA, CompareStringW, CreateEventA, CreateFileA, CreateFileMappingA, CreateThread, DeleteCriticalSection, DisableThreadLibraryCalls, EnterCriticalSection, ExitProcess, ExitThread, FindResourceA, FlushFileBuffers, FreeEnvironmentStringsA, FreeEnvironmentStringsW, FreeLibrary, FreeResource, GetACP, GetCPInfo, GetCommandLineA, GetCurrentDirectoryA, GetCurrentThreadId, GetDriveTypeA, GetEnvironmentStrings, GetEnvironmentStringsW, GetFileType, GetFullPathNameA, GetLastError, GetLocalTime, GetModuleFileNameA, GetModuleHandleA, GetOEMCP, GetProcAddress, GetProcessHeap, GetProfileIntA, GetProfileStringA, GetStartupInfoA, GetStdHandle, GetStringTypeA, GetStringTypeW, GetTickCount, GetTimeZoneInformation, GetVersion, GlobalAddAtomA, GlobalAlloc, GlobalDeleteAtom, GlobalFree, GlobalGetAtomNameA, GlobalLock, GlobalUnlock, HeapAlloc, HeapCompact, HeapCreate, HeapDestroy, HeapFree, HeapReAlloc, HeapSize, HeapWalk, InitializeCriticalSection, LCMapStringA, LCMapStringW, LeaveCriticalSection, LoadLibraryA, LoadResource, LockResource, MapViewOfFile, MultiByteToWideChar, OpenFile, RaiseException, ReadFile, ResumeThread, RtlUnwind, SetCurrentDirectoryA, SetEndOfFile, SetEnvironmentVariableA, SetEvent, SetFilePointer, SetHandleCount, SetLastError, SetStdHandle, Sleep, TlsAlloc, TlsGetValue, TlsSetValue, UnhandledExceptionFilter, UnmapViewOfFile, WaitForSingleObject, WideCharToMultiByte, WinExec, WriteFile, _lclose, _lread, lstrcmpA, lstrcmpiA, lstrcpyA, lstrlenA
  4. USER32
    AppendMenuA, BeginPaint, CallWindowProcA, ChangeClipboardChain, CharNextA, CharUpperA, CheckMenuItem, CheckRadioButton, ClientToScreen, CloseClipboard, CreateCaret, CreateDialogParamA, CreateMenu, CreateWindowExA, DdeClientTransaction, DdeConnect, DdeCreateDataHandle, DdeCreateStringHandleA, DdeDisconnect, DdeFreeStringHandle, DdeGetData, DdeInitializeA, DdeNameService, DdePostAdvise, DdeQueryStringA, DdeUninitialize, DefFrameProcA, DefMDIChildProcA, DefWindowProcA, DeleteMenu, DestroyCaret, DestroyMenu, DestroyWindow, DialogBoxParamA, DispatchMessageA, DrawFocusRect, DrawIcon, DrawMenuBar, DrawTextA, EnableMenuItem, EnableWindow, EndDialog, EndPaint, EnumChildWindows, EnumWindows, FillRect, FrameRect, FreeDDElParam, GetClassNameA, GetClientRect, GetClipboardData, GetCursorPos, GetDC, GetDesktopWindow, GetDialogBaseUnits, GetDlgItem, GetDlgItemTextA, GetFocus, GetKeyState, GetMenu, GetMenuItemCount, GetMenuStringA, GetMessageA, GetParent, GetScrollPos, GetSubMenu, GetSysColor, GetSystemMenu, GetSystemMetrics, GetWindow, GetWindowLongA, GetWindowRect, GetWindowTextA, GetWindowTextLengthA, GetWindowWord, HideCaret, InvalidateRect, InvertRect, IsClipboardFormatAvailable, IsDialogMessageA, IsRectEmpty, IsWindow, IsWindowEnabled, IsWindowVisible, KillTimer, LoadAcceleratorsA, LoadBitmapA, LoadCursorA, LoadIconA, LoadMenuA, LoadStringA, LockWindowUpdate, MessageBeep, MessageBoxA, MoveWindow, OpenClipboard, PackDDElParam, PeekMessageA, PostMessageA, PostQuitMessage, PtInRect, RegisterClassExA, RegisterWindowMessageA, ReleaseCapture, ReleaseDC, ScreenToClient, ScrollWindow, SendDlgItemMessageA, SendMessageA, SetActiveWindow, SetCapture, SetCaretPos, SetClassLongA, SetClipboardViewer, SetCursor, SetCursorPos, SetDlgItemInt, SetDlgItemTextA, SetFocus, SetMenu, SetParent, SetRect, SetScrollPos, SetScrollRange, SetTimer, SetWindowLongA, SetWindowTextA, SetWindowWord, ShowCaret, ShowCursor, ShowWindow, TrackPopupMenu, TranslateAcceleratorA, TranslateMDISysAccel, TranslateMessage, UnpackDDElParam, UpdateWindow, ValidateRect, wsprintfA
  5. WINMM
  6. comdlg32
    ChooseColorA, ChooseFontA, FindTextA, GetFileTitleA, GetOpenFileNameA, GetSaveFileNameA, PrintDlgA, ReplaceTextA
  7. imalloc
  8. ole32
    CoCreateInstance, CoInitialize, CoUninitialize This page is hosted for free by