Issue
How can I get the full path of loaded LISP applications?
Solution
There are two APIs on the AcApDocument class in ObjectARX that you can use to get this information.
The following is more information on these functions:
virtual int GetCountOfLispList() const;
Returns the number of load LISP files.
virtual AcLispAppInfo* GetItemOfLispList(int nIndex) const;
Returns the descriptor structure for the LISP application designated by nIndex.
Paramters:
nIndex – integer between 0 and GetCountOfLispList()
class AcLispAppInfo
{
public: TCHAR appFileName[_MAX_PATH];
bool bUnloadable;
};
Returned by the GetItemOfLispList.
appFileName – full path of the lisp application
bUnloadable – specifies if the lisp application is unloadable
static void getLISPFullPathByARX() { AcApDocument* pActiveDoc = acDocManager->mdiActiveDocument(); // count of LISP files int lispCount = pActiveDoc->GetCountOfLispList(); CString msg; msg.Format(L"count of LISP file: %d",lispCount); MessageBox(NULL,msg,msg,0); // each LISP info
<p style="margin: 0px"><span style="line-height: 140%"> </span><span style="line-height: 140%;color: blue">for</span><span style="line-height: 140%">(</span><span style="line-height: 140%;color: blue">int</span><span style="line-height: 140%"> index = 0 ;</span></p> <p style="margin: 0px"><span style="line-height: 140%">     index < lispCount;</span></p> <p style="margin: 0px"><span style="line-height: 140%">     index++)</span></p> <p style="margin: 0px"><span style="line-height: 140%"> {</span></p> <p style="margin: 0px"> </p> <p style="margin: 0px"><span style="line-height: 140%">     TCHAR msg1[256] = {0}; </span></p> <p style="margin: 0px"><span style="line-height: 140%">     AcLispAppInfo *pEachInfo = </span></p> <p style="margin: 0px"><span style="line-height: 140%">         pActiveDoc->GetItemOfLispList(index);</span></p> <p style="margin: 0px"> </p> <p style="margin: 0px"><span style="line-height: 140%">     _tcscat( msg1,pEachInfo->appFileName);</span></p> <p style="margin: 0px"> </p> <p style="margin: 0px"><span style="line-height: 140%">     </span><span style="line-height: 140%;color: blue">if</span><span style="line-height: 140%">(pEachInfo->bUnloadable)</span></p> <p style="margin: 0px"><span style="line-height: 140%">        _tcscat(msg1,L</span><span style="line-height: 140%;color: #a31515">"nloadablen"</span><span style="line-height: 140%">);</span></p> <p style="margin: 0px"><span style="line-height: 140%">     </span><span style="line-height: 140%;color: blue">else</span></p> <p style="margin: 0px"><span style="line-height: 140%">        _tcscat(msg1,L</span><span style="line-height: 140%;color: #a31515">"nunloadablen"</span><span style="line-height: 140%">);</span></p> <p style="margin: 0px"><span style="line-height: 140%">      MessageBox(NULL,msg1,msg1,0); </span></p> <p style="margin: 0px"><span style="line-height: 140%"> }</span></p> <p style="margin: 0px"> </p> <p style="margin: 0px"><span style="line-height: 140%">}</span></p> </div>

Leave a Reply