Domanda

Come si può ottenere il percorso al modulo?

Vi scrivo estensione racchiuso in una DLL e vuole ottenere il percorso alla mia biblioteca in fase di esecuzione.

Aggiorna

Naturalmente primo modo ha funzionato bene

static wxString GetModulePath()
{
    static wxString path;

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

    return wxPathOnly(path);
}

, ma alla fine ho finito con seconda

wxStandardPaths sp;
wxLogError(sp.GetPluginsDir());
È stato utile?

Soluzione

Dai un'occhiata al href="http://docs.wxwidgets.org/stable/wx_wxstandardpaths.html#wxstandardpaths" rel="nofollow noreferrer"> wxStandardPaths classe GetExecutablePath() o metodi GetPluginsDir() potrebbe essere utilizzato -. sono solo, non sicuro di quello che si vuole fare

Altri suggerimenti

ho usato

    #include "wx/stdpaths.h"
    #include "dialogsApp.h"
    #include "dialogsMain.h"

    IMPLEMENT_APP(dialogsApp);

    bool dialogsApp::OnInit()
    {

        wxString xpath;
        xpath = wxStandardPaths::Get().GetExecutablePath();

Che sembra funzionare.

Non è wxWidgets specifica. Windows ha una funzione chiamata GetModuleFileName che fa quello che si vuole. Il collegamento è alla pagina di MSDN.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top