report.cpp

来自「Windows 图形编程 书籍」· C++ 代码 · 共 45 行

CPP
45
字号
//-----------------------------------------------------------------------------------//
//              Windows Graphics Programming: Win32 GDI and DirectDraw               //
//                             ISBN  0-13-086985-6                                   //
//                                                                                   //
//  Written            by  Yuan, Feng                             www.fengyuan.com   //
//  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
//  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
//                                                                                   //
//  FileName   : report.cpp				                                             //
//  Description: Send report to spy control program                                  //
//  Version    : 1.00.000, May 31, 2000                                              //
//-----------------------------------------------------------------------------------//

#define NOCRYPT

#include <windows.h>
#include <tchar.h>

#include "Report.h"

// Report to Client

extern HWND h_Controller;

LRESULT Send(unsigned id, unsigned para, unsigned time, const TCHAR *messtext)
{
    COPYDATASTRUCT cds;
    ReportMessage  rpt;

    memset(& rpt, 0, sizeof(rpt));

    rpt.m_para = para;
    rpt.m_time = time;
    rpt.m_tick = GetTickCount();

    if ( messtext )
        _tcsncpy(rpt.m_text, messtext, sizeof(rpt.m_text)/sizeof(TCHAR)-1);

    cds.dwData = id;
    cds.cbData = sizeof(rpt);
    cds.lpData = (void *) & rpt;

    return SendMessage(h_Controller, WM_COPYDATA, NULL, (LPARAM) & cds);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?