|
|
1.1 ! root 1: /*----------------------------------------- ! 2: AVIO1.C -- Advanced VIO Display of Text ! 3: -----------------------------------------*/ ! 4: ! 5: #define INCL_WIN ! 6: #define INCL_VIO ! 7: #define INCL_AVIO ! 8: #include <os2.h> ! 9: #include <string.h> ! 10: ! 11: #define VIDEOWIDTH 40 ! 12: ! 13: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ; ! 14: ! 15: HAB hab ; ! 16: ! 17: int main (void) ! 18: { ! 19: static CHAR szClientClass [] = "Avio1" ; ! 20: static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | ! 21: FCF_SIZEBORDER | FCF_MINMAX | ! 22: FCF_SHELLPOSITION | FCF_TASKLIST ; ! 23: HMQ hmq ; ! 24: HWND hwndFrame, hwndClient ; ! 25: QMSG qmsg ; ! 26: ! 27: hab = WinInitialize (0) ; ! 28: hmq = WinCreateMsgQueue (hab, 0) ; ! 29: ! 30: WinRegisterClass (hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0) ; ! 31: ! 32: hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE, ! 33: &flFrameFlags, szClientClass, NULL, ! 34: 0L, NULL, 0, &hwndClient) ; ! 35: ! 36: WinSendMsg (hwndFrame, WM_SETICON, ! 37: WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE), ! 38: NULL) ; ! 39: ! 40: while (WinGetMsg (hab, &qmsg, NULL, 0, 0)) ! 41: WinDispatchMsg (hab, &qmsg) ; ! 42: ! 43: WinDestroyWindow (hwndFrame) ; ! 44: WinDestroyMsgQueue (hmq) ; ! 45: WinTerminate (hab) ; ! 46: return 0 ; ! 47: } ! 48: ! 49: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 50: { ! 51: static CHAR *aszAlice [] = { ! 52: "Alice was beginning to get very tired of", ! 53: "sitting by her sister on the bank and of", ! 54: "having nothing to do: once or twice she", ! 55: "had peeped into the book her sister was", ! 56: "reading, but it had no pictures or ", ! 57: "conversations in it, \"and what is the", ! 58: "use of a book,\" thought Alice, \"without", ! 59: "pictures or conversations?\"" ! 60: } ; ! 61: static HPS hps ; ! 62: static HVPS hvps ; ! 63: static SHORT sNumLines = sizeof aszAlice / sizeof aszAlice[0] ; ! 64: HDC hdc ; ! 65: SHORT sRow ; ! 66: SIZEL sizl ; ! 67: ! 68: switch (msg) ! 69: { ! 70: case WM_CREATE: ! 71: hdc = WinOpenWindowDC (hwnd) ; ! 72: ! 73: sizl.cx = sizl.cy = 0 ; ! 74: hps = GpiCreatePS (hab, hdc, &sizl, PU_PELS | GPIF_DEFAULT | ! 75: GPIT_MICRO | GPIA_ASSOC) ; ! 76: ! 77: VioCreatePS (&hvps, sNumLines, VIDEOWIDTH, 0, 1, NULL) ; ! 78: VioAssociate (hdc, hvps) ; ! 79: ! 80: for (sRow = 0 ; sRow < sNumLines ; sRow++) ! 81: VioWrtCharStr (aszAlice[sRow], ! 82: strlen (aszAlice[sRow]), ! 83: sRow, 0, hvps) ; ! 84: return 0 ; ! 85: ! 86: case WM_SIZE: ! 87: WinDefAVioWindowProc (hwnd, msg, mp1, mp2) ; ! 88: return 0 ; ! 89: ! 90: case WM_PAINT: ! 91: WinBeginPaint (hwnd, hps, NULL) ; ! 92: GpiErase (hps) ; ! 93: ! 94: VioShowBuf (0, 2 * sNumLines * VIDEOWIDTH, hvps) ; ! 95: ! 96: WinEndPaint (hps) ; ! 97: return 0 ; ! 98: ! 99: case WM_DESTROY: ! 100: VioAssociate (NULL, hvps) ; ! 101: VioDestroyPS (hvps) ; ! 102: GpiDestroyPS (hps) ; ! 103: return 0 ; ! 104: } ! 105: return WinDefWindowProc (hwnd, msg, mp1, mp2) ; ! 106: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.