?? cdwnd.cpp
字號:
// CdWnd.cpp : implementation file
//
#include "stdafx.h"
#include "Test.h"
#include "CdWnd.h"
#include "interface.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const int MAX_COPY_DATA = 1024;
CCdWnd* g_pCdWnd;
BOOL UpData(unsigned long data,unsigned long len,unsigned char* buf)
{
if(g_pCdWnd==NULL)
return 0;
return g_pCdWnd->UpData(data,len,buf);
}
/////////////////////////////////////////////////////////////////////////////
// CCdWnd
CCdWnd::CCdWnd()
{
}
CCdWnd::~CCdWnd()
{
}
BEGIN_MESSAGE_MAP(CCdWnd, CWnd)
//{{AFX_MSG_MAP(CCdWnd)
ON_WM_COPYDATA()
ON_WM_DESTROY()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCdWnd message handlers
BOOL CCdWnd::PreCreateWindow(CREATESTRUCT& cs)
{
ASSERT(cs.lpszClass == NULL); // must not be specified
cs.lpszClass = "TConsole";
WNDCLASS wndcls;
wndcls.style = CS_HREDRAW | CS_VREDRAW;//CS_DBLCLKS
wndcls.lpfnWndProc = ::DefWindowProc;
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 0;
wndcls.hInstance = AfxGetInstanceHandle();
wndcls.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
wndcls.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndcls.lpszMenuName = NULL;
wndcls.lpszClassName = cs.lpszClass;
if (!AfxRegisterClass(&wndcls))
AfxThrowResourceException();
return TRUE;
}
int CCdWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
g_pCdWnd=this;
return 0;
}
void CCdWnd::OnDestroy()
{
if(g_pCdWnd==NULL)
return;
g_pCdWnd=NULL;
CWnd::OnDestroy();
AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE);
// TODO: Add your message handler code here
}
BOOL CCdWnd::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
{
// TODO: Add your message handler code here and/or call default
DWORD data;
DWORD len;
unsigned char buf[MAX_COPY_DATA];
data=pCopyDataStruct->dwData;
len=pCopyDataStruct->cbData;
if(len>MAX_COPY_DATA)
len=MAX_COPY_DATA;
memcpy(buf,pCopyDataStruct->lpData,len);
AddCopyData(data,len,buf);
return DownData(data,len,buf);
}
BOOL CCdWnd::UpData(unsigned long data, unsigned long len, unsigned char *buf)
{
BOOL ret=0;
COPYDATASTRUCT cds;
cds.dwData=data;
cds.cbData=len;
cds.lpData=buf;
AddCopyData(data,len,buf,1);
HWND hWnd=::FindWindow("Toil_Station",NULL);
if(hWnd)
ret=::SendMessage(hWnd,WM_COPYDATA,(WPARAM)m_hWnd,(LPARAM)&cds);
return ret;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -