我生成一个Dialog,在里面有一个按牛,点了一下和一个服务器建立连接,发送连接信息,服务器返回信息后,要动态的更新界面。
在协议解吸里面收到服务器的确认后,我调用
ReturnLoginInfo(int pReturn)
{
if(pReturn==0)
{
m_SystemStatic="身份验证失败,用户名不存在.........";
** this->RedrawWindow();
return;
}
}在OnPaint()里面是这样的
void CPLoginDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.BitBlt(0,0,489,246,&memdc,0,0,SRCCOPY);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(0,0,255));
dc.TextOut(108,76,m_SystemStatic);
}
可以一到那个*号的地方就出现异常呢?什么原因,百思不解呀
在协议解吸里面收到服务器的确认后,我调用
ReturnLoginInfo(int pReturn)
{
if(pReturn==0)
{
m_SystemStatic="身份验证失败,用户名不存在.........";
** this->RedrawWindow();
return;
}
}在OnPaint()里面是这样的
void CPLoginDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.BitBlt(0,0,489,246,&memdc,0,0,SRCCOPY);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(0,0,255));
dc.TextOut(108,76,m_SystemStatic);
}
可以一到那个*号的地方就出现异常呢?什么原因,百思不解呀
First-chance exception in ConferClient.exe (HOOKDLL.DLL): 0xC0000005: Access Violation.
这是什么意思啊?哪位大哥帮忙看看,到底什么问题啊?
可能找不到当前窗口的句并?对不对?
CPaintDC::CPaintDC(CWnd* pWnd)
{
ASSERT_VALID(pWnd);
** ASSERT(::IsWindow(pWnd->m_hWnd)); if (!Attach(::BeginPaint(m_hWnd = pWnd->m_hWnd, &m_ps)))
AfxThrowResourceException();
}
????
has been created!Just add a logic :
ReturnLoginInfo(int pReturn)
{
if(pReturn==0)
{
m_SystemStatic="身份验证失败,用户名不存在.........";
if(this->m_hWnd)
** this->RedrawWindow();
return;
}
}If this function is only called once prior to your dialog window creation,then
it has no effect ,then you should post a message or use EVENT object to do that
job!
但是用AfxGetApp()->GetMainWnd()->SendMessage()就可以????