Kean Walmsley

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Twitter Updates

    follow me on Twitter



    « Recorded presentation on Autodesk's Component Technologies | Main | Showing AutoCAD's hatch dialog from a .NET application »

    March 15, 2007

    TrackBack

    TrackBack URL for this entry:
    http://www.typepad.com/services/trackback/6a00d83452464869e200d834ed1b3453ef

    Listed below are links to weblogs that reference Getting the list of .NET-defined commands in AutoCAD:

    Comments

    Thanks Kean, That will be excellent to build on.

    Greatly appreciated,
    Regards
    Kerry

    Thanks Kean!
    For commands which is defined in arx-files (not in .NET) we can use such code:
    [code]
    static void GetArxFileFromCommand(void)
    {
    Acad::ErrorStatus es;
    AcArray modules;
    HANDLE hAcad = GetCurrentProcess();
    HMODULE *hMods = NULL;
    DWORD cbneed=0; EnumProcessModules(hAcad,NULL,0,&cbneed);
    DWORD nModules = cbneed/sizeof(HMODULE);
    hMods = new HMODULE[nModules+1];
    EnumProcessModules(hAcad,hMods,cbneed,&cbneed);
    for (int i=0; i Module module; memset(&module,0,sizeof(module));
    GetModuleFileName(hMods[i],module.path,sizeof(module.path)-1);
    MODULEINFO mi; memset(&mi,0,sizeof(mi));
    GetModuleInformation(hAcad,hMods[i],&mi,sizeof(mi));
    module.base = (PBYTE)mi.lpBaseOfDll;
    module.size = mi.SizeOfImage;
    modules.append(module);
    }
    delete [] hMods;
    char buf[256] = "";
    if (acedGetString(FALSE,"\nCommand name (without dot and/or underlining): ",buf) == RTNORM) {
    AcEdCommandStruc cmd;
    if (acedCmdLookup(buf, TRUE, &cmd) || acedCmdLookup(buf, FALSE, &cmd)) {
    PBYTE funPtr = (PBYTE)cmd.fcnAddr;
    for (int i=0; i if (funPtr >= modules[i].base && funPtr <= (modules[i].base+modules[i].size)) {
    acutPrintf("\nModule path: <%s>",modules[i].path);
    }
    }
    }
    }
    }
    [/code]

    Verify your Comment

    Previewing your Comment

    This is only a preview. Your comment has not yet been posted.

    Working...
    Your comment could not be posted. Error type:
    Your comment has been posted. Post another comment

    The letters and numbers you entered did not match the image. Please try again.

    As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

    Having trouble reading this image? View an alternate.

    Working...

    Post a comment

    Feed & Share

    Search