The sample codes provided in the floppy disk of Charles Petzold's book Programming Windows 3.1.
Individual files are in the disk-files directory. Disk image of the original disk is program-win31-disk-image
Copyright for this still belongs Charles Petzold. I just felt given the age of Windows 3.1, if you have to develop an app for this, this hard-to-find content will definitely be useful.