home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / COOLWORX.ZIP / DEMO / CDLGDEMO / CDLGDEMO.C next >
C/C++ Source or Header  |  1994-02-13  |  2KB  |  60 lines

  1. /****************************
  2.  *                          *
  3.  * Demo of CoolDialogs      *
  4.  * Copyright 1994 by AWC    *
  5.  *                          *
  6.  ****************************/
  7. #include <windows.h>
  8. #include "cw.h"
  9. #include "cdlgdemo.h"
  10.  
  11. /* Text buffer */
  12. char text[128];
  13.  
  14. /* Copy push button */
  15. BOOL WINAPI _export copyfunc(HWND dlg,UINT wParam,UINT hw,
  16.   UINT lw,UINT FAR *sub)
  17.   {
  18.   SendDlgItemMessage(dlg,EBOX,WM_COPY,0,0);
  19. /* Return focus to edit control */
  20.   SetFocus(GetDlgItem(dlg,EBOX));
  21.   return TRUE;
  22.   }
  23.  
  24. /* Paste push button  */
  25. BOOL WINAPI _export pastefunc(HWND dlg,UINT wParam,UINT hw,
  26.   UINT lw,UINT FAR *sub)
  27.   {
  28.   SendDlgItemMessage(dlg,EBOX,WM_PASTE,0,0);
  29. /* Return focus to edit control */
  30.   SetFocus(GetDlgItem(dlg,EBOX));
  31.   return TRUE;
  32.   }
  33.  
  34. /* Dialog data template */
  35. DLGDATA(dlgbuf)
  36. DLGITEM(EBOX,sizeof(text),text)
  37. DLGITEM(CM_EDITCOPY,CWDLG_PBUTTONX,copyfunc)
  38. DLGITEM(CM_EDITPASTE,CWDLG_PBUTTON,pastefunc)
  39. DLGEND;
  40.  
  41.  
  42. /* Main entry point */
  43. int PASCAL WinMain(HANDLE hInst, HANDLE prev,
  44.                                          LPSTR cmdline, int show)
  45.   {
  46.   cw_Begin(hInst);        // start CoolWorx
  47. /* Show dialog box -- No callback! */
  48.   cw_DialogBox(hInst,MAKEINTRESOURCE(MainDlg),NULL,NULL,dlgbuf);
  49. /* Show results using message box */
  50.   MessageBox(NULL,text,"Edit control contained",MB_OK);
  51. /* End CoolWorx */
  52.   cw_End(hInst);
  53.   return FALSE;
  54.   }
  55.  
  56.  
  57. /* To learn more about writing dialog only programs and other Windows
  58.    programming shortcuts -- check out Commando Windows Programming by
  59.    Al Williams (published by Addison Wesley). */
  60.