相同的代码6.0没问题,
vc.net调试就提示0x7c921230 处未处理的异常: 用户断点 怎么办?
调用堆栈   ntdll.dll!7c921230() 
反汇编     7C921230  int         3
提示中断 还是继续时 连续选继续n(>200)次以后可以继续运行怎么回事,哪位大侠帮一下忙代码如下(出问题的地方hr = pSrcGrp->PrepareToEncode(VARIANT_TRUE);)
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include <conio.h> // for kbhit()void main()
{
    // Declare variables.
    HRESULT hr;
    IWMEncoder* pEncoder;
    IWMEncSourceGroupCollection* pSrcGrpColl;
    IWMEncSourceGroup* pSrcGrp;
    IWMEncSource* pSrc;
    IWMEncSource* pSrcAud;
    IWMEncVideoSource* pSrcVid;
    IWMEncProfileCollection* pProColl;
    IWMEncProfile* pPro;
    IWMEncFile* pFile;
    IWMEncAttributes* pAttr;
    IWMEncDisplayInfo* pDispInfo;
    CComBSTR bstrName = NULL;
    long lCount;
    int i;    // Initialize the COM library and retrieve a pointer to an IWMEncoder interface.
    hr = CoInitialize(NULL);
    if ( SUCCEEDED( hr ) )
    {
        hr = CoCreateInstance(CLSID_WMEncoder,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWMEncoder,
            (void**) &pEncoder);
    }    // Retrieve the source group collection.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_SourceGroupCollection(&pSrcGrpColl);
    }    // Add a source group to the collection.
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcGrpColl->Add(CComBSTR("SG_1"), &pSrcGrp);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcGrp->AddSource(WMENC_AUDIO, &pSrcAud);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcGrp->AddSource(WMENC_VIDEO, &pSrc);
    }    // Retrieve an IWMEncVideoSource pointer.
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrc->QueryInterface(IID_IWMEncVideoSource, (void**)&pSrcVid);
    }    // Add a video and audio source to the source group.
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcVid->SetInput(CComBSTR("C:\\InputFile.mpg"));
    }    // Specify the cropping margins.
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcVid->put_CroppingBottomMargin(5);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcVid->put_CroppingTopMargin(5);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcVid->put_CroppingLeftMargin(3);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcVid->put_CroppingRightMargin(3);
    }    // Fill in the description object members.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_DisplayInfo(&pDispInfo);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDispInfo->put_Author(CComBSTR("Author Name"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDispInfo->put_Copyright(CComBSTR("Copyright"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDispInfo->put_Description(CComBSTR("A description"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDispInfo->put_Rating(CComBSTR("Rating"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDispInfo->put_Title(CComBSTR("The Title"));
    }    // Add an attribute to the collection.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_Attributes(&pAttr);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr =  pAttr->Add(CComBSTR("URL"), CComVariant("IP Address"));
    }    // Specify a file object in which to save encoded content.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_File(&pFile);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pFile->put_LocalFileName(CComBSTR("C:\\OutputFile.wmv"));
    }    // Choose a profile from the collection.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_ProfileCollection(&pProColl);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pProColl->get_Count(&lCount);
    }
    for (i=0; i<lCount; i++)
    {
        if ( SUCCEEDED( hr ) )
        {
            hr = pProColl->Item(i, &pPro);
        }
        if ( SUCCEEDED( hr ) )
        {
            hr = pPro->get_Name(&bstrName);
        }
        if (_wcsicmp(bstrName,CComBSTR("Windows Media Video 8 for Local Area Network (384 Kbps)"))==0)
        {
            // Set the profile in the source group.
            if ( SUCCEEDED( hr ) )
            {
                hr = pSrcGrp->put_Profile(CComVariant(pPro));
            }
            break;
        }
    }    // Start the encoding process.
if ( SUCCEEDED( hr ) )
hr = pSrcAud->put_Repeat( VARIANT_FALSE );
if ( SUCCEEDED( hr ) )
hr = pSrcVid->put_Repeat( VARIANT_FALSE );
if ( SUCCEEDED( hr ) )
hr = pSrcAud->put_MarkIn( 10 );
if ( SUCCEEDED( hr ) )
hr = pSrcAud->put_MarkOut( 100 );
if ( SUCCEEDED( hr ) )
hr = pSrcVid->put_MarkIn( 10 );
if ( SUCCEEDED( hr ) )
hr = pSrcVid->put_MarkOut( 100 );
if ( SUCCEEDED( hr ) )
hr = pEncoder->put_AutoStop( VARIANT_TRUE );
if ( SUCCEEDED( hr ) )
    {
        hr = pSrcGrp->PrepareToEncode(VARIANT_TRUE);
    }
if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->Start();
        // Keep the console window open.
       // printf("When encoding stops, press a key to close the console window.");
}

WMENC_ENCODER_STATE enumEncoderState = WMENC_ENCODER_STOPPED;
while ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_RunState(&enumEncoderState);
if ( enumEncoderState == WMENC_ENCODER_RUNNING )
Sleep(100);
else
break;
}
if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->Stop();
    }
    // Release pointers.
    if ( pSrcGrpColl )
    {
        pSrcGrpColl->Release();
        pSrcGrpColl = NULL;
    }
    if ( pSrcGrp )
    {
        pSrcGrp->Release();
        pSrcGrp = NULL;
    }
    if ( pProColl )
    {
        pProColl->Release();
        pProColl = NULL;
    }
    if ( pPro )
    {
        pPro->Release();
        pPro = NULL;
    }
    if ( pFile )
    {
        pFile->Release();
        pFile = NULL;
    }
    if ( pSrcAud )
    {
        pSrcAud->Release();
        pSrcAud = NULL;
    }
    if ( pSrcVid )
    {
        pSrcVid->Release();
        pSrcVid = NULL;
    }
    if ( pSrc )
    {
        pSrc->Release();
        pSrc = NULL;
    }
    if ( pAttr )
    {
        pAttr->Release();
        pAttr = NULL;
    }
    if ( pDispInfo )
    {
        pDispInfo->Release();
        pDispInfo = NULL;
    }
    if ( pEncoder )
    {
        pEncoder->Release();
        pEncoder = NULL;
    }
}

解决方案 »

  1.   

    没那么简单
    我是调用 Media Encoder的库时出这个问题。
    直接运行debug版,release版都没问题
    只有调试debug版时才出现问题应该跟环境有关,我也换了运行时库什么的也没有帮助
    一定有人也遇到过这个问题
    不知道是怎么解决的
    不吝赐教
      

  2.   

    呵呵!!! 一样的情况,我调用的是串口库,release 就是没有问题
      

  3.   

    int3?应该是什么地方DebugBreak了,是不是什么断言错误?
      

  4.   

    楼上说的对   不过我调用的是Windows Media Encoder中的库,没办法解决
      

  5.   

    我也是这样的问题呀,只有调试debug版时才出现问题,一样一样地
    有没有好的解决方法呢?
      

  6.   

    我的提示是:“Project.exe 中的 0x7c921230 处未处理的异常:用户断点 。”就没了。继续跟
    就出现保户错了:Debug Assertion Failed! 
    好像就是什么断言错误!Release下就没问题。
    盼请高手解答!!