Message 1 of 4
FileUIEvent Problem
Not applicable
06-17-2004
11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everybody,
I am writing a addin where I am trying to catch the fileopen event(which is fired before the file open dialog is diaplayed).
I have created a com class in vc++ which implements the SINK MAP.
I am able to capture the FileOpenDialog event and display a message box. but after displaying the message box when I click OK Debug assertion failed message box is displayed.
When I click Ignore the open dialog is displayed.
I could not find why this debug assertion failed message box is being displayed.
I am posting the code for the class that I am using.
It will be of great help if some could give me a hint on this.
Code is as below
//// Class Declaration
// CFileOpen
class ATL_NO_VTABLE CFileOpen :
public CComObjectRootEx,
public CComCoClass,
public IDispatchImpl,
public IDispEventImpl< 0, CFileOpen, &DIID_FileUIEventsSink, &LIBID_Inventor, 1, 0 >
{
public:
CFileOpen()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_FILEOPEN)
DECLARE_PROTECT_FINAL _CONSTRUCT()
BEGIN_COM_MAP(CFileOpen)
COM_INTERFACE_ENTRY(IFileOpen)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
STDMETHOD (On_FileOpenDialog)( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, struct NameValueMap * Context, enum HandlingCodeEnum * HandlingCode, HRESULT * _presult );//( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, enum HandlingCodeEnum * HandlingCode );
BEGIN_SINK_MAP( CFileOpen )
SINK_ENTRY_EX( 0, DIID_FileUIEventsSink, FileUIEventsSink_OnFileOpenDialog, On_FileOpenDialog)
END_SINK_MAP()
// IFileOpen
public:
};
//
STDMETHODIMP CFileOpen::On_FileOpenDialog( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, struct NameValueMap * Context, enum HandlingCodeEnum * HandlingCode, HRESULT * _presult )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try{
AfxMessageBox(_T("Hello.............."));
*HandlingCode=kEventNotHandled;
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
Thanks,
Ravi
I am writing a addin where I am trying to catch the fileopen event(which is fired before the file open dialog is diaplayed).
I have created a com class in vc++ which implements the SINK MAP.
I am able to capture the FileOpenDialog event and display a message box. but after displaying the message box when I click OK Debug assertion failed message box is displayed.
When I click Ignore the open dialog is displayed.
I could not find why this debug assertion failed message box is being displayed.
I am posting the code for the class that I am using.
It will be of great help if some could give me a hint on this.
Code is as below
//// Class Declaration
// CFileOpen
class ATL_NO_VTABLE CFileOpen :
public CComObjectRootEx
public CComCoClass
public IDispatchImpl
public IDispEventImpl< 0, CFileOpen, &DIID_FileUIEventsSink, &LIBID_Inventor, 1, 0 >
{
public:
CFileOpen()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_FILEOPEN)
DECLARE_PROTECT_FINAL _CONSTRUCT()
BEGIN_COM_MAP(CFileOpen)
COM_INTERFACE_ENTRY(IFileOpen)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
STDMETHOD (On_FileOpenDialog)( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, struct NameValueMap * Context, enum HandlingCodeEnum * HandlingCode, HRESULT * _presult );//( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, enum HandlingCodeEnum * HandlingCode );
BEGIN_SINK_MAP( CFileOpen )
SINK_ENTRY_EX( 0, DIID_FileUIEventsSink, FileUIEventsSink_OnFileOpenDialog, On_FileOpenDialog)
END_SINK_MAP()
// IFileOpen
public:
};
//
STDMETHODIMP CFileOpen::On_FileOpenDialog( SAFEARRAY * * FileTypes, long ParentHWND, BSTR * FileName, struct NameValueMap * Context, enum HandlingCodeEnum * HandlingCode, HRESULT * _presult )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try{
AfxMessageBox(_T("Hello.............."));
*HandlingCode=kEventNotHandled;
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
Thanks,
Ravi