multiple instances of activeX in MFC
Posted: 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
//release vlc
thanks you!
cheers
maojz
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();
}
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;
}
}
}
cheers
maojz