diff --git a/docs/changes.txt b/docs/changes.txt index 3375106062..eb5982c033 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -611,6 +611,7 @@ wxMSW: - Show new style directory selector even for non existent paths (raychow). - Fix order of radial gradient stops (Alexandru Pana). - Fix font created using wxFont(wxFontInfo()) ctor. +- Fix wxFileName::GetShortcutTarget() in console applications. 3.0.1: (released 2014-06-15) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 6acde7603c..51e80c1c83 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -102,6 +102,7 @@ #include "wx/msw/private.h" #include // for CLSID_ShellLink #include "wx/msw/missing.h" + #include "wx/msw/ole/oleutils.h" #endif #if defined(__WXMAC__) @@ -1706,6 +1707,9 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, if (ext.CmpNoCase(wxT("lnk"))!=0) return false; + // Ensure OLE is initialized. + wxOleInitializer oleInit; + // create a ShellLink object hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl);