在网上找了很久关于该问题的解决方案,没见个完美的
这里有一种解决方案~http://www.codeguru.com/cpp/com-tech/activex/com/article.php/c12229/源码下载地址是
http://www.codeguru.com/dbfiles/get_file/flash.zip?id=12229&lbl=FLASH_ZIP&ds=20060711
注意修改里面的#import "c:\\winnt\\system32\\macromed\\flash\\flash.ocx" named_guids 路径但是我在vs2005里编译通过后,运行时总是发生这样的错
Unhandled exception at 0x0046f8ee in flash.exe: 0xC0000005: Access violation writing location 0x004a9f6c.哎~哪位晓得该怎么解决~

解决方案 »

  1.   

    据说FLASH设置的门槛很多,不按常理出牌……
      

  2.   

    我是在vs2005运行~不知道vc6.0会不会出问题
      

  3.   

    OLECONTAINER(void)::Draw(HDC hdcDraw, const RECT *rcDraw, BOOL bErase)
    {
    HWND hwnd = GetHWND();
    HRESULT hr;
    RECT r; IOleObject *lpO = m_lpO;
    IViewObject *lpV = m_lpViewObjectEx ? (IViewObject *)m_lpViewObjectEx : m_lpViewObject; if (!m_bTransparent)
    {
    RECT rTotal;
    ::GetClientRect(hwnd, &rTotal);
    if (lpV)
    {
    if (!hdcDraw)
    {
    hdcDraw = ::GetDC(hwnd);
    hr = OleDraw(lpV, DVASPECT_CONTENT, hdcDraw, &rTotal);
    ::ReleaseDC(hwnd, hdcDraw);
    }
    else
    {
    hr = OleDraw(lpV, DVASPECT_CONTENT, hdcDraw, &rTotal);
    }
    }
    return;
    } ::GetWindowRect(hwnd, &r);
    if (!m_hdcBack || !EqualRect(&r, &m_rcBounds))
    {
    if (m_hdcBack)
    ::DeleteDC(m_hdcBack);
    if (m_bmpBack)
    ::DeleteObject(m_bmpBack);
    if (m_hdcBackW)
    ::DeleteDC(m_hdcBackW);
    if (m_bmpBackW)
    ::DeleteObject(m_bmpBackW);
    m_rcBounds = r; HDC hdc = ::GetDC(hwnd);
    BITMAPINFOHEADER bih = {0};
    bih.biSize = sizeof(BITMAPINFOHEADER);
    bih.biBitCount = 32;
    bih.biCompression = BI_RGB;
    bih.biPlanes = 1;
    bih.biWidth = r.right - r.left;
    bih.biHeight = -(r.bottom - r.top);
    m_hdcBack = CreateCompatibleDC(hdc);
    m_bmpBack = CreateDIBSection(hdc, (BITMAPINFO *)&bih, DIB_RGB_COLORS, (void **)&m_lpBitsOnly, NULL, 0x0);
    SelectObject(m_hdcBack, m_bmpBack);
    if (m_bFixTransparency)
    {
    m_hdcBackW = CreateCompatibleDC(hdc);
    m_bmpBackW = CreateDIBSection(hdc, (BITMAPINFO *)&bih, DIB_RGB_COLORS, (void **)&m_lpBitsOnlyW, NULL, 0x0);
    SelectObject(m_hdcBackW, m_bmpBackW);
    }
    ::ReleaseDC(hwnd, hdc);
    if (m_iBPP == 0)
    m_iBPP = GetDeviceCaps(m_hdcBack, BITSPIXEL);
    }
    POINT p = {r.left, r.top};
    POINT p2 = {0, 0};
    SIZE sz = {r.right-r.left, r.bottom-r.top}; if (lpO && lpV)
    {
    RECT rTotal;
    ::GetClientRect(hwnd, &rTotal);
    RECTL rcBounds = {rTotal.left, rTotal.top, rTotal.right, rTotal.bottom};
    BYTE *dst = m_lpBitsOnly, *dstW;
    if (m_iBPP == 32)
    {
    if (!m_bFixTransparency) //if flash player version is other than 8, do usual painting
    {
    memset(m_lpBitsOnly, 0, sz.cx * sz.cy * 4);
    hr = OleDraw(lpV, DVASPECT_TRANSPARENT, m_hdcBack, &rTotal);
    }
    else //if player version is 8, we need to fix flash player 8 control transparency bug
    {
    memset(m_lpBitsOnly, 0, sz.cx * sz.cy * 4);
    memset(m_lpBitsOnlyW, 255, sz.cx * sz.cy * 4);
    hr = OleDraw(lpV, DVASPECT_TRANSPARENT, m_hdcBack, &rTotal);
    hr = OleDraw(lpV, DVASPECT_TRANSPARENT, m_hdcBackW, &rTotal);
    dst = m_lpBitsOnly;
    dstW = m_lpBitsOnlyW;
    BYTE r, g, b, a, rw, gw, bw, aw, alpha_r, alpha_g, alpha_b, alpha;
    for (int y = 0; y < sz.cy; y++)
    {
    for (int x = 0; x < sz.cx; x++)
    {
    //the idea is that we draw the same data onto black and white DC's
    //and then calculate per pixel alpha based on difference, produced by alpha blending
    r = *dst++;
    g = *dst++;
    b = *dst++;
    a = *dst++;
    rw = *dstW++;
    gw = *dstW++;
    bw = *dstW++;
    aw = *dstW++;
    alpha_r = rw-r;
    alpha_g = gw-g;
    alpha_b = bw-b;
    //division by 3 is for accuracy and can be replaced by
    //alpha = alpha_g; for example
    alpha = (alpha_r + alpha_g + alpha_b) / 3;
    *(dst - 1) = 255 - alpha;
    //this algorithm should be optimized for MMX to achieve best performance
    }

    }
    }
    else //in 8/16/24 bit screen depth UpdateLayeredWindow produces wrong results - we use underlaying DC to paint to
    {
    HWND hwndParent = ::GetParent(hwnd);
    HDC hdcParent = ::GetWindowDC(hwndParent);
    BOOL bRet = BitBlt(m_hdcBack, 0, 0, rTotal.right, rTotal.bottom, hdcParent, 0, 0, SRCCOPY);
    ::ReleaseDC(hwndParent, hdcParent);
    hr = OleDraw(lpV, DVASPECT_TRANSPARENT, m_hdcBack, &rTotal);
    dst = m_lpBitsOnly;
    }
    } BLENDFUNCTION bf;
    bf.BlendOp = AC_SRC_OVER;
    bf.AlphaFormat = AC_SRC_ALPHA;
    bf.BlendFlags = 0;
    bf.SourceConstantAlpha = 255;
    BOOL bRet = UpdateLayeredWindow(hwnd, NULL, &p, &sz, m_hdcBack, &p2, 0, &bf, m_iBPP == 32 ? ULW_ALPHA : ULW_OPAQUE);
    }运行时
    在红色的那段出现Unhandled exception at 0x0043db3e in flash.exe: 0xC0000005: Access violation writing location 0x004a9f6c.
    源码去我给的地址下载~我只把#import "c:\\winnt\\system32\\macromed\\flash\\flash.ocx"
    该成#import "C:\\WINDOWS\\system32\\Macromed\\Flash\\FlDbg10c.ocx" named_guids各位高手帮帮偶了~
      

  4.   

    哈哈,买点关子,I know.............
      

  5.   

    你在这个文件的.h文件中,
    OLECONTAINER_DEF class COleContainerWnd : 
     public IOleClientSite,
     public IOleInPlaceSiteWindowless,
     public IOleInPlaceFrame,
     public IStorage将虚拟继承的属性vitual去掉就可以了
      

  6.   

    问题解决了~谢谢coffee_machine,忽忽
      

  7.   

    怎么看不到coffee_machine的回复呢
      

  8.   

    感谢 coffee_machine 的回复,小的代表大家感谢您~之前给这虚东西搞晕了...已可以显示出效果了。