I have a problem: My application, which I write in Delphi 7, uses ArcMap, exactly esriArcmap 9.1 to read from a mxd datafile. I do it like that :
pMxDocForList:=CoMxDocument.Create as IMxDocument;
pAppForList:=(pMxDocForList as IDocument).Parent;
pAppForList.OpenDocument( aMapDoc );
Then, when I immidiately afterwards try to read from pAppForList.Document, I get "Memory Acces Error", because ArcMap needs time to start itself. So, if I insert after the mentioned lines the instruction Delay(5000) which waits 5s and gives this way ArcMap enough time for start, all will work without problems. But that is not a good solution. Besides I'm getting problems on slower Systems, where this instruction schould wait more.
Someone has me advised, that I should use IDocumentEvents.OpenDocument, that means wait for it. Unfortunatelly he has not explained it to me in details. So that is my question. How can I use those events in Delphi ? Do I have to register them of anything like that ? If somebody knows a better solution than events, please write it too.