not able to get active document using api
i have made an application in vc++. in this application you can choose a part or assembly in a browse dialog and then it will launch solidworks(using shellexecute) with the part or assembly chosen.
then i get an instance pointer of solidworks using 揅ocreateinstance?
then i get the active document using 揼et_iactivedoc2?
now here is where the issue comes in case i loaded an assembly.
if it is a part then i am able to get the active document pointer instantly. but incase it was a large assembly that requires time loading all the parts that comprise it; then i get a null in the active document pointer.
on the other hand if i introduce some 揹elay?using sleep, it gives solidworks enough time to load the assembly; and then i can get the active document using get_iactivedoc2.
this is fixed only because i entered some delay. is there any cleaner or more efficient way to get the active document from solidworks only when it is fully loaded and not before? or is there any event by which i can know that the active document is fully loaded in solidworks? or that solidworks is ready for using the api on it to get information ?