Ensure OLE is initialized in wxFileName::GetShortcutTarget().
If it isn't, the function doesn't risk to work. This is especially pernicious because OLE is initialized on startup in GUI applications, but not in the console ones only using wxBase, so this function can, completely unexpectedly, give different results in them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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)
|
||||
|
@@ -102,6 +102,7 @@
|
||||
#include "wx/msw/private.h"
|
||||
#include <shlobj.h> // 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);
|
||||
|
Reference in New Issue
Block a user