Page 1 of 1

FSCommand closewindow crashes the application

Posted: Mon Nov 17, 2008 3:43 pm
by Bikram Thapa
Hi !
I am evaluating the f_in_box dll version. I have created a MFC application using the sample 4 translucency. I am using vs2005 without sp1. Every thing works well but the fs command onclose is generating run time exception in

strcore.cpp
void CAfxStringMgr::Free( CStringData* pData ) throw()
{
free(pData);
}

Thanks

Here is the Event Listener and other functions

Code: Select all

void WINAPI FPCAlertListener(HWND hwndFlashPlayerControl, LPARAM lParam, NMHDR* pNMHDR)
{   
   CMainFrame *pThis = (CMainFrame*)lParam;
   if(pThis == NULL) return;    
   switch (pNMHDR->code)  {

        case FPCN_FSCOMMAND: {

            SFPCFSCommandInfoStruct* pInfo = (SFPCFSCommandInfoStruct*)pNMHDR;
         CString cmdString(pInfo->command);   CString argList(pInfo->args);
         //MessageBox(NULL, pInfo->command, _T("FSCommand(): command"), MB_OK | MB_ICONINFORMATION);
            //MessageBox(NULL, pInfo->args, _T("FSCommand(): args"), MB_OK | MB_ICONINFORMATION);
         
         if((cmdString.CompareNoCase(_T("closewindow"))==0) || (cmdString.CompareNoCase(_T("closeself"))==0)) {
            for(int i=0; i < mycmdMap.GetCount(); i++)
            {
               if(myNewAlertMap[0].romName.CompareNoCase(mycmdMap[i].romName)==0 && mycmdMap[i].romMenuName == _T("Show Flash"))
               {   
                  ALERTCMDID = mycmdMap[i].cmdID;                  
                  myNewAlertMap[0].showStatus = false;
                  myNewAlertMap[0].shownStatus = true;
                        SendMessage(hwndFlashPlayerControl,WM_COMMAND, (WPARAM)ID_CLOSE,0);//Send close command to flash dialog window
                  return;
               }
            }
            return;
         }

////////////////

void CTransparentFlashPlayerControlWnd::OnClose()
{
if(myNewAlertMap.GetCount()>0){
         if(myNewAlertMap[0].shownStatus==true && myNewAlertMap[0].showStatus==false){
            myNewAlertMap.RemoveAt(0);            
            DestroyWindow();            
            return;            
         }
      }      
}



Posted: Mon Nov 17, 2008 3:52 pm
by Softanics
Thank you for your question.

Just one quick test: what if to change SendMessage to PostMessage?

Thank you.

Thanks

Posted: Tue Nov 18, 2008 5:24 am
by Bikram Thapa
Thanks it worked.

Posted: Thu Nov 20, 2008 2:55 pm
by Softanics
The problem is one can't destroy a f-in-box window within a handler of a flash event. That's why PostMessage works well instead of SendMessage.

Thank you.