mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
parent
91221fd4ce
commit
1e474e9ebd
2 changed files with 31 additions and 0 deletions
|
@ -99,6 +99,8 @@ wchar_t* qToWide(const QString &str)
|
|||
|
||||
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir)
|
||||
{
|
||||
CCOMHelper comHelper;
|
||||
|
||||
IShellLinkW* psl;
|
||||
|
||||
// Get a pointer to the IShellLink interface. It is assumed that CoInitialize
|
||||
|
@ -135,6 +137,8 @@ bool createLink(const QString &link, const QString &name, const QString &executa
|
|||
|
||||
bool resolveLink(const QWidget &window, const QString &linkFile, QString &path)
|
||||
{
|
||||
CCOMHelper comHelper;
|
||||
|
||||
IShellLinkW* psl;
|
||||
WIN32_FIND_DATAW wfd;
|
||||
|
||||
|
@ -239,3 +243,21 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
CCOMHelper::CCOMHelper()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// to fix the bug with QFileDialog::getExistingDirectory hanging under Windows
|
||||
m_mustUninit = SUCCEEDED(CoInitialize(NULL));
|
||||
#else
|
||||
m_mustUninit = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
CCOMHelper::~CCOMHelper()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// only call CoUninitialize if CoInitialize succeeded
|
||||
if (m_mustUninit) CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -51,4 +51,13 @@ wchar_t* qToWide(const QString &str);
|
|||
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir);
|
||||
bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj);
|
||||
|
||||
class CCOMHelper
|
||||
{
|
||||
bool m_mustUninit;
|
||||
|
||||
public:
|
||||
CCOMHelper();
|
||||
~CCOMHelper();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue