We have custom modules built for V8 2004 that we are now porting to V8i. The code works fine in V8 2004, and when recompiled in V8i doesn't report any error, but we've lost some functionality for no readily apparent reason.
Specifically, we have a hook function that is added via
aaApi_AddHook (AAHOOK_CHANGE_DOCUMENT_FILE, AAPREHOOK, HookAddDeleteChangeDocumentFile_Pre)
What is supposed to (used to) happen is that HookAddDeleteChangeDocumentFile_Pre() checks aParam2 for AAOPER_DOC_CHANGE_FILE operation. If that operation occurs (such as renaming a file), it does some other checks, and if they pass, returns AAHOOK_SUCCESS and allows the user action (rename in this example), otherwise, throws an error message and AAHOOK_ERROR returned, preventing the file rename.
In debugging this, it appears that a file rename event handled through the document Properties dialog is no longer hooked to AAHOOK_CHANGE_DOCUMENT_FILE, as was the case in V8 2004. The hook function is never called.
Is there another hook/operation to use instead? Or is this no longer possible in V8i? Thanks.
Thanks so much for the information. This helps, but I still have some questions.
Is there a way to single out a file rename action in AAHOOK_MODIFY_DOCUMENT? According to the documentation. aaApi_ModifyDocument ( ) takes several parameters that can be changed, one of which is the file name. Do I just need to look at the AADOC_PARAM structure passed in aParam1 to see if lpctstrFileName has changed (and is it NULL if it went unchanged)?
Also, can you tell me what API function is called in PWE when you rename a file by selecting the document Properties dialog for a document, and then in the File section (on the General tab) click on the Advanced button and select Rename, which pops a Rename file dialog. Is it one of the aaApi_ChangeDocumentFile functions, aaApi_ModifyDocument, or an internal PWE function not available in the API?
Jeff
Please note that I post here on a voluntary basis and am not a Bentley employee.
You can check the ulMask for AADOCMODM_FILE_NAME. I attached a sample that will show this, I hope this helps.
Mike
case AAHOOK_MODIFY_DOCUMENT: { AADOC_PARAM* param = (AADOC_PARAM*)aParam1;
if ((param->ulMask & AADOCMODM_FILE_NAME)) message = "MODIFY DOCUMENT EVENT - Rename DOC"; else message = "MODIFY DOCUMENT EVENT";
//Display data MessageBox (NULL, message, _T("AAHOOK_MODIFY_DOCUMENT"), MB_OK); status = AAHOOK_CALL_DEFAULT; } break;