97 DWORD bufferSize =
sizeof(wchar_t) * MAX_PATH;
98 long returnValue = -1;
103 wchar_t keyValue[MAX_PATH] = {0};
107 res = RegOpenKeyEx(HKEY_CURRENT_USER,
108 L
"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice",
109 0, KEY_READ, &handle);
110 if (res == ERROR_SUCCESS) {
111 returnValue = RegQueryValueEx(handle, L
"Progid", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
117 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, (
const wchar_t*)
keyName.
utf16(), 0, KEY_READ, &handle);
118 if (res != ERROR_SUCCESS)
121 bufferSize =
sizeof(wchar_t) * MAX_PATH;
122 returnValue = RegQueryValueEx(handle, L
"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
145 PROCESS_INFORMATION pi;
146 ZeroMemory(&pi,
sizeof(pi));
148 ZeroMemory(&si,
sizeof(si));
151 returnValue = CreateProcess(NULL, (
wchar_t*)command.
utf16(), NULL, NULL,
FALSE, 0, NULL, NULL, &si, &pi);
156 CloseHandle(pi.hProcess);
157 CloseHandle(pi.hThread);
168 0, 0, SW_SHOWNORMAL);
169 return (returnValue > 32);
#define ShellExecute(a, b, c, d, e, f)
static QString keyName(const QString &rKey)
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
QIntegerForSizeof< void * >::Unsigned quintptr
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
QString & replace(int i, int len, QChar after)
static bool openDocument(const QUrl &file)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QChar class provides a 16-bit Unicode character.
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
#define FALSE
Synonym for false.
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
const char * constData() const
Returns a pointer to the data stored in the byte array.
QString scheme() const
Returns the scheme of the URL.
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString expandEnvStrings(const QString &command)
QString & insert(int i, QChar c)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static QString fromUtf16(const ushort *, int size=-1)
Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.