Hi,
I have a custom attribute called file ID and it is uniqe, I wont to use this attribute's value to be as the name of document file. once user clike ssave in properties page.
I used "AAHOOK_UPDATE_LINK_DATA"
LONG AAAPIHOOK Hook_PreModifyDocument2
(
LONG *hookId*/,
LONG /*hookType*/,
AAPARAM aParam1,
AAPARAM aParam2,
AARESULT* pResult
)
{
if (aParam2 != AAOPER_DOC_UPDATE_LINK_DATA)
return AAHOOK_SUCCESS;
LPAADOC_PARAM pProParam = (LPAADOC_PARAM)aParam1;
if (pProParam->lDocumentId != 0)
the problem is LPAADOC_PARAM dose not return the correct Document ID.
any Idea?
Regards
Ghazi
Sorry, I thought you were having a problem with your cast. Yes, what you cast "to" is determined by which hook you are using.
As for help with references and MicroStation, I'll let someone else answer those questions as I haven't really done much with MicroStation for a while and someone else is likely to be able to answer your questions quicker and concisely.
Hi Dan,As I mentioned earlier, see above, when I tried:
LPAAEALINKAGE lPLinkage = pDocParam->lpLinkage; //But can't get linkage. Don't know why?
So I can't get the likage, let alone documentId, why?
Thanks
Wence
Hi Dan,
Please check your private message.
I think your casting way is the same as mine, we all got a pointer to AAHOOK_UPDATE_LINK_DATA. I tried to debug using your code. Still got the same error when tring to get the linkage. All other members are good, like ulMask, lTableId, lAttributeRecordId.
I believe the documentation for AAHOOK_UPDATE_LINK_DATA is incomplete. From notes I have in code that uses this hook, whenever the operation from aAparam2 is AAOPER_DOC_UPDATE_LINK_DATA, lpLinkage is not defined. This has also been my experience with it.
As you've already found, the only way to get the Doc Id in this scenario is to use aaApi_SelectLinksByAttr and then aaApi_GetLinkNumericProperty.