home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vidbtn.zip / TOOLBAR.C < prev    next >
C/C++ Source or Header  |  1994-06-10  |  28KB  |  636 lines

  1. /*______________________________________________________________________
  2. | ToolBar    05-14-93 (Revised 5-13-1994) Copyright Greg Ratajik        |
  3. |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  4. | This program shows how to use the VidButtn DLL calls to use           |
  5. | animated pushbuttons.  This version is for SVGS mode.                 |
  6. | See VidButtn.DOC for more information. This is the 32 bit OS/2 2.1    |
  7. | Version                                                               |
  8. |                                                                       |
  9. |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  10. | Version Release  Date       Change                                    |
  11. | ------- -------  ---------- ----------------------------------------  |
  12. |  .50    1        11-02-1992 Original AniButtn in ChatterBox           |
  13. |  .75              3-23-1993 Moved from ChatterBox to stand-alone code |
  14. | 1.00    2 (GA)    5-14-1993 Released as program utility  AniButtn.dll |
  15. | 1.50              7-29-1993 Enhanced to VidButtn.                     |
  16. | 1.75    3         5-21-1994 Added to Easyplay V2.12                   |
  17. | 2.00    4 (GA)    5-13-1994 Releases as program utility VidButtn.dll  |
  18. |_____________________________________________________________________*/
  19. #define INCL_PM
  20. #define INCL_WINSWITCHLIST
  21.  
  22. /*______________________________________________________________________
  23. |                                                                       |
  24. |                         System Includes                               |
  25. |_____________________________________________________________________*/
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <string.h>
  29. #include <ctype.h>
  30. #include <os2.h>
  31.  
  32. /*______________________________________________________________________
  33. |                                                                       |
  34. |             Application Specific Includes & Defines                   |
  35. |_____________________________________________________________________*/
  36. #include "toolbar.rch"
  37. #include "VidButtn.h"
  38.  
  39. /*______________________________________________________________________
  40. |                                                                       |
  41. |  Gobal Local Variables                        |
  42. |_____________________________________________________________________*/
  43. HSWITCH  hSwitch;          /* Task switch                          */
  44. SWCNTRL  Swctl;            /* Task switch                          */
  45. CHAR     szAppName[20];    /* Window creation                      */
  46. HAB      hAB;              /* Handle to anchor block               */
  47. HMQ      hMQ;              /* Handle to message Queue              */
  48. HWND     hWndFrame;        /* Handle to main shell's frame         */
  49. HWND     hWndClient;       /* Handle to main shell's client area   */
  50.  
  51. /*____________________________________________________________________
  52. |                                      |
  53. |  Function Prototypes.                           |
  54. |____________________________________________________________________*/
  55. MRESULT EXPENTRY WndProc        ( HWND, ULONG, MPARAM, MPARAM );
  56. MRESULT EXPENTRY ToolBar        ( HWND, ULONG, MPARAM, MPARAM );
  57. MRESULT EXPENTRY SENDChatter    ( HWND, ULONG, MPARAM, MPARAM );
  58.  
  59. HWND CreateWindow(HWND,ULONG,PCH,PCH,USHORT,INT,INT,INT,INT,PHWND,ULONG,USHORT );
  60.  
  61. /*___________________________________________________________________________
  62. |                                                                            |
  63. |    Function: Main                                 |
  64. |                                                                            |
  65. |      Return: SHORT                                                         |
  66. |                                                                            |
  67. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  68. |                 C H A N G E    L O G                 |
  69. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  70. |                                                                            |
  71. |  INT.     DATE      DESCRIPTION                                            |
  72. |  ----  ----------   ---------------------------------------------------    |
  73. |  GWR   05-15-1993   Initial Developement                                   |
  74. |___________________________________________________________________________*/
  75. main(int argc, char *argv[])
  76. {
  77. static CHAR   szTitle[13];
  78.        ULONG  flCreate = FCF_TITLEBAR | FCF_SYSMENU;
  79.        QMSG   qmsg;
  80.        SEL    sel;
  81.        TID    tid;
  82.  
  83.  argc = argc;
  84.  argv = argv;
  85.  
  86.  if((hAB = WinInitialize(0)) == 0)
  87.     return(FALSE);
  88.   
  89.  if((hMQ = WinCreateMsgQueue(hAB, 0)) == 0)
  90.     return(FALSE);
  91.  
  92.  if(!RegisterClass())
  93.     return(FALSE);
  94.  
  95.  WinLoadString(hAB, 0, IDS_TITLE, 13, szTitle);
  96.  hWndFrame = WinCreateStdWindow(HWND_DESKTOP,
  97.                                 WS_VISIBLE | WS_MAXIMIZED,
  98.                                 &flCreate,
  99.                                 "ToolBar",
  100.                                 "ToolBar",
  101.                                 WS_MAXIMIZED,
  102.                                 (HMODULE)NULL,
  103.                                 ID_CHATTER,
  104.                                 &hWndClient);
  105.  
  106.  /*___________________________________
  107.  |                      |
  108.  | Provide switch info so          |
  109.  | ChangeTaskList will work          |
  110.  |___________________________________*/
  111.  {
  112.   SWCNTRL  swctlSwitchList[10];
  113.   CHAR     szSwitchTitle  [50];
  114.   HSWITCH  hswSwitch;
  115.   PHSWITCH phsw;
  116.   PSWCNTRL psw;
  117.   PID      pid;
  118.  
  119.   psw =  &swctlSwitchList[0];
  120.   phsw = &hswSwitch;
  121.  
  122.   WinQueryWindowProcess(hWndFrame, &pid, NULL);
  123.  
  124.   strcpy(szSwitchTitle, "ToolBar2");
  125.   strcpy(swctlSwitchList[0].szSwtitle, szSwitchTitle);
  126.  
  127.   WinQueryWindowProcess(hWndFrame, &pid, &tid);
  128.   Swctl.hwnd = hWndFrame;                        /* Frame window handle    */
  129.   Swctl.idProcess = pid;                         /* Process identifier     */
  130.   Swctl.uchVisibility = SWL_VISIBLE;             /* visibility             */
  131.   Swctl.fbJump = SWL_JUMPABLE;                   /* Jump indicator         */
  132.   strcpy(Swctl.szSwtitle, szTitle);              /* Frame window title     */
  133.   hSwitch = WinAddSwitchEntry(&Swctl);
  134.  
  135.   hswSwitch = WinAddSwitchEntry(&swctlSwitchList[0]);
  136.  }
  137.  
  138.  /* The following is the message loop for the application.                 */
  139.  while(WinGetMsg(hAB, (PQMSG)&qmsg, 0, 0, 0))
  140.        WinDispatchMsg(hAB,(PQMSG)&qmsg);
  141.  
  142.  WinDestroyWindow(hWndFrame); /* Destroy the frame window                  */
  143.  
  144.  WinDestroyMsgQueue(hMQ);     /* Destroy this application's message queue  */
  145.  WinTerminate(hAB);           /* Terminate this application's use of the   */
  146.                               /* Presentation Manager resources            */
  147. } /* end of main */
  148.  
  149. /*___________________________________________________________________________
  150. |                                                                            |
  151. |    Function: WndProc                                                       |
  152. |                                                                            |
  153. | Description: Main window proc for Toolbar Example                          |
  154. |                                         |
  155. |      Return: MRESULT                                                       |
  156. |                                                                            |
  157. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  158. |                 C H A N G E    L O G                 |
  159. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  160. |                                                                            |
  161. |  INT.     DATE      DESCRIPTION                                            |
  162. |  ----  ----------   ---------------------------------------------------    |
  163. |  GWR   05-15-1993   Initial Developement                                   |
  164. |___________________________________________________________________________*/
  165. MRESULT EXPENTRY WndProc(HWND hWnd, ULONG message, MPARAM mp1, MPARAM mp2)
  166. {
  167.    HPS    hPS;          /* Handle for the Presentation Space              */
  168.    RECTL  rClient;      /* Handle to rectangle formed by client area      */
  169.    USHORT rc;
  170.  
  171.    switch(message)
  172.      {
  173.       case WM_COMMAND:
  174.            switch(SHORT1FROMMP(mp1))
  175.             {
  176.             }
  177.            break; /* End of WM_COMMAND */
  178.  
  179.       case WM_CREATE:
  180.            /*_____________________________________
  181.            |                                      |
  182.            | Start the toolbar off.  In a normal  |
  183.            | app, you'd have more than this for   |
  184.            | the main window.                     |
  185.            |_____________________________________*/
  186.            rc = (USHORT) WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, (PFNWP)ToolBar,
  187.                                     0, DLG_TOOLBAR, NULL);
  188.  
  189.            WinPostMsg(hWndClient, WM_QUIT,0L,0L);
  190.            return(0);
  191.  
  192.            break; /* End of WM_CREATE */
  193.  
  194.       case WM_MOUSEMOVE:
  195.            return(WinDefWindowProc(hWnd, message, mp1, mp2));
  196.            break;
  197.  
  198.       case WM_PAINT:    /* code for the window's client area               */
  199.            hPS = WinBeginPaint(hWnd, 0, 0);
  200.  
  201.            WinQueryWindowRect(hWnd, &rClient);
  202.            WinFillRect(hPS, &rClient, CLR_BACKGROUND);
  203.  
  204.            WinEndPaint(hPS);
  205.  
  206.            break; /* End of WM_PAINT */
  207.  
  208.       case WM_CLOSE:  /* close the window                                  */
  209.            WinPostMsg(hWndClient, WM_QUIT,0L,0L);
  210.            if(hWnd != hWndClient)
  211.              break;
  212.            return(WinDefWindowProc(hWnd, message, mp1, mp2));
  213.    }
  214.    return(0L);
  215.  
  216. } /* End of WndProc */
  217.  
  218. /*___________________________________________________________________________
  219. |                                                                            |
  220. |    Function: ToolBar                                                       |
  221. |                                                                            |
  222. | Description: Toolbar DLG Message proc.                                     |
  223. |                                                                            |
  224. |      Return: MRESULT                                                       |
  225. |                                                                            |
  226. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  227. |                 C H A N G E    L O G                 |
  228. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  |
  229. |                                                                            |
  230. |  INT.     DATE      DESCRIPTION                                            |
  231. |  ----  ----------   ---------------------------------------------------    |
  232. |  GWR   11-02-1993   Initial Developement                                   |
  233. |  GWR   05-14-1994   VidButtn Mods                                          |
  234. |___________________________________________________________________________*/
  235. MRESULT EXPENTRY ToolBar(HWND   hWndDlg,
  236.                          ULONG  message,
  237.                          MPARAM mp1,
  238.                          MPARAM mp2)
  239. {
  240.  static USHORT  usUpBits  [50];
  241.  static USHORT  usDownBits[50];
  242.  static HWND    hWndParent;
  243.         USHORT  grX;
  244.         USHORT  grY;
  245.  
  246.  switch(message)
  247.    {
  248.     case WM_INITDLG:
  249.          hWndParent = (HWND)mp2;
  250.  
  251.          /*___________________________________
  252.          |                                    |
  253.          | Create the Video-pushbuttons.      |
  254.          | The usUpBits array contains        |
  255.          | a list of BMP id's, which will be  |
  256.          | played 0-X when the button is      |
  257.          | pressed.                           |
  258.          |                                    |
  259.          | The usDownBits array contain a list|
  260.          | of BMP id's, which will be played  |
  261.          | 0-X when the button is pressed.    |
  262.          |                                    |
  263.          | Each list MUST contain a NULL at   |
  264.          | the end.                           |
  265.          |                                    |
  266.          | The set-up for this can be stream- |
  267.          | lined, but for this example, its   |
  268.          | done in the simplest, most explicit|
  269.          | way.                               |
  270.          |                                    |
  271.          |___________________________________*/
  272.          usUpBits[0]  = ID_EYE1;
  273.          usUpBits[1]  = ID_EYE2;
  274.          usUpBits[2]  = ID_EYE3;
  275.          usUpBits[3]  = ID_EYE4;
  276.          usUpBits[4]  = ID_EYE5;
  277.          usUpBits[5]  = 0;
  278.  
  279.          usDownBits[5]  = 0;
  280.          usDownBits[4]  = ID_EYE1;
  281.          usDownBits[3]  = ID_EYE2;
  282.          usDownBits[2]  = ID_EYE3;
  283.          usDownBits[1]  = ID_EYE4;
  284.          usDownBits[0]  = ID_EYE5;
  285.  
  286.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  287.                          PB_SCAN_DRIVE,             /* ID of control       */
  288.                          &usUpBits[0],              /* ID of UP bitmap     */
  289.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  290.                          68,                        /* X Size of bitmaps   */
  291.                          31,                        /* Y Size of bitmaps   */
  292.                          "Press this VidButton to scan the current drive for the selected file type.", /* Status bar text     */
  293.                          TX_HELP);                  /* ID of status bar    */
  294.  
  295.          usUpBits[0]  = ID_REDEYE1;
  296.          usUpBits[1]  = ID_REDEYE2;
  297.          usUpBits[2]  = ID_REDEYE3;
  298.          usUpBits[3]  = ID_REDEYE4;
  299.          usUpBits[4]  = ID_REDEYE5;
  300.          usUpBits[5]  = 0;             // The last element MUST be a NULL
  301.  
  302.          usDownBits[5]  = 0;           // The last element MUST be a NULL
  303.          usDownBits[4]  = ID_REDEYE1;
  304.          usDownBits[3]  = ID_REDEYE2;
  305.          usDownBits[2]  = ID_REDEYE3;
  306.          usDownBits[1]  = ID_REDEYE4;
  307.          usDownBits[0]  = ID_REDEYE5;
  308.  
  309.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  310.                          PB_RESCAN,                 /* ID of control       */
  311.                          &usUpBits[0],              /* ID of UP bitmap     */
  312.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  313.                          68,                        /* X Size of bitmaps   */
  314.                          31,                        /* Y Size of bitmaps   */
  315.                          "Press this VidButton to re-scan the current directory.",/* Status bar text     */
  316.                          TX_HELP);                  /* ID of status bar    */
  317.  
  318.  
  319.          usUpBits[0]  = ID_PLAY1;
  320.          usUpBits[1]  = ID_PLAY2;
  321.          usUpBits[2]  = ID_PLAY3;
  322.          usUpBits[3]  = ID_PLAY4;
  323.          usUpBits[4]  = ID_PLAY5;
  324.          usUpBits[5]  = ID_PLAY6;
  325.          usUpBits[6]  = ID_PLAY7;
  326.          usUpBits[7]  = ID_PLAY8;
  327.          usUpBits[8]  = ID_PLAY9;
  328.          usUpBits[9]  = 0;
  329.  
  330.          usDownBits[9]  = 0;
  331.          usDownBits[8]  = ID_PLAY1;
  332.          usDownBits[7]  = ID_PLAY2;
  333.          usDownBits[6]  = ID_PLAY3;
  334.          usDownBits[5]  = ID_PLAY4;
  335.          usDownBits[4]  = ID_PLAY5;
  336.          usDownBits[3]  = ID_PLAY6;
  337.          usDownBits[2]  = ID_PLAY7;
  338.          usDownBits[1]  = ID_PLAY8;
  339.          usDownBits[0]  = ID_PLAY9;
  340.  
  341.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  342.                          PB_PLAY,                   /* ID of control       */
  343.                          &usUpBits[0],              /* ID of UP bitmap     */
  344.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  345.                          68,                        /* X Size of bitmaps   */
  346.                          31,                        /* Y Size of bitmaps   */
  347.                          "Press this VidButton to play the selected file.",/* Status bar text     */
  348.                          TX_HELP);                  /* ID of status bar    */
  349.  
  350.  
  351.          usUpBits[0]  = ID_PLAY9;
  352.          usUpBits[1]  = ID_PLAY8;
  353.          usUpBits[2]  = ID_PLAY7;
  354.          usUpBits[3]  = ID_PLAY6;
  355.          usUpBits[4]  = ID_PLAY5;
  356.          usUpBits[5]  = ID_PLAY4;
  357.          usUpBits[6]  = ID_PLAY3;
  358.          usUpBits[7]  = ID_PLAY2;
  359.          usUpBits[8]  = ID_PLAY1;
  360.          usUpBits[9]  = 0;
  361.  
  362.          usDownBits[9]  = 0;
  363.          usDownBits[8]  = ID_PLAY9;
  364.          usDownBits[7]  = ID_PLAY8;
  365.          usDownBits[6]  = ID_PLAY7;
  366.          usDownBits[5]  = ID_PLAY6;
  367.          usDownBits[4]  = ID_PLAY5;
  368.          usDownBits[3]  = ID_PLAY4;
  369.          usDownBits[2]  = ID_PLAY3;
  370.          usDownBits[1]  = ID_PLAY2;
  371.          usDownBits[0]  = ID_PLAY1;
  372.  
  373.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  374.                          PB_ALL,                    /* ID of control       */
  375.                          &usUpBits[0],              /* ID of UP bitmap     */
  376.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  377.                          68,                        /* X Size of bitmaps   */
  378.                          31,                        /* Y Size of bitmaps   */
  379.                          "Press this VidButton to play all files displayed.",/* Status bar text     */
  380.                          TX_HELP);                  /* ID of status bar    */
  381.  
  382.          usUpBits[0]  = ID_ABOUT1;
  383.          usUpBits[1]  = ID_ABOUT2;
  384.          usUpBits[2]  = ID_ABOUT3;
  385.          usUpBits[3]  = ID_ABOUT4;
  386.          usUpBits[4]  = ID_ABOUT5;
  387.          usUpBits[5]  = ID_ABOUT6;
  388.          usUpBits[6]  = ID_ABOUT7;
  389.          usUpBits[7]  = ID_ABOUT8;
  390.          usUpBits[8]  = ID_ABOUT9;
  391.          usUpBits[9]  = ID_ABOUT10;
  392.          usUpBits[10] = 0;
  393.  
  394.          usDownBits[10]  = 0;
  395.          usDownBits[9]  = ID_ABOUT1;
  396.          usDownBits[8]  = ID_ABOUT2;
  397.          usDownBits[7]  = ID_ABOUT3;
  398.          usDownBits[6]  = ID_ABOUT4;
  399.          usDownBits[5]  = ID_ABOUT5;
  400.          usDownBits[4]  = ID_ABOUT6;
  401.          usDownBits[3]  = ID_ABOUT7;
  402.          usDownBits[2]  = ID_ABOUT8;
  403.          usDownBits[1]  = ID_ABOUT9;
  404.          usDownBits[0]  = ID_ABOUT10;
  405.  
  406.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  407.                          PB_ABOUT,                  /* ID of control       */
  408.                          &usUpBits[0],              /* ID of UP bitmap     */
  409.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  410.                          68,                        /* X Size of bitmaps   */
  411.                          31,                        /* Y Size of bitmaps   */
  412.                          "Press this VidButton Find out how to register this really great program!",/* Status bar text     */
  413.                          TX_HELP);                  /* ID of status bar    */
  414.  
  415.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  416.                          TBB_NA6,                   /* ID of control       */
  417.                          &usUpBits[0],              /* ID of UP bitmap     */
  418.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  419.                          68,                        /* X Size of bitmaps   */
  420.                          31,                        /* Y Size of bitmaps   */
  421.                          "Press this VidButton Find out how to register this really great program!",/* Status bar text     */
  422.                          TX_HELP);                  /* ID of status bar    */
  423.  
  424.  
  425.          usUpBits[0]  = ID_EXIT1;
  426.          usUpBits[1]  = ID_EXIT2;
  427.          usUpBits[2]  = ID_EXIT3;
  428.          usUpBits[3]  = ID_EXIT4;
  429.          usUpBits[4]  = ID_EXIT5;
  430.          usUpBits[5]  = ID_EXIT6;
  431.          usUpBits[6]  = ID_EXIT7;
  432.          usUpBits[7]  = ID_EXIT8;
  433.          usUpBits[8]  = ID_EXIT9;
  434.          usUpBits[9]  = ID_EXIT10;
  435.          usUpBits[10]  = ID_EXIT11;
  436.          usUpBits[17] = 0;
  437.  
  438.          usDownBits[14] = 0;
  439.          usDownBits[13] = ID_EXIT17;
  440.          usDownBits[12] = ID_EXIT17;
  441.          usDownBits[11] = ID_EXIT16;
  442.          usDownBits[10] = ID_EXIT16;
  443.          usDownBits[9]  = ID_EXIT15;
  444.          usDownBits[8]  = ID_EXIT15;
  445.          usDownBits[7]  = ID_EXIT14;
  446.          usDownBits[6]  = ID_EXIT14;
  447.          usDownBits[5]  = ID_EXIT13;
  448.          usDownBits[4]  = ID_EXIT13;
  449.          usDownBits[3]  = ID_EXIT12;
  450.          usDownBits[2]  = ID_EXIT12;
  451.          usDownBits[1]  = ID_EXIT11;
  452.          usDownBits[0]  = ID_EXIT11;
  453.  
  454.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  455.                          PB_EXIT,                   /* ID of control       */
  456.                          &usUpBits[0],              /* ID of UP bitmap     */
  457.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  458.                          68,                        /* X Size of bitmaps   */
  459.                          31,                        /* Y Size of bitmaps   */
  460.                          "Press this VidButton to Exit EasyPlay.",/* Status bar text     */
  461.                          TX_HELP);                  /* ID of status bar    */
  462.  
  463.  
  464.  
  465.          /*___________________________________
  466.          |                                    |
  467.          | Example of converting a AniButtn   |
  468.          | to a VidButtn (very simple!)       |
  469.          |___________________________________*/
  470.          // *** Original AniButtn Call ***
  471.          // AniCreateButton(hWndDlg,
  472.          //                   TBB_NEXT,
  473.          //                   ID_NEXT1,
  474.          //                   ID_NEXT2,
  475.          //                   68,
  476.          //                   31,
  477.          //                   "This is the NEXT Button.",
  478.          //                   TX_TBB_HELP);
  479.          //
  480.  
  481.          // *** Converted to a VidButtn ***
  482.          usUpBits[0]    = ID_NA1;
  483.          usUpBits[1]    = ID_NA2;
  484.          usUpBits[2]    = 0;
  485.  
  486.          usDownBits[2]  = 0;
  487.          usDownBits[1]  = ID_NA1;
  488.          usDownBits[0]  = ID_NA2;
  489.  
  490.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  491.                          TBB_NA3,                   /* ID of control       */
  492.                          &usUpBits[0],              /* ID of UP bitmap     */
  493.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  494.                          68,                        /* X Size of bitmaps   */
  495.                          31,                        /* Y Size of bitmaps   */
  496.                          "This is a example of a AniButtn converted to a VidButtn.",/* Status bar text     */
  497.                          TX_HELP);                  /* ID of status bar    */
  498.  
  499.  
  500.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  501.                          TBB_NA4,                   /* ID of control       */
  502.                          &usUpBits[0],              /* ID of UP bitmap     */
  503.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  504.                          68,                        /* X Size of bitmaps   */
  505.                          31,                        /* Y Size of bitmaps   */
  506.                          "This is a example of a AniButtn converted to a VidButtn.",/* Status bar text     */
  507.                          TX_HELP);                  /* ID of status bar    */
  508.  
  509.          VidCreateButton(hWndDlg,                   /* Handle of Dialog    */
  510.                          TBB_NA5,                   /* ID of control       */
  511.                          &usUpBits[0],              /* ID of UP bitmap     */
  512.                          &usDownBits[0],            /* ID of DOWN bitmap   */
  513.                          68,                        /* X Size of bitmaps   */
  514.                          31,                        /* Y Size of bitmaps   */
  515.                          "This is a example of a AniButtn converted to a VidButtn.",/* Status bar text     */
  516.                          TX_HELP);                  /* ID of status bar    */
  517.  
  518.  
  519.          break; /* End of WM_INITDLG */
  520.    
  521.     case WM_CONTROL:
  522.          switch(SHORT1FROMMP(mp1))
  523.            {
  524.            }
  525.          break; /* End of WM_CONTROL */
  526.  
  527.     case WM_COMMAND:
  528.          switch(SHORT1FROMMP(mp1))
  529.            {
  530.             case PB_ABOUT:
  531.                   WinMessageBox(HWND_DESKTOP,
  532.                                 hWndDlg,
  533.                                 "This is an example of how to use Greg Ratajik's neat Video-Pushbuttons. \
  534. For more information, send questions to 74555,542 (CompuServe), or 74555.542@compuserve.com (Internet),",
  535.                                 "You Have pressed the ABOUT VidButton",
  536.                                 0, MB_NOICON | MB_OK );
  537.  
  538.                   break;
  539.             case PB_EXIT:
  540.                   WinDismissDlg(hWndDlg, FALSE);
  541.                   break;
  542.            }
  543.  
  544.          break; /* End of WM_COMMAND */
  545.  
  546.     case WM_CLOSE:
  547.          /*___________________________________
  548.          |                                    |
  549.          | VidButtn uses a linked list to keep|
  550.          | track of everything.  This API will|
  551.          | delete the node for each button.   |
  552.          |___________________________________*/
  553.          VidDeleteButton(hWndDlg, PB_PLAY      );
  554.          VidDeleteButton(hWndDlg, PB_ALL       );
  555.          VidDeleteButton(hWndDlg, PB_EXIT      );
  556.          VidDeleteButton(hWndDlg, PB_RESCAN    );
  557.          VidDeleteButton(hWndDlg, PB_SCAN_DRIVE);
  558.          VidDeleteButton(hWndDlg, TBB_NA2      );
  559.          VidDeleteButton(hWndDlg, TBB_NA3      );
  560.          VidDeleteButton(hWndDlg, TBB_NA4      );
  561.          VidDeleteButton(hWndDlg, TBB_NA5      );
  562.          VidDeleteButton(hWndDlg, TBB_NA7      );
  563.          VidDeleteButton(hWndDlg, PB_ABOUT     );
  564.  
  565.          WinDismissDlg(hWndDlg, FALSE);
  566.          break; /* End of WM_CLOSE */
  567.            
  568.     default:
  569.          return(WinDefDlgProc(hWndDlg, message, mp1, mp2));
  570.          break;
  571.    }
  572.  return FALSE;
  573. } /* End of CHATTERBox */
  574.  
  575.  
  576. /*___________________________________________________________________________
  577. |                                                                            |
  578. |    Function: CreateWindow                                                  |
  579. |___________________________________________________________________________*/
  580. HWND CreateWindow(HWND   hWndParent,
  581.                   ULONG  ctldata,
  582.                   PCH    appname,
  583.                   PCH    title,
  584.                   USHORT ResID,
  585.                   INT    x,
  586.                   INT    y,
  587.                   INT    cx,
  588.                   INT    cy,
  589.                   PHWND  hWndClient,
  590.                   ULONG  lfStyle,
  591.                   USHORT uSizeStyle)
  592.  
  593. {
  594.    HWND   hWndFrame;
  595.  
  596.    hWndFrame = WinCreateStdWindow(hWndParent,
  597.                                   lfStyle,
  598.                                   &ctldata,
  599.                                   appname,
  600.                                   title,
  601.                                   WS_MAXIMIZED,
  602.                                   0,
  603.                                   ResID,
  604.                                   (HWND FAR *)hWndClient);
  605.  
  606.    if(hWndFrame == 0)
  607.      {
  608.       WinMessageBox(HWND_DESKTOP, hWndParent, "Error Creating Window!",
  609.                     0, 0, MB_OK|MB_ICONEXCLAMATION);
  610.       return((HWND)0);
  611.      }
  612.  
  613.    return(hWndFrame);
  614. }  /* End of CreateWindow */
  615.  
  616. /*___________________________________________________________________________
  617. |                                                                            |
  618. |    Function: RegisterClass                                                 |
  619. |___________________________________________________________________________*/
  620. INT RegisterClass(VOID)
  621. {
  622.  INT rc;
  623.  
  624.  WinLoadString(hAB, 0, IDS_APP_NAME, 80, szAppName);
  625.  rc = WinRegisterClass(hAB,
  626.               (PCH)"ToolBar",
  627.                       (PFNWP)WndProc,
  628.                       CS_SIZEREDRAW ,
  629.                       0);
  630.  if (rc == FALSE)
  631.    return(FALSE);
  632.  
  633.  
  634.  return(TRUE);
  635. } /* End of RegisterClass */
  636.