Handling External Applications

ObjectARX applications can load and unload other ObjectARX applications and obtain a list of which external applications are currently loaded, just as AutoLISP programs can (using arxloaded). The following call loads a program called myapp:

if (acedArxLoad("myapp") != RTERROR) {
    // Use acedInvoke() to call functions in "myapp". 
}

When your program is finished with myapp, it can unload it by calling acedArxUnload():

acedArxUnload("myapp");

The function acedArxLoaded() can be used to obtain the names of all currently loaded applications, as in the following code:

struct resbuf *rb1, *rb2; 
for (rb2 = rb1 = acedArxLoaded(); rb2 != NULL; rb2 = rb2->rbnext) { 
    if (rb2->restype == RTSTR) 
        acutPrintf("%s\n", rb2->resval.rstring); 
} 
acutRelRb(rb1); 

You can call the functions acedArxLoaded() and acedArxUnload() in conjunction with each other. The following example unloads all applications except the current one:

struct resbuf *rb1, *rb2; 
for (rb2 = rb1 = acedArxLoaded(); rb2 != NULL; 
    rb2 = rb2->rbnext) { 
    if (strcmp(ads_appname, rb2->resval.rstring) != 0) 
        acedArxUnload(rb2->resval.rstring); 
} 
acutRelRb(rb1);