home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / WIN / Programa / VPE16_14.ZIP / MINIDEMO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-28  |  3.6 KB  |  117 lines

  1.  
  2.  
  3.  
  4. #include "windows.h"
  5. #include "vpiface.h"
  6. #include "vpecomon.h"
  7. #include <colors.h>
  8.  
  9.  
  10.  
  11. char *DemoText =
  12. "[PS 3 S 12 C Black J BO]The moment of impact bursts through the silence and in a roar of sound, the "
  13. "final second is prolonged in a world of echoes as if concrete and clay of "
  14. "Broadway itself was reliving its memories.\n"
  15. "The last great march past. Newsman stands limp as a whimper as audience and "
  16. "eventare locked as one. Bing Crosby coos 'You don't have to feel pain "
  17. "to sing the blues, you don't have to holla - you don't feel a thing in your "
  18. "dollar collar.' Martin Luther cries 'Everybody Sing!' and rings the grand old "
  19. "liberty bell. Leary, weary of his prison cell, walks on heaven, talks on hell.\n"
  20. "Who needs Medicare and the 35c flat rate fare, when Fred Astaire and "
  21. "Ginger Rogers are dancing through the air? From Broadway Melody stereotypes "
  22. "the band returns to 'Stars and Stripes' bringing a tear to the moonshiner, "
  23. "who's been pouring out his spirit from the illegal still. The pawn broker "
  24. "clears the noisy till and clutches his lucky dollar bill.\n"
  25. "Then the blackout.\n\n"
  26. "(Genesis, 'The Lamb lies down on Broadway')";
  27.  
  28.  
  29. // ========================================================================
  30. //                              MiniDemo
  31. // ========================================================================
  32. void MiniDemo(HWND hwnd)
  33. {
  34.    long hdoc;
  35.  
  36.    hdoc = VpeOpenDoc(hwnd, "Mini Demo", -1, -1, 0);
  37.    
  38.    VpeWrite(hdoc, 100, 100, 500, 200, "[B C LtRed]Hello");
  39.    VpePrint(hdoc, 100, 250, "['Times New Roman' S 30 C Blue]World!");
  40.    VpeWriteBox(hdoc, 100, 450, 1900, VFREE, DemoText);
  41.  
  42.    VpePreviewDoc(hdoc, NULL, VPE_SHOW_NORMAL);
  43. }
  44.  
  45.  
  46.  
  47.  
  48. // ========================================================================
  49. //                              WndProc
  50. // ========================================================================
  51. long FAR PASCAL _export WndProc(HWND hwnd, UINT message, UINT wParam, LONG lParam)
  52. {
  53.    switch (message)
  54.    {
  55.     case WM_CREATE :
  56.        MiniDemo(hwnd);
  57.        return 0 ;
  58.  
  59.     case VPE_DESTROYWINDOW:
  60.     case WM_DESTROY:
  61.        PostQuitMessage(0);
  62.        return 0;
  63.    }
  64.  
  65.    return DefWindowProc (hwnd, message, wParam, lParam) ;
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. // ========================================================================
  75. //                              WinMain
  76. //
  77. // Create a hidden Main Window
  78. // ========================================================================
  79. int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR , int )
  80. {
  81.    static char szAppName [] = "Mini Demo";
  82.    MSG         msg ;
  83.    HWND        hwnd ;
  84.    WNDCLASS    wndclass ;
  85.  
  86.  
  87.    if (!hPrevInstance)
  88.    {
  89.       wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
  90.       wndclass.lpfnWndProc   = WndProc ;
  91.       wndclass.cbClsExtra    = 0 ;
  92.       wndclass.cbWndExtra    = 0 ;
  93.       wndclass.hInstance     = hInstance ;
  94.       wndclass.hIcon         = LoadIcon (hInstance, "APP_ICON");
  95.       wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
  96.       wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
  97.       wndclass.lpszMenuName  = szAppName ;
  98.       wndclass.lpszClassName = szAppName ;
  99.       RegisterClass (&wndclass) ;
  100.    }
  101.  
  102.    hwnd = CreateWindow (szAppName, szAppName,
  103.                         WS_OVERLAPPEDWINDOW,
  104.                         CW_USEDEFAULT, CW_USEDEFAULT,
  105.                         CW_USEDEFAULT, CW_USEDEFAULT,
  106.                         NULL, NULL, hInstance, NULL) ;
  107.  
  108.    while (GetMessage (&msg, NULL, 0, 0))
  109.    {
  110.       TranslateMessage (&msg) ;
  111.       DispatchMessage (&msg) ;
  112.    }
  113.  
  114.    return msg.wParam ;
  115. }
  116.  
  117.