//::ICDraw(pDlg->m_CV.hic,0,&pDlg->m_InInfo.bmiHeader,VideoData.Buf,VideoData.nUsedSize,VideoData.nSampleNum); if (VideoData.nUsedSize>0 && VideoData.nUsedSize<8180) { afxDump<<"get compressed data:"<<VideoData.nUsedSize<<"\n"; DWORD Result; Result=ICDecompress(pDlg->m_CV.hic,0,&pDlg->m_InInfo.bmiHeader,VideoData.Buf, &pDlg->m_pOutInfo->bmiHeader,pDlg->m_pOutBuf); if (Result==ICERR_OK) { //pDlg->ShowImage(pDlg->m_pOutBuf); CDC* pDC=pDlg->GetDC(); SetDIBitsToDevice(pDC->GetSafeHdc(),0,0,pDlg->m_pOutInfo->bmiHeader.biWidth,pDlg->m_pOutInfo->bmiHeader.biHeight,0,0,0,pDlg->m_pOutInfo->bmiHeader.biHeight, pDlg->m_pOutBuf,pDlg->m_pOutInfo,DIB_RGB_COLORS); } } // TODO: Add your specialized code here and/or call the base class
CAsyncSocket::OnReceive(nErrorCode); }
额。。是否在win7系统下运行的。可能是有了某些插件的缘故把。我上次也遇到这种问题
调试显示这段代码里有问题 extern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // call shared/exported WinMain return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); }
感觉是这段程序中有问题,但不知道具体在哪// ClientStreamSock.cpp : implementation file
//#include "stdafx.h"
#include "ClientPlus.h"
#include "ClientStreamSock.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif#include "ClientPlusdlg.h"
/////////////////////////////////////////////////////////////////////////////
// CClientStreamSockCClientStreamSock::CClientStreamSock()
{
}CClientStreamSock::~CClientStreamSock()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CClientStreamSock, CAsyncSocket)
//{{AFX_MSG_MAP(CClientStreamSock)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0/////////////////////////////////////////////////////////////////////////////
// CClientStreamSock member functionsvoid CClientStreamSock::OnConnect(int nErrorCode)
{
CClientPlusDlg* pDlg=(CClientPlusDlg*)::AfxGetMainWnd();
if (nErrorCode==0)
{
pDlg->m_ClientCtrlSock.Connect(pDlg->m_strIPAddr,5555);
}
else
{
AfxMessageBox("can't connect to server!");
}
// TODO: Add your specialized code here and/or call the base class
CAsyncSocket::OnConnect(nErrorCode);
}void CClientStreamSock::OnReceive(int nErrorCode)
{
CClientPlusDlg* pDlg=(CClientPlusDlg*)::AfxGetMainWnd();
VIDEO_DATA VideoData;
memset(&VideoData,0,sizeof(VIDEO_DATA));
Receive(&VideoData,sizeof(VIDEO_DATA));
//::ICDraw(pDlg->m_CV.hic,0,&pDlg->m_InInfo.bmiHeader,VideoData.Buf,VideoData.nUsedSize,VideoData.nSampleNum);
if (VideoData.nUsedSize>0 && VideoData.nUsedSize<8180)
{
afxDump<<"get compressed data:"<<VideoData.nUsedSize<<"\n";
DWORD Result;
Result=ICDecompress(pDlg->m_CV.hic,0,&pDlg->m_InInfo.bmiHeader,VideoData.Buf,
&pDlg->m_pOutInfo->bmiHeader,pDlg->m_pOutBuf);
if (Result==ICERR_OK)
{ //pDlg->ShowImage(pDlg->m_pOutBuf);
CDC* pDC=pDlg->GetDC();
SetDIBitsToDevice(pDC->GetSafeHdc(),0,0,pDlg->m_pOutInfo->bmiHeader.biWidth,pDlg->m_pOutInfo->bmiHeader.biHeight,0,0,0,pDlg->m_pOutInfo->bmiHeader.biHeight,
pDlg->m_pOutBuf,pDlg->m_pOutInfo,DIB_RGB_COLORS); } }
// TODO: Add your specialized code here and/or call the base class
CAsyncSocket::OnReceive(nErrorCode);
}
extern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow);extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}