atl做acitvex控件,中间有语句
         ((CStatic *)hWnd5)->GetWindowRect(&orirc);
运行到此时报错
Unhandled exception in Mby.exe MFC42D.DLL :0xC0000005;Access Violation 
然后停留在:
{ ASSERT(::IsWindow(m_hWnd)); ::GetWindowRect(m_hWnd, lpRect); }
这是杂回事哦!

解决方案 »

  1.   

    hWnd5是什么类型的?
    为啥要强制转化?
      

  2.   

    hwnd5是getdlgitem(idc_static5)的值
    无法用classwizard获得
      

  3.   

    你先看看hwnd5是什么类型,是不是空指针还是HWND类型
    最好贴出你怎么给hwnd5赋值的
      

  4.   

    LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
    hWnd5 =GetDlgItem(IDC_STATIC5);
        hWnd6 =GetDlgItem(IDC_STATIC6);
        hWnd7 =GetDlgItem(IDC_STATIC7);
        hWnd8 =GetDlgItem(IDC_STATIC8);
    MP4_ClientSetNetPort(5050,6050);
    MP4_ClientStartup(WM_MYCOMMAND,this->m_hWnd);
    blarged=FALSE; return 0;
    }
    LRESULT OnClickedStatic5(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
    {CRect orirc;
    if (nn1 >= 0 )
    {
    MP4_ClientAudioStart(nn1);
    MP4_ClientAudioVolume(0xfff0);
    }
    if (blarged)
    {
    ScreenToClient((LPPOINT)&orirc);
    ScreenToClient((LPPOINT)&orirc+1); ((CStatic *)hWnd5)->MoveWindow(orirc,TRUE);
    ((CStatic *)hWnd6)->ShowWindow(SW_SHOW);
    ((CStatic *)hWnd7)->ShowWindow(SW_SHOW);
    ((CStatic *)hWnd8)->ShowWindow(SW_SHOW); blarged = FALSE;
    }
    else
    {
    ((CStatic *)hWnd5)->GetWindowRect(&orirc);
        ((CStatic *)hWnd6)->ShowWindow(SW_HIDE);
    ((CStatic *)hWnd7)->ShowWindow(SW_HIDE);
    ((CStatic *)hWnd8)->ShowWindow(SW_HIDE);
         RECT XX;
            GetClientRect(&XX);
    ((CStatic *)hWnd5)->MoveWindow(0,0,XX.right ,XX.bottom ,TRUE);
    //m_video5.MoveWindow(10,10,(int)(352*1.6),(int)(288*1.6),TRUE);
    blarged = TRUE;

    }
    Fire_click();
    return 0;
    }非空,难道我强制转化他就空了?用mfc的话估计没这个问题了
      

  5.   

    CWindow wnd5 =GetDlgItem(IDC_STATIC5);
    ...wnd5.MoveWindow(orirc,TRUE);
    ....
      

  6.   

    果然,csdn真是好地方,人才啊,谢谢楼上的啊