#include "stdafx.h"
#include <Windows.h>
#include <string>
#include<time.h>
using namespace std; HWND hWindSnapman = NULL;
int nFiledIndex = ;
const int SNAPMAN_APP_PROGRESS = ;
const int SNAPMAN_APP_MESSAGE = ;
const int SNAPMAN_APP_LOGFILE = ;
const int SNAPMAN_APP_RESULTFILE = ;
const int SNAPMAN_APP_COMPLETE = ;
const int SNAPMAN_APP_CELLDATA = ;
const int SNAPMAN_APP_CELLFONTCOLOR = ;
const int SNAPMAN_APP_CELLBACKCOLOR = ; void SnapmanSendProgress(int nProgress)//发送进度,nProgress范围[0,100]
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %d",nFiledIndex,nProgress);
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_PROGRESS, (LPARAM)buffer);
} void SnapmanSendMessage(const wstring &strMessage)//发送运行时消息
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %s",nFiledIndex,strMessage.c_str());
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_MESSAGE, (LPARAM)buffer);
} void SnapmanSendLogFile(const wstring &strLogFilePath)//发送日志文件
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %s",nFiledIndex,strLogFilePath.c_str());
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_LOGFILE, (LPARAM)buffer);
} void SnapmanSendResultFile(const wstring &strResultFilePath)//发送结果文件
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %s",nFiledIndex,strResultFilePath.c_str());
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_RESULTFILE, (LPARAM)buffer);
} void SnapmanSendAppCompleted(bool bSuccess)//发送程序结束命令
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %d",nFiledIndex,bSuccess);
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_COMPLETE, (LPARAM)buffer);
} void SnapmanSendCellData(int nRow, int nCol,const wstring &strData)//改变某单元格的内容
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %d %d %s",nFiledIndex,nRow,nCol,strData.c_str());
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_CELLDATA, (LPARAM)buffer);
} void SnapmanSendCellFontColor(int nRow, int nCol,int nColor)//改变某单元格的字体颜色
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %d %d %d",nFiledIndex,nRow,nCol,nColor);
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_CELLFONTCOLOR, (LPARAM)buffer);
} void SnapmanSendCellBackColor(int nRow, int nCol,int nColor)//改变某单元格的背景颜色
{
wchar_t buffer[] = {};
wsprintf(buffer,L"%d %d %d %d",nFiledIndex,nRow,nCol,nColor);
SendMessage(hWindSnapman, WM_SETTEXT, (WPARAM)SNAPMAN_APP_CELLBACKCOLOR, (LPARAM)buffer);
} int SnapmanMain(_TCHAR *argv); int _tmain(int argc, _TCHAR* argv[])
{
wprintf(L"%s\n",argv[]);
hWindSnapman = (HWND)_wtoi(argv[]);
nFiledIndex = _wtoi(argv[]);
return SnapmanMain(argc>=?argv[]:NULL);
} int SnapmanMain(_TCHAR *argv)
{
return ;
}