wxWidgets: la obtención de ruta de la aplicación
Pregunta
¿Cómo se puede obtener ruta al módulo?
Le escribo extensión encerrado en un DLL y quiero obtener la ruta a mi biblioteca en tiempo de ejecución.
Actualizar
Por supuesto primera manera funcionó bien
static wxString GetModulePath()
{
static wxString path;
WCHAR buf[512] = {0};
GetModuleFileName(NULL, buf, 511);
path = buf;
return wxPathOnly(path);
}
pero finalmente terminó con la segunda
wxStandardPaths sp;
wxLogError(sp.GetPluginsDir());
Solución
Tener un vistazo a la href="http://docs.wxwidgets.org/stable/wx_wxstandardpaths.html#wxstandardpaths" rel="nofollow noreferrer"> wxStandardPaths
clase GetExecutablePath()
o métodos GetPluginsDir()
podría ser utilizado -. no estoy seguro de lo que quiere hacer
Otros consejos
He utilizado
#include "wx/stdpaths.h"
#include "dialogsApp.h"
#include "dialogsMain.h"
IMPLEMENT_APP(dialogsApp);
bool dialogsApp::OnInit()
{
wxString xpath;
xpath = wxStandardPaths::Get().GetExecutablePath();
que parece funcionar.
Esto no es wxWidgets específica. Windows tiene una función llamada GetModuleFileName que hace lo que quiere. El enlace es a la página de MSDN.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow