FileUIEvent Problem

FileUIEvent Problem

Anonymous
Not applicable
303 Views
3 Replies
Message 1 of 4

FileUIEvent Problem

Anonymous
Not applicable
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
0 Likes
304 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hello,
I'm also writing an addin for Inventor where i want to manipulated the dialogbox when clicking 'Create Component'
My purpose is to make my own dialogbox for creating a component using specified data that is stored in a database.
I'm using VBA and VB
I have a problem how to activate the FileUIEvents
Somebody has a clue ?
0 Likes
Message 3 of 4

Anonymous
Not applicable
I've attached a VB AddIn sample that displays a dialog box on "File Open"
command, you could similarly implement a dialog box and use it for the
"Create Component" command. I hope this helps.

-Venkates Thiyagarajan.


wrote in message news:4824976@discussion.autodesk.com...
> Hello,
> I'm also writing an addin for Inventor where i want to manipulated the
> dialogbox when clicking 'Create Component'
> My purpose is to make my own dialogbox for creating a component using
> specified data that is stored in a database.
> I'm using VBA and VB
> I have a problem how to activate the FileUIEvents
> Somebody has a clue ?
0 Likes
Message 4 of 4

Anonymous
Not applicable
thx for the help but sad but true the zip file is corrupted, bad file header ?
0 Likes