Git Product home page Git Product logo

petzoldpw5e-rs's Introduction

(2021-06-10 successfully compiled and run with Rust 1.52.1 after a cargo update on Windows 7)

PetzoldPW5e-rs

64 bit Rust transliteration of Charles Petzold's excellent book Programming Windows 5th Edition ISBN-10 157231995X

The C source code has been manually converted into Rust and tested. Only nine of the twenty three chapters have been transliterated (March 2019).

If you cannot understand what the Rust code does then consider buying Charles Petzold's Programming Windows book - the 5th edition is a classic and the last using C. It weighs 2.4kg (that's over 5lb).


Microsoft Windows 10 is to some extent backwards compatible with Windows 1.0 release circa 1983. Today this gives us a legacy of some interesting choices of types used in functions and constants. There was probably good reasoning behind it all, but this does cause a lot of potentially unnecessary casting when using the Rust winapi crate. Search for "The Old New Thing" by Raymond Chen. His blog contains anecdotes relating to various design choices in Windows.


There is some code in the extras directory that is transliterated from windowsx.h file that was not available in the Rust winapi crate in January 2018. There are also variations on some constants that have no explicit type in the Windows header files but have been given different types in the Rust winapi crate.

And don't forget the Windows functions and structures that have been superseded:

  • RegisterClass, WNDCLASS
  • GetLocaleInfo, LOCALE_SDATE, LOCALE_STIME, LOCALE_IDATE, LOCALE_ILDATE, LOCALE_ITIME, LOCALE_ITIMEMARKPOSN, LOCALE_ICENTURY, LOCALE_ITLZERO, LOCALE_IDAYLZERO, LOCALE_IMONLZERO
  • ScrollWindow
  • SetClassLong, GetClassLong, SetWindowLong, GetWindowLong, GWL_WNDPROC, GWL_HINSTANCE, GWL_HWNDPARENT, GWL_USERDATA, GWL_ID, GCL_MENUNAME, GCL_HBRBACKGROUND, GCL_HCURSOR, GCL_HICON, GCL_HMODULE, GCL_WNDPROC, GCL_HICONSM
  • GetScrollPos, SetScrollPos, GetScrollRange, SetScrollRange
  • KP_SALT
  • midiInGetID
  • ... and probably a few more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.