WinPoem 1.0 ----------- by Julian Smart --------------- Fancy a little intellectual stimulation after long hours spent staring at spreadsheets or reports? Does your brain long for something a little more fulfilling than Tetris or fiddling with the WIN.INI file? Then you could go out and buy a poetry book... or alternatively, if you just can't drag yourself away from the screen, click on the WinPoem icon. WinPoem is a simple Windows application which picks poems from a file at random, or finds poems according to a string criterion, and formats them nicely in a window. A displayed poem can be copied to the clipboard ready for inclusion in that more imaginative report... It's small, it's free and it's totally harmless, so far as I know. No responsibility accepted, though, for any problems it might cause with your setup. Files ----- The main data file is winpoem.dat, and an index file winpoem.idx is supplied or can be (re)built using the Compile menu option. Source code for Borland C++ is provided in an archive called poem-src.zip Use --- Simply run the program, and a random poem will be displayed. The simplest way of operating WinPoem is to keep pressing the space bar for new poems (or pages for multi-page poems). Clicking the right mouse button (or selecting the WinPoem Options menu item from the system menu) gives a choice of the following facilities: Next poem/page (Page down) Display next poem (or next page) Previous page (Page up) Display previous page (multi-line poems only) Copy to clipboard Allows poems to be pasted into other applications Search (S) Allows user to enter a search string Next match (N) Gives next search match Font Change font to Roman, Swiss etc. Bigger text Increases text size Smaller text Decreases text size Compile index Use if you have edited the data file About About WinPoem Exit (Esc) Quit WinPoem When WinPoem is closed, the font, text height and window position are remembered (stored in WIN.INI) for next time. WinPoem can be put on the run= line in WIN.INI, so that a random poem will pop up every time Windows is run. If started in iconized state, e.g. by putting it on the load= line, double-clicking on the icon will pop up a random poem. The data file ------------- The winpoem.dat file contains poems separated by a #, with optional @ codes denoting title (@T) author (@A) and page break (@P). Any unrecognized codes will cause the rest of the line to be ignored, so the user can add lines (e.g. @S for subject) which will be searched on but not displayed. The data file contains a mixture of 20th century and earlier poetry, subject to copyright constraints. Apologies if any copyrights have inadvertently been infringed, though I have tried to avoid it. Implementation -------------- The program is my `Windows learning application', i.e. a vehicle for getting stuck into Windows programming, whilst (possibly) affording others a modicum of amusement. As such, the source may be of more use to some people than the executable. It builds on fragments from Borland's whello.cpp example and Petzold's `Programming Windows', plus hints from various sources taken from the CICA archive. For what it's worth, WinPoem demonstrates the following concepts (though not necessarily very well): Drawing icons, changing text fonts, formatting text, intercepting keystrokes, drawing on memory bitmaps and blitting them to the screen for slicker redrawing, popup menus, changing the system menu, faking a 3D effect, using an error log (I didn't use a debugger!), using a resource file, writing to and reading from WIN.INI, modal dialog boxes, copying text to the clipboard, random file access. License ------- Copyright Julian Smart, released into the public domain, April 1992. Any comments, suggestions for improvements, or alternative poetry data files welcome - it would be nice to have a poem pop up that I didn't type in! Julian Smart 149 Warrender Park Road Edinburgh EH9 1DT jacs@aiai.ed.ac.uk