views:

598

answers:

2

How one can obtain path to module?

I am writing extension enclosed in a DLL and want to get path to my library in runtime.

Update

Of course first way worked fine

static wxString GetModulePath()
{
    static wxString path;

    WCHAR buf[512] = {0};
    GetModuleFileName(NULL, buf, 511);
    path = buf;

    return wxPathOnly(path);
}

but finally I ended with second one

wxStandardPaths sp;
wxLogError(sp.GetPluginsDir());
A: 

This isn't wxWidgets specific. Windows has a function called GetModuleFileName that does what you want. The link is to the msdn page.

Jere.Jones
+2  A: 

Have a look at the wxStandardPaths class. For your problem its GetExecutablePath() or GetPluginsDir() methods could be used - I'm just not sure what you want to do.

mghie
That was just I was looking for. Thanks!
jonny