multiple instances of activeX in MFC

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
knight730
New Cone
New Cone
Posts: 5
Joined: 22 Jan 2008 09:41

multiple instances of activeX in MFC

Postby knight730 » 22 Jan 2008 12:47

Hi,

I have set mulitiple instances in my MFC application. It's normarl while beginning,but when I made them quit ,the app crash!!!!

who knows?
//create vlc

Code: Select all

for (int i=0;i<vlcCount;i++) { memset(temp,0,sizeof(temp)); sprintf_s(temp,10,"%d",(i+1)); vlc[i] = NULL; vlc[i] = new CVlcplugin1; //position CRect rect; GetClientRect(&rect); rect.SetRect(cx,cy,cx+190,cy+190); cx+=200; if (cx==1400) { cy+=200; cx=0; } vlc[i]->Create(temp,WS_CHILD | WS_VISIBLE ,rect,this,IDC_VLCPLUGIN1); VARIANT va; VariantInit(&va); vlc[i]->addTarget ("c:\\test.avi", va, 1,0); vlc[i]->put_Visible(TRUE); vlc[i]->put_Volume(50); } //play for (int i=0;i<vlcCount;i++) { vlc[i]->play(); }
//release vlc

Code: Select all

for (int i=0;i<count;i++) { if (vlc[i]!=NULL) { if (vlc[i]->get_Playing()) { vlc[i]->stop(); vlc[i]->DestroyWindow(); delete vlc[i]; vlc[i]=NULL; } } }
thanks you!
cheers
maojz

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: multiple instances of activeX in MFC

Postby Jean-Baptiste Kempf » 22 Jan 2008 17:45

Give us backtrace and FIX vlc!
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

knight730
New Cone
New Cone
Posts: 5
Joined: 22 Jan 2008 09:41

Re: multiple instances of activeX in MFC

Postby knight730 » 23 Jan 2008 04:04

thank you j-b
Ok,I will describe the problem with more specifiction.

when I set more than two vlc in my MFC application,In the release vlc fuction,in the second "for cycle",at vlc->destroywindow(); the app will crash.and jump this window: Monitors.exe at 0x7c92eb74 exception: 0xC0000008: An invalid handle was specified.

and the code will jump into occsite.cpp ,at m_pObject->Release();:

Code: Select all

COleControlSite::COleControlSite(COleControlContainer* pCtrlCont) : m_pCtrlCont(pCtrlCont), m_pWndCtrl(NULL), m_pDC(NULL), m_nID((UINT)-1), m_pObject(NULL), m_pInPlaceObject(NULL), m_pActiveObject(NULL), m_pWindowlessObject(NULL), m_dwEventSink(0), m_dwPropNotifySink(0), m_dwMiscStatus(0), m_dwNotifyDBEvents(0), m_pDataSourceControl(NULL), m_pDSCSite(NULL), m_defdispid(0), m_dwType(0), m_pBindings(NULL), m_bIgnoreNotify(FALSE), m_bIsDirty(FALSE), m_bIsWindowless(FALSE) { memset(&m_varResult, 0, sizeof(VARIANT)); m_varResult.vt = VT_EMPTY; } COleControlSite::~COleControlSite() { if (m_pCtrlCont && m_pCtrlCont->m_pSiteCapture == this) { m_pCtrlCont->m_pSiteCapture = NULL; } delete m_pDataSourceControl; DetachWindow(); DisconnectSink(m_iidEvents, m_dwEventSink); DisconnectSink(IID_IPropertyNotifySink, m_dwPropNotifySink); DisconnectSink(IID_INotifyDBEvents, m_dwNotifyDBEvents); if (m_pWindowlessObject != NULL) { m_pWindowlessObject->Release(); m_pWindowlessObject = NULL; } if (m_pInPlaceObject != NULL) { m_pInPlaceObject->InPlaceDeactivate(); m_pInPlaceObject->Release(); m_pInPlaceObject = NULL; } if (m_pActiveObject != NULL) { m_pActiveObject->Release(); m_pActiveObject = NULL; } if (m_pObject != NULL) { m_pObject->SetClientSite(NULL); m_pObject->Close(OLECLOSE_NOSAVE); m_pObject->Release(); m_pObject = NULL; } ::VariantClear(&m_varResult); BindProperty(DISPID_UNKNOWN, NULL); // gets rid of complex bindings if (m_defdispid != 0 && m_pDSCSite != NULL && m_pDSCSite->m_pDataSourceControl != NULL) { // get rid of simple bindings m_pDSCSite->m_pDataSourceControl->BindProp(this, FALSE); } if (m_pCtrlCont && m_bIsWindowless) { m_pCtrlCont->m_nWindowlessControls--; ASSERT(m_pCtrlCont->m_nWindowlessControls >= 0); } }

Any question with the release fuction that I have writed?


thank you !
Best Regards,
maojz
Last edited by knight730 on 23 Jan 2008 04:08, edited 1 time in total.

knight730
New Cone
New Cone
Posts: 5
Joined: 22 Jan 2008 09:41

Re: multiple instances of activeX in MFC

Postby knight730 » 23 Jan 2008 04:04

I used vlc :0.8.6d

knight730
New Cone
New Cone
Posts: 5
Joined: 22 Jan 2008 09:41

Re: multiple instances of activeX in MFC

Postby knight730 » 24 Jan 2008 02:50

Anybody knows about it???
It seems a bug for VLC.

maojz

benjis
New Cone
New Cone
Posts: 3
Joined: 05 Feb 2008 14:40

Re: multiple instances of activeX in MFC

Postby benjis » 05 Feb 2008 16:35

Hi

Send me the project and will look into it to: spitzerbenjamin@gmail.com

Benji


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 7 guests