home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_04 / Diver / Report.cpp < prev    next >
C/C++ Source or Header  |  2000-05-11  |  2KB  |  45 lines

  1. //-----------------------------------------------------------------------------------//
  2. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  3. //                             ISBN  0-13-086985-6                                   //
  4. //                                                                                   //
  5. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  6. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  7. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  8. //                                                                                   //
  9. //  FileName   : report.cpp                                                             //
  10. //  Description: Send report to spy control program                                  //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. #define NOCRYPT
  15.  
  16. #include <windows.h>
  17. #include <tchar.h>
  18.  
  19. #include "Report.h"
  20.  
  21. // Report to Client
  22.  
  23. extern HWND h_Controller;
  24.  
  25. LRESULT Send(unsigned id, unsigned para, unsigned time, const TCHAR *messtext)
  26. {
  27.     COPYDATASTRUCT cds;
  28.     ReportMessage  rpt;
  29.  
  30.     memset(& rpt, 0, sizeof(rpt));
  31.  
  32.     rpt.m_para = para;
  33.     rpt.m_time = time;
  34.     rpt.m_tick = GetTickCount();
  35.  
  36.     if ( messtext )
  37.         _tcsncpy(rpt.m_text, messtext, sizeof(rpt.m_text)/sizeof(TCHAR)-1);
  38.  
  39.     cds.dwData = id;
  40.     cds.cbData = sizeof(rpt);
  41.     cds.lpData = (void *) & rpt;
  42.  
  43.     return SendMessage(h_Controller, WM_COPYDATA, NULL, (LPARAM) & cds);
  44. }
  45.