mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-11 16:06:24 +00:00
fixed for x64 support
This commit is contained in:
parent
48a3485cfa
commit
3918f19eb0
@ -63,7 +63,7 @@ using namespace Snarl;
|
||||
// Constructor/Destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
SnarlInterface::SnarlInterface()
|
||||
: m_hwndFrom(NULL), m_nLastMessageId(0)
|
||||
:m_nLastMessageId(0),m_hwndFrom(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
@ -83,7 +83,7 @@ SnarlInterface::~SnarlInterface()
|
||||
/// which will be displayed alongside the message text.
|
||||
/// <returns>Message Id on success or M_RESULT on failure</returns>
|
||||
|
||||
LONG32 SnarlInterface::ShowMessage(LPCSTR szTitle, LPCSTR szText, LONG32 timeout, LPCSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg)
|
||||
intptr_t SnarlInterface::ShowMessage(LPCSTR szTitle, LPCSTR szText, intptr_t timeout, LPCSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ZeroMemory((void*)&ss, sizeof(ss));
|
||||
@ -94,20 +94,20 @@ LONG32 SnarlInterface::ShowMessage(LPCSTR szTitle, LPCSTR szText, LONG32 timeout
|
||||
StringCbCopyA((LPSTR)&ss.Icon, SNARL_STRING_LENGTH, szIconPath);
|
||||
ss.Timeout = timeout;
|
||||
|
||||
ss.LngData2 = reinterpret_cast<LONG32>(hWndReply);
|
||||
ss.Id = static_cast<LONG32>(uReplyMsg);
|
||||
ss.LngData2 = reinterpret_cast<intptr_t>(hWndReply);
|
||||
ss.Id = static_cast<intptr_t>(uReplyMsg);
|
||||
|
||||
m_nLastMessageId = Send(ss);
|
||||
return m_nLastMessageId;
|
||||
}
|
||||
|
||||
LONG32 SnarlInterface::ShowMessage(LPCWSTR szTitle, LPCWSTR szText, LONG32 timeout, LPCWSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg)
|
||||
intptr_t SnarlInterface::ShowMessage(LPCWSTR szTitle, LPCWSTR szText, intptr_t timeout, LPCWSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg)
|
||||
{
|
||||
LPSTR szUTF8Title = WideToUTF8(szTitle);
|
||||
LPSTR szUTF8Text = WideToUTF8(szText);
|
||||
LPSTR szUFT8IconPath = WideToUTF8(szIconPath);
|
||||
|
||||
LONG32 result = ShowMessage(szUTF8Title, szUTF8Text, timeout, szUFT8IconPath, hWndReply, uReplyMsg);
|
||||
intptr_t result = ShowMessage(szUTF8Title, szUTF8Text, timeout, szUFT8IconPath, hWndReply, uReplyMsg);
|
||||
|
||||
delete [] szUTF8Title;
|
||||
delete [] szUTF8Text;
|
||||
@ -126,15 +126,15 @@ LONG32 SnarlInterface::ShowMessage(LPCWSTR szTitle, LPCWSTR szText, LONG32 timeo
|
||||
|
||||
/// <returns>Message Id on success or M_RESULT on failure</returns>
|
||||
|
||||
LONG32 SnarlInterface::ShowMessageEx(LPCSTR szClass, LPCSTR szTitle, LPCSTR szText, LONG32 timeout, LPCSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg, LPCSTR szSoundFile)
|
||||
intptr_t SnarlInterface::ShowMessageEx(LPCSTR szClass, LPCSTR szTitle, LPCSTR szText, intptr_t timeout, LPCSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg, LPCSTR szSoundFile)
|
||||
{
|
||||
SNARLSTRUCTEX ssex;
|
||||
ZeroMemory((void*)&ssex, sizeof(ssex));
|
||||
|
||||
ssex.Cmd = SNARL_EX_SHOW;
|
||||
ssex.Timeout = timeout;
|
||||
ssex.LngData2 = reinterpret_cast<LONG32>(hWndReply);
|
||||
ssex.Id = static_cast<LONG32>(uReplyMsg);
|
||||
ssex.LngData2 = reinterpret_cast<intptr_t>(hWndReply);
|
||||
ssex.Id = static_cast<intptr_t>(uReplyMsg);
|
||||
|
||||
StringCbCopyA((LPSTR)&ssex.Class, SNARL_STRING_LENGTH, szClass);
|
||||
StringCbCopyA((LPSTR)&ssex.Title, SNARL_STRING_LENGTH, szTitle);
|
||||
@ -146,7 +146,7 @@ LONG32 SnarlInterface::ShowMessageEx(LPCSTR szClass, LPCSTR szTitle, LPCSTR szTe
|
||||
return m_nLastMessageId;
|
||||
}
|
||||
|
||||
LONG32 SnarlInterface::ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR szText, LONG32 timeout, LPCWSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg, LPCWSTR szSoundFile)
|
||||
intptr_t SnarlInterface::ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR szText, intptr_t timeout, LPCWSTR szIconPath, HWND hWndReply, WPARAM uReplyMsg, LPCWSTR szSoundFile)
|
||||
{
|
||||
LPSTR szUTF8Class = WideToUTF8(szClass);
|
||||
LPSTR szUTF8Title = WideToUTF8(szTitle);
|
||||
@ -154,7 +154,7 @@ LONG32 SnarlInterface::ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR s
|
||||
LPSTR szUFT8IconPath = WideToUTF8(szIconPath);
|
||||
LPSTR szUFT8SoundFile = WideToUTF8(szSoundFile);
|
||||
|
||||
LONG32 result = ShowMessageEx(szUTF8Class, szUTF8Title, szUTF8Text, timeout, szUFT8IconPath, hWndReply, uReplyMsg, szUFT8SoundFile);
|
||||
intptr_t result = ShowMessageEx(szUTF8Class, szUTF8Title, szUTF8Text, timeout, szUFT8IconPath, hWndReply, uReplyMsg, szUFT8SoundFile);
|
||||
|
||||
delete [] szUTF8Class;
|
||||
delete [] szUTF8Title;
|
||||
@ -173,13 +173,13 @@ LONG32 SnarlInterface::ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR s
|
||||
/// created. This function returns True if the notification was successfully
|
||||
/// hidden or False otherwise (for example, the notification may no longer exist).
|
||||
|
||||
BOOL SnarlInterface::HideMessage(LONG32 Id)
|
||||
BOOL SnarlInterface::HideMessage(intptr_t Id)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_HIDE;
|
||||
ss.Id = Id;
|
||||
|
||||
LONG32 n = Send(ss);
|
||||
intptr_t n = Send(ss);
|
||||
return (n == -1 || n == 1) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -195,14 +195,14 @@ BOOL SnarlInterface::HideMessage()
|
||||
/// False if not. Id is the value returned by snShowMessage() or
|
||||
/// snShowMessageEx() when the notification was initially created.
|
||||
|
||||
BOOL SnarlInterface::IsMessageVisible(LONG32 Id)
|
||||
BOOL SnarlInterface::IsMessageVisible(intptr_t Id)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_IS_VISIBLE;
|
||||
ss.Id = Id;
|
||||
|
||||
// We are getting -1 when true, checking for 1 just in case. We don't want to return true for the other M_RESULT returns
|
||||
LONG32 n = Send(ss);
|
||||
intptr_t n = Send(ss);
|
||||
return (n == -1 || n == 1) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ BOOL SnarlInterface::IsMessageVisible()
|
||||
/// snShowMessage() or snShowMessageEx() when the notification was originally
|
||||
/// created. To change the timeout parameter of a notification, use snSetTimeout()
|
||||
|
||||
M_RESULT SnarlInterface::UpdateMessage(LONG32 id, LPCSTR szTitle, LPCSTR szText, LPCSTR szIconPath)
|
||||
M_RESULT SnarlInterface::UpdateMessage(intptr_t id, LPCSTR szTitle, LPCSTR szText, LPCSTR szIconPath)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ZeroMemory((void*)&ss, sizeof(ss));
|
||||
@ -237,7 +237,7 @@ M_RESULT SnarlInterface::UpdateMessage(LONG32 id, LPCSTR szTitle, LPCSTR szText,
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::UpdateMessage(LONG32 id, LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath)
|
||||
M_RESULT SnarlInterface::UpdateMessage(intptr_t id, LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath)
|
||||
{
|
||||
LPSTR szParam1 = WideToUTF8(szTitle);
|
||||
LPSTR szParam2 = WideToUTF8(szText);
|
||||
@ -269,12 +269,12 @@ M_RESULT SnarlInterface::UpdateMessage(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR
|
||||
/// AppName is the text that's displayed in the Applications list so it should
|
||||
/// be people friendly ("My cool app" rather than "my_cool_app").
|
||||
|
||||
M_RESULT SnarlInterface::RegisterConfig(HWND hWnd, LPCSTR szAppName, LONG32 replyMsg)
|
||||
M_RESULT SnarlInterface::RegisterConfig(HWND hWnd, LPCSTR szAppName, intptr_t replyMsg)
|
||||
{
|
||||
return RegisterConfig2(hWnd, szAppName, replyMsg, "");
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::RegisterConfig(HWND hWnd, LPCWSTR szAppName, LONG32 replyMsg)
|
||||
M_RESULT SnarlInterface::RegisterConfig(HWND hWnd, LPCWSTR szAppName, intptr_t replyMsg)
|
||||
{
|
||||
return RegisterConfig2(hWnd, szAppName, replyMsg, L"");
|
||||
}
|
||||
@ -287,7 +287,7 @@ M_RESULT SnarlInterface::RegisterConfig(HWND hWnd, LPCWSTR szAppName, LONG32 rep
|
||||
/// used to specify a PNG image which will be displayed against the
|
||||
/// application's entry in Snarl's Preferences panel.
|
||||
|
||||
M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCSTR szAppName, LONG32 replyMsg, LPCSTR szIcon)
|
||||
M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCSTR szAppName, intptr_t replyMsg, LPCSTR szIcon)
|
||||
{
|
||||
if (!szAppName || !szIcon)
|
||||
return M_BAD_POINTER;
|
||||
@ -297,7 +297,7 @@ M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCSTR szAppName, LONG32 rep
|
||||
m_hwndFrom = hWnd;
|
||||
|
||||
ss.Cmd = SNARL_REGISTER_CONFIG_WINDOW_2;
|
||||
ss.LngData2 = reinterpret_cast<LONG32>(hWnd);
|
||||
ss.LngData2 = reinterpret_cast<intptr_t>(hWnd);
|
||||
ss.Id = replyMsg;
|
||||
StringCbCopyA((LPSTR)&ss.Title, SNARL_STRING_LENGTH, szAppName);
|
||||
StringCbCopyA((LPSTR)&ss.Icon, SNARL_STRING_LENGTH, szIcon);
|
||||
@ -305,7 +305,7 @@ M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCSTR szAppName, LONG32 rep
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCWSTR szAppName, LONG32 replyMsg, LPCWSTR szIcon)
|
||||
M_RESULT SnarlInterface::RegisterConfig2(HWND hWnd, LPCWSTR szAppName, intptr_t replyMsg, LPCWSTR szIcon)
|
||||
{
|
||||
LPSTR szParam1 = WideToUTF8(szAppName);
|
||||
LPSTR szParam2 = WideToUTF8(szIcon);
|
||||
@ -332,7 +332,7 @@ M_RESULT SnarlInterface::RevokeConfig(HWND hWnd)
|
||||
m_hwndFrom = NULL;
|
||||
|
||||
ss.Cmd = SNARL_REVOKE_CONFIG_WINDOW;
|
||||
ss.LngData2 = reinterpret_cast<LONG32>(hWnd);
|
||||
ss.LngData2 = reinterpret_cast<intptr_t>(hWnd);
|
||||
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
@ -349,7 +349,7 @@ BOOL SnarlInterface::GetVersion(WORD* Major, WORD* Minor)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_GET_VERSION;
|
||||
LONG32 versionInfo = Send(ss);
|
||||
intptr_t versionInfo = Send(ss);
|
||||
if (versionInfo > 0 && versionInfo != M_FAILED && versionInfo != M_TIMED_OUT) {
|
||||
*Major = HIWORD(versionInfo);
|
||||
*Minor = LOWORD(versionInfo);
|
||||
@ -366,7 +366,7 @@ BOOL SnarlInterface::GetVersion(WORD* Major, WORD* Minor)
|
||||
/// represents the system build number and can be used to identify the specific
|
||||
/// version of Snarl running
|
||||
|
||||
LONG32 SnarlInterface::GetVersionEx()
|
||||
intptr_t SnarlInterface::GetVersionEx()
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_GET_VERSION_EX;
|
||||
@ -381,7 +381,7 @@ LONG32 SnarlInterface::GetVersionEx()
|
||||
/// value returned by snShowMessage() or snShowMessageEx() when the notification
|
||||
/// was first created.
|
||||
|
||||
M_RESULT SnarlInterface::SetTimeout(LONG32 Id, LONG32 Timeout)
|
||||
M_RESULT SnarlInterface::SetTimeout(intptr_t Id, intptr_t Timeout)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_SET_TIMEOUT;
|
||||
@ -391,7 +391,7 @@ M_RESULT SnarlInterface::SetTimeout(LONG32 Id, LONG32 Timeout)
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::SetTimeout(LONG32 Timeout)
|
||||
M_RESULT SnarlInterface::SetTimeout(intptr_t Timeout)
|
||||
{
|
||||
return SetTimeout(m_nLastMessageId, Timeout);
|
||||
}
|
||||
@ -432,7 +432,7 @@ M_RESULT SnarlInterface::RegisterAlert(LPCWSTR szAppName, LPCWSTR szClass)
|
||||
/// Windows message. This message is sent by Snarl when it is first starts and
|
||||
/// when it shuts down.
|
||||
|
||||
LONG32 SnarlInterface::GetGlobalMsg()
|
||||
intptr_t SnarlInterface::GetGlobalMsg()
|
||||
{
|
||||
return RegisterWindowMessage(SNARL_GLOBAL_MSG);
|
||||
}
|
||||
@ -522,7 +522,7 @@ void SnarlInterface::SetAsSnarlApp(HWND hWndOwner, SNARL_APP_FLAGS Flags)
|
||||
|
||||
/// Returns the global Snarl Application message (V39)
|
||||
|
||||
LONG32 SnarlInterface::GetAppMsg()
|
||||
intptr_t SnarlInterface::GetAppMsg()
|
||||
{
|
||||
return RegisterWindowMessage(SNARL_APP_MSG);
|
||||
}
|
||||
@ -533,7 +533,7 @@ LONG32 SnarlInterface::GetAppMsg()
|
||||
|
||||
/// Registers an application with Snarl (V39)
|
||||
|
||||
M_RESULT SnarlInterface::RegisterApp(LPCSTR Application, LPCSTR SmallIcon, LPCSTR LargeIcon, HWND hWnd, LONG32 ReplyMsg)
|
||||
M_RESULT SnarlInterface::RegisterApp(LPCSTR Application, LPCSTR SmallIcon, LPCSTR LargeIcon, HWND hWnd, intptr_t ReplyMsg)
|
||||
{
|
||||
m_hwndFrom = hWnd;
|
||||
|
||||
@ -544,14 +544,14 @@ M_RESULT SnarlInterface::RegisterApp(LPCSTR Application, LPCSTR SmallIcon, LPCST
|
||||
StringCbCopyA((LPSTR)&ss.Icon, SNARL_STRING_LENGTH, SmallIcon);
|
||||
StringCbCopyA((LPSTR)&ss.Text, SNARL_STRING_LENGTH, LargeIcon);
|
||||
|
||||
ss.LngData2 = reinterpret_cast<LONG32>(hWnd);
|
||||
ss.LngData2 = reinterpret_cast<intptr_t>(hWnd);
|
||||
ss.Id = ReplyMsg;
|
||||
ss.Timeout = GetCurrentProcessId();
|
||||
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::RegisterApp(LPCWSTR Application, LPCWSTR SmallIcon, LPCWSTR LargeIcon, HWND hWnd, LONG32 ReplyMsg)
|
||||
M_RESULT SnarlInterface::RegisterApp(LPCWSTR Application, LPCWSTR SmallIcon, LPCWSTR LargeIcon, HWND hWnd, intptr_t ReplyMsg)
|
||||
{
|
||||
LPSTR szParam1 = WideToUTF8(Application);
|
||||
LPSTR szParam2 = WideToUTF8(SmallIcon);
|
||||
@ -590,7 +590,7 @@ M_RESULT SnarlInterface::UnregisterApp()
|
||||
/// Displays a Snarl notification using registered class (V39)
|
||||
/// <returns>Message Id on success or M_RESULT on failure</returns>
|
||||
|
||||
LONG32 SnarlInterface::ShowNotification(LPCSTR Class, LPCSTR Title, LPCSTR Text, LONG32 Timeout, LPCSTR Icon, HWND hWndReply, LONG32 uReplyMsg, LPCSTR Sound)
|
||||
intptr_t SnarlInterface::ShowNotification(LPCSTR Class, LPCSTR Title, LPCSTR Text, intptr_t Timeout, LPCSTR Icon, HWND hWndReply, intptr_t uReplyMsg, LPCSTR Sound)
|
||||
{
|
||||
SNARLSTRUCTEX ssex;
|
||||
ssex.Cmd = SNARL_SHOW_NOTIFICATION;
|
||||
@ -600,7 +600,7 @@ LONG32 SnarlInterface::ShowNotification(LPCSTR Class, LPCSTR Title, LPCSTR Text,
|
||||
StringCbCopyExA((LPSTR)&ssex.Icon, SNARL_STRING_LENGTH, Icon, NULL, NULL, STRSAFE_IGNORE_NULLS);
|
||||
|
||||
ssex.Timeout = Timeout;
|
||||
ssex.LngData2 = reinterpret_cast<LONG32>(hWndReply);
|
||||
ssex.LngData2 = reinterpret_cast<intptr_t>(hWndReply);
|
||||
ssex.Id = uReplyMsg;
|
||||
|
||||
StringCbCopyExA((LPSTR)&ssex.Extra, SNARL_STRING_LENGTH, Sound, NULL, NULL, STRSAFE_IGNORE_NULLS);
|
||||
@ -612,7 +612,7 @@ LONG32 SnarlInterface::ShowNotification(LPCSTR Class, LPCSTR Title, LPCSTR Text,
|
||||
return m_nLastMessageId;
|
||||
}
|
||||
|
||||
LONG32 SnarlInterface::ShowNotification(LPCWSTR Class, LPCWSTR Title, LPCWSTR Text, LONG32 Timeout, LPCWSTR Icon, HWND hWndReply, LONG32 uReplyMsg, LPCWSTR Sound)
|
||||
intptr_t SnarlInterface::ShowNotification(LPCWSTR Class, LPCWSTR Title, LPCWSTR Text, intptr_t Timeout, LPCWSTR Icon, HWND hWndReply, intptr_t uReplyMsg, LPCWSTR Sound)
|
||||
{
|
||||
LPSTR szParam1 = WideToUTF8(Class);
|
||||
LPSTR szParam2 = WideToUTF8(Title);
|
||||
@ -620,7 +620,7 @@ LONG32 SnarlInterface::ShowNotification(LPCWSTR Class, LPCWSTR Title, LPCWSTR Te
|
||||
LPSTR szParam4 = WideToUTF8(Icon);
|
||||
LPSTR szParam5 = WideToUTF8(Sound);
|
||||
|
||||
LONG32 result = ShowNotification(szParam1, szParam2, szParam3, Timeout, szParam4, hWndReply, uReplyMsg, szParam5);
|
||||
intptr_t result = ShowNotification(szParam1, szParam2, szParam3, Timeout, szParam4, hWndReply, uReplyMsg, szParam5);
|
||||
|
||||
delete [] szParam1;
|
||||
delete [] szParam2;
|
||||
@ -637,7 +637,7 @@ LONG32 SnarlInterface::ShowNotification(LPCWSTR Class, LPCWSTR Title, LPCWSTR Te
|
||||
|
||||
/// (V39)
|
||||
|
||||
M_RESULT SnarlInterface::ChangeAttribute(LONG32 Id, SNARL_ATTRIBUTES Attr, LPCSTR Value)
|
||||
M_RESULT SnarlInterface::ChangeAttribute(intptr_t Id, SNARL_ATTRIBUTES Attr, LPCSTR Value)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_CHANGE_ATTR;
|
||||
@ -649,7 +649,7 @@ M_RESULT SnarlInterface::ChangeAttribute(LONG32 Id, SNARL_ATTRIBUTES Attr, LPCST
|
||||
return static_cast<M_RESULT>(Send(ss));
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::ChangeAttribute(LONG32 Id, SNARL_ATTRIBUTES Attr, LPCWSTR Value)
|
||||
M_RESULT SnarlInterface::ChangeAttribute(intptr_t Id, SNARL_ATTRIBUTES Attr, LPCWSTR Value)
|
||||
{
|
||||
LPSTR szParam1 = WideToUTF8(Value);
|
||||
|
||||
@ -709,7 +709,7 @@ M_RESULT SnarlInterface::SetClassDefault(LPCWSTR Class, SNARL_ATTRIBUTES Attr, L
|
||||
/// Gets the current Snarl revision (build) number (V39)
|
||||
/// Returns the build version number, or M_RESULT on failure.
|
||||
|
||||
LONG32 SnarlInterface::GetRevision()
|
||||
intptr_t SnarlInterface::GetRevision()
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_GET_REVISION;
|
||||
@ -724,7 +724,7 @@ LONG32 SnarlInterface::GetRevision()
|
||||
|
||||
/// (V39)
|
||||
|
||||
M_RESULT SnarlInterface::AddClass(LPCSTR Class, LPCSTR Description, SNARL_CLASS_FLAGS Flags, LPCSTR DefaultTitle, LPCSTR DefaultIcon, LONG32 DefaultTimeout)
|
||||
M_RESULT SnarlInterface::AddClass(LPCSTR Class, LPCSTR Description, SNARL_CLASS_FLAGS Flags, LPCSTR DefaultTitle, LPCSTR DefaultIcon, intptr_t DefaultTimeout)
|
||||
{
|
||||
SNARLSTRUCT ss;
|
||||
ss.Cmd = SNARL_ADD_CLASS;
|
||||
@ -734,7 +734,7 @@ M_RESULT SnarlInterface::AddClass(LPCSTR Class, LPCSTR Description, SNARL_CLASS_
|
||||
StringCbCopyExA((LPSTR)&ss.Text, SNARL_STRING_LENGTH, Class, NULL, NULL, STRSAFE_IGNORE_NULLS);
|
||||
StringCbCopyExA((LPSTR)&ss.Title, SNARL_STRING_LENGTH, Description, NULL, NULL, STRSAFE_IGNORE_NULLS);
|
||||
|
||||
LONG32 result = Send(ss);
|
||||
intptr_t result = Send(ss);
|
||||
|
||||
if (static_cast<M_RESULT>(result) == M_OK)
|
||||
{
|
||||
@ -752,7 +752,7 @@ M_RESULT SnarlInterface::AddClass(LPCSTR Class, LPCSTR Description, SNARL_CLASS_
|
||||
return M_FAILED;
|
||||
}
|
||||
|
||||
M_RESULT SnarlInterface::AddClass(LPCWSTR Class, LPCWSTR Description, SNARL_CLASS_FLAGS Flags, LPCWSTR DefaultTitle, LPCWSTR DefaultIcon, LONG32 DefaultTimeout)
|
||||
M_RESULT SnarlInterface::AddClass(LPCWSTR Class, LPCWSTR Description, SNARL_CLASS_FLAGS Flags, LPCWSTR DefaultTitle, LPCWSTR DefaultIcon, intptr_t DefaultTimeout)
|
||||
{
|
||||
LPCSTR szClass = WideToUTF8(Class);
|
||||
LPCSTR szDescription = WideToUTF8(Description);
|
||||
@ -774,7 +774,7 @@ M_RESULT SnarlInterface::AddClass(LPCWSTR Class, LPCWSTR Description, SNARL_CLAS
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
template <class T>
|
||||
LONG32 SnarlInterface::Send(T ss)
|
||||
intptr_t SnarlInterface::Send(T ss)
|
||||
{
|
||||
DWORD_PTR nReturn = M_FAILED;
|
||||
|
||||
@ -793,7 +793,7 @@ LONG32 SnarlInterface::Send(T ss)
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<LONG32>(nReturn);
|
||||
return static_cast<intptr_t>(nReturn);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -14,25 +14,25 @@ namespace Snarl {
|
||||
static const int SNARL_STRING_LENGTH = 1024;
|
||||
static const int SNARL_UNICODE_LENGTH = SNARL_STRING_LENGTH / 2;
|
||||
|
||||
static const LONG32 SNARL_LAUNCHED = 1; // Snarl has just started running
|
||||
static const LONG32 SNARL_QUIT = 2; // Snarl is about to stop running
|
||||
static const LONG32 SNARL_ASK_APPLET_VER = 3; // (R1.5) Reserved for future use
|
||||
static const LONG32 SNARL_SHOW_APP_UI = 4; // (R1.6) Application should show its UI
|
||||
static const intptr_t SNARL_LAUNCHED = 1; // Snarl has just started running
|
||||
static const intptr_t SNARL_QUIT = 2; // Snarl is about to stop running
|
||||
static const intptr_t SNARL_ASK_APPLET_VER = 3; // (R1.5) Reserved for future use
|
||||
static const intptr_t SNARL_SHOW_APP_UI = 4; // (R1.6) Application should show its UI
|
||||
|
||||
static const LONG32 SNARL_NOTIFICATION_CLICKED = 32; // notification was right-clicked by user
|
||||
static const LONG32 SNARL_NOTIFICATION_TIMED_OUT = 33;
|
||||
static const LONG32 SNARL_NOTIFICATION_ACK = 34; // notification was left-clicked by user
|
||||
static const LONG32 SNARL_NOTIFICATION_MENU = 35; // V39 - menu item selected
|
||||
static const LONG32 SNARL_NOTIFICATION_MIDDLE_BUTTON = 36; // V39 - notification middle-clicked by user
|
||||
static const LONG32 SNARL_NOTIFICATION_CLOSED = 37; // V39 - user clicked the close gadget
|
||||
static const intptr_t SNARL_NOTIFICATION_CLICKED = 32; // notification was right-clicked by user
|
||||
static const intptr_t SNARL_NOTIFICATION_TIMED_OUT = 33;
|
||||
static const intptr_t SNARL_NOTIFICATION_ACK = 34; // notification was left-clicked by user
|
||||
static const intptr_t SNARL_NOTIFICATION_MENU = 35; // V39 - menu item selected
|
||||
static const intptr_t SNARL_NOTIFICATION_MIDDLE_BUTTON = 36; // V39 - notification middle-clicked by user
|
||||
static const intptr_t SNARL_NOTIFICATION_CLOSED = 37; // V39 - user clicked the close gadget
|
||||
|
||||
static const LONG32 SNARL_NOTIFICATION_CANCELLED = SNARL_NOTIFICATION_CLICKED; // Added in R1.6
|
||||
static const intptr_t SNARL_NOTIFICATION_CANCELLED = SNARL_NOTIFICATION_CLICKED; // Added in R1.6
|
||||
|
||||
static const DWORD WM_SNARLTEST = WM_USER + 237; // note hardcoded WM_USER value!
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
typedef enum M_RESULT {
|
||||
enum M_RESULT {
|
||||
M_ABORTED = 0x80000007,
|
||||
M_ACCESS_DENIED = 0x80000009,
|
||||
M_ALREADY_EXISTS = 0x8000000C,
|
||||
@ -78,13 +78,13 @@ namespace Snarl {
|
||||
|
||||
static const SNARL_COMMANDS SNARL_GET_REVISION = SNARL_REVOKE_ALERT;
|
||||
|
||||
typedef enum SNARL_APP_FLAGS {
|
||||
enum SNARL_APP_FLAGS {
|
||||
SNARL_APP_HAS_PREFS = 1,
|
||||
SNARL_APP_HAS_ABOUT = 2
|
||||
};
|
||||
|
||||
static const LONG32 SNARL_APP_PREFS = 1;
|
||||
static const LONG32 SNARL_APP_ABOUT = 2;
|
||||
static const intptr_t SNARL_APP_PREFS = 1;
|
||||
static const intptr_t SNARL_APP_ABOUT = 2;
|
||||
|
||||
|
||||
/* --------------- V39 additions --------------- */
|
||||
@ -98,7 +98,7 @@ namespace Snarl {
|
||||
};
|
||||
|
||||
/* Class attributes */
|
||||
typedef enum SNARL_ATTRIBUTES {
|
||||
enum SNARL_ATTRIBUTES {
|
||||
SNARL_ATTRIBUTE_TITLE = 1,
|
||||
SNARL_ATTRIBUTE_TEXT,
|
||||
SNARL_ATTRIBUTE_ICON,
|
||||
@ -112,9 +112,9 @@ namespace Snarl {
|
||||
|
||||
struct SNARLSTRUCT {
|
||||
SNARL_COMMANDS Cmd;
|
||||
LONG32 Id;
|
||||
LONG32 Timeout;
|
||||
LONG32 LngData2;
|
||||
intptr_t Id;
|
||||
intptr_t Timeout;
|
||||
intptr_t LngData2;
|
||||
char Title[SNARL_STRING_LENGTH];
|
||||
char Text[SNARL_STRING_LENGTH];
|
||||
char Icon[SNARL_STRING_LENGTH];
|
||||
@ -122,9 +122,9 @@ namespace Snarl {
|
||||
|
||||
struct SNARLSTRUCTEX {
|
||||
SNARL_COMMANDS Cmd;
|
||||
LONG32 Id;
|
||||
LONG32 Timeout;
|
||||
LONG32 LngData2;
|
||||
intptr_t Id;
|
||||
intptr_t Timeout;
|
||||
intptr_t LngData2;
|
||||
char Title[SNARL_STRING_LENGTH];
|
||||
char Text[SNARL_STRING_LENGTH];
|
||||
char Icon[SNARL_STRING_LENGTH];
|
||||
@ -132,8 +132,8 @@ namespace Snarl {
|
||||
char Class[SNARL_STRING_LENGTH];
|
||||
char Extra[SNARL_STRING_LENGTH];
|
||||
char Extra2[SNARL_STRING_LENGTH];
|
||||
LONG32 Reserved1;
|
||||
LONG32 Reserved2;
|
||||
intptr_t Reserved1;
|
||||
intptr_t Reserved2;
|
||||
};
|
||||
|
||||
|
||||
@ -148,67 +148,67 @@ namespace Snarl {
|
||||
~SnarlInterface();
|
||||
|
||||
static HWND GetSnarlWindow();
|
||||
static LONG32 GetGlobalMsg();
|
||||
static intptr_t GetGlobalMsg();
|
||||
|
||||
|
||||
LPTSTR AllocateString(size_t n) { return new TCHAR[n]; }
|
||||
void FreeString(LPCTSTR str) { delete [] str; str = NULL; }
|
||||
|
||||
|
||||
LONG32 ShowMessage(LPCSTR szTitle, LPCSTR szText, LONG32 timeout = 0, LPCSTR szIconPath = "", HWND hWndReply = NULL, WPARAM uReplyMsg = 0);
|
||||
LONG32 ShowMessage(LPCWSTR szTitle, LPCWSTR szText, LONG32 timeout = 0, LPCWSTR szIconPath = L"", HWND hWndReply = NULL, WPARAM uReplyMsg = 0);
|
||||
LONG32 ShowMessageEx(LPCSTR szClass, LPCSTR szTitle, LPCSTR szText, LONG32 timeout = 0, LPCSTR szIconPath = "", HWND hWndReply = NULL, WPARAM uReplyMsg = 0, LPCSTR szSoundFile = "");
|
||||
LONG32 ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR szText, LONG32 timeout = 0, LPCWSTR szIconPath = L"", HWND hWndReply = NULL, WPARAM uReplyMsg = 0, LPCWSTR szSoundFile = L"");
|
||||
intptr_t ShowMessage(LPCSTR szTitle, LPCSTR szText, intptr_t timeout = 0, LPCSTR szIconPath = "", HWND hWndReply = NULL, WPARAM uReplyMsg = 0);
|
||||
intptr_t ShowMessage(LPCWSTR szTitle, LPCWSTR szText, intptr_t timeout = 0, LPCWSTR szIconPath = L"", HWND hWndReply = NULL, WPARAM uReplyMsg = 0);
|
||||
intptr_t ShowMessageEx(LPCSTR szClass, LPCSTR szTitle, LPCSTR szText, intptr_t timeout = 0, LPCSTR szIconPath = "", HWND hWndReply = NULL, WPARAM uReplyMsg = 0, LPCSTR szSoundFile = "");
|
||||
intptr_t ShowMessageEx(LPCWSTR szClass, LPCWSTR szTitle, LPCWSTR szText, intptr_t timeout = 0, LPCWSTR szIconPath = L"", HWND hWndReply = NULL, WPARAM uReplyMsg = 0, LPCWSTR szSoundFile = L"");
|
||||
|
||||
LPCTSTR GetAppPath(); // ** Remember to FreeString when finished with the string !
|
||||
LPCTSTR GetIconsPath(); // ** Remember to FreeString when finished with the string !
|
||||
|
||||
BOOL GetVersion(WORD* Major, WORD* Minor);
|
||||
LONG32 GetVersionEx();
|
||||
intptr_t GetVersionEx();
|
||||
BOOL HideMessage();
|
||||
BOOL HideMessage(LONG32 Id);
|
||||
BOOL HideMessage(intptr_t Id);
|
||||
BOOL IsMessageVisible();
|
||||
BOOL IsMessageVisible(LONG32 Id);
|
||||
BOOL IsMessageVisible(intptr_t Id);
|
||||
M_RESULT RegisterAlert(LPCSTR szAppName, LPCSTR szClass);
|
||||
M_RESULT RegisterAlert(LPCWSTR szAppName, LPCWSTR szClass);
|
||||
M_RESULT RegisterConfig(HWND hWnd, LPCSTR szAppName, LONG32 replyMsg);
|
||||
M_RESULT RegisterConfig(HWND hWnd, LPCWSTR szAppName, LONG32 replyMsg);
|
||||
M_RESULT RegisterConfig2(HWND hWnd, LPCSTR szAppName, LONG32 replyMsg, LPCSTR szIcon);
|
||||
M_RESULT RegisterConfig2(HWND hWnd, LPCWSTR szAppName, LONG32 replyMsg, LPCWSTR szIcon);
|
||||
M_RESULT RegisterConfig(HWND hWnd, LPCSTR szAppName, intptr_t replyMsg);
|
||||
M_RESULT RegisterConfig(HWND hWnd, LPCWSTR szAppName, intptr_t replyMsg);
|
||||
M_RESULT RegisterConfig2(HWND hWnd, LPCSTR szAppName, intptr_t replyMsg, LPCSTR szIcon);
|
||||
M_RESULT RegisterConfig2(HWND hWnd, LPCWSTR szAppName, intptr_t replyMsg, LPCWSTR szIcon);
|
||||
M_RESULT RevokeConfig(HWND hWnd);
|
||||
M_RESULT SetTimeout(LONG32 Timeout);
|
||||
M_RESULT SetTimeout(LONG32 Id, LONG32 Timeout);
|
||||
M_RESULT SetTimeout(intptr_t Timeout);
|
||||
M_RESULT SetTimeout(intptr_t Id, intptr_t Timeout);
|
||||
M_RESULT UpdateMessage(LPCSTR szTitle, LPCSTR szText, LPCSTR szIconPath = "");
|
||||
M_RESULT UpdateMessage(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath = L"");
|
||||
M_RESULT UpdateMessage(LONG32 Id, LPCSTR szTitle, LPCSTR szText, LPCSTR szIconPath = "");
|
||||
M_RESULT UpdateMessage(LONG32 Id, LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath = L"");
|
||||
M_RESULT UpdateMessage(intptr_t Id, LPCSTR szTitle, LPCSTR szText, LPCSTR szIconPath = "");
|
||||
M_RESULT UpdateMessage(intptr_t Id, LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath = L"");
|
||||
|
||||
/* V39 */
|
||||
M_RESULT AddClass(LPCSTR Class, LPCSTR Description = NULL, SNARL_CLASS_FLAGS Flags = SNARL_CLASS_ENABLED, LPCSTR DefaultTitle = NULL, LPCSTR DefaultIcon = NULL, LONG32 DefaultTimeout = 0);
|
||||
M_RESULT AddClass(LPCWSTR Class, LPCWSTR Description = NULL, SNARL_CLASS_FLAGS Flags = SNARL_CLASS_ENABLED, LPCWSTR DefaultTitle = NULL, LPCWSTR DefaultIcon = NULL, LONG32 DefaultTimeout = 0);
|
||||
M_RESULT AddClass(LPCSTR Class, LPCSTR Description = NULL, SNARL_CLASS_FLAGS Flags = SNARL_CLASS_ENABLED, LPCSTR DefaultTitle = NULL, LPCSTR DefaultIcon = NULL, intptr_t DefaultTimeout = 0);
|
||||
M_RESULT AddClass(LPCWSTR Class, LPCWSTR Description = NULL, SNARL_CLASS_FLAGS Flags = SNARL_CLASS_ENABLED, LPCWSTR DefaultTitle = NULL, LPCWSTR DefaultIcon = NULL, intptr_t DefaultTimeout = 0);
|
||||
M_RESULT ChangeAttribute(SNARL_ATTRIBUTES Attr, LPCSTR Value);
|
||||
M_RESULT ChangeAttribute(SNARL_ATTRIBUTES Attr, LPCWSTR Value);
|
||||
M_RESULT ChangeAttribute(LONG32 Id, SNARL_ATTRIBUTES Attr, LPCSTR Value);
|
||||
M_RESULT ChangeAttribute(LONG32 Id, SNARL_ATTRIBUTES Attr, LPCWSTR Value);
|
||||
LONG32 GetAppMsg();
|
||||
LONG32 GetRevision();
|
||||
M_RESULT ChangeAttribute(intptr_t Id, SNARL_ATTRIBUTES Attr, LPCSTR Value);
|
||||
M_RESULT ChangeAttribute(intptr_t Id, SNARL_ATTRIBUTES Attr, LPCWSTR Value);
|
||||
intptr_t GetAppMsg();
|
||||
intptr_t GetRevision();
|
||||
|
||||
M_RESULT RegisterApp(LPCSTR Application, LPCSTR SmallIcon, LPCSTR LargeIcon, HWND hWnd = 0, LONG32 ReplyMsg = 0);
|
||||
M_RESULT RegisterApp(LPCWSTR Application, LPCWSTR SmallIcon, LPCWSTR LargeIcon, HWND hWnd = 0, LONG32 ReplyMsg = 0);
|
||||
M_RESULT RegisterApp(LPCSTR Application, LPCSTR SmallIcon, LPCSTR LargeIcon, HWND hWnd = 0, intptr_t ReplyMsg = 0);
|
||||
M_RESULT RegisterApp(LPCWSTR Application, LPCWSTR SmallIcon, LPCWSTR LargeIcon, HWND hWnd = 0, intptr_t ReplyMsg = 0);
|
||||
void SetAsSnarlApp(HWND hWndOwner, SNARL_APP_FLAGS Flags = (SNARL_APP_FLAGS)(SNARL_APP_HAS_ABOUT | SNARL_APP_HAS_PREFS));
|
||||
M_RESULT SetClassDefault(LPCSTR Class, SNARL_ATTRIBUTES Attr, LPCSTR Value);
|
||||
M_RESULT SetClassDefault(LPCWSTR Class, SNARL_ATTRIBUTES Attr, LPCWSTR Value);
|
||||
LONG32 ShowNotification(LPCSTR Class, LPCSTR Title = NULL, LPCSTR Text = NULL, LONG32 Timeout = 0, LPCSTR Icon = NULL, HWND hWndReply = NULL, LONG32 uReplyMsg = 0, LPCSTR Sound = NULL);
|
||||
LONG32 ShowNotification(LPCWSTR Class, LPCWSTR Title = NULL, LPCWSTR Text = NULL, LONG32 Timeout = 0, LPCWSTR Icon = NULL, HWND hWndReply = NULL, LONG32 uReplyMsg = 0, LPCWSTR Sound = NULL);
|
||||
intptr_t ShowNotification(LPCSTR Class, LPCSTR Title = NULL, LPCSTR Text = NULL, intptr_t Timeout = 0, LPCSTR Icon = NULL, HWND hWndReply = NULL, intptr_t uReplyMsg = 0, LPCSTR Sound = NULL);
|
||||
intptr_t ShowNotification(LPCWSTR Class, LPCWSTR Title = NULL, LPCWSTR Text = NULL, intptr_t Timeout = 0, LPCWSTR Icon = NULL, HWND hWndReply = NULL, intptr_t uReplyMsg = 0, LPCWSTR Sound = NULL);
|
||||
M_RESULT UnregisterApp();
|
||||
|
||||
LONG32 GetLastMessageId() { return m_nLastMessageId; }
|
||||
intptr_t GetLastMessageId() { return m_nLastMessageId; }
|
||||
|
||||
private:
|
||||
template <class T> LONG32 Send(T ss);
|
||||
template <class T> intptr_t Send(T ss);
|
||||
LPSTR WideToUTF8(LPCWSTR szWideStr);
|
||||
|
||||
LONG32 m_nLastMessageId;
|
||||
intptr_t m_nLastMessageId;
|
||||
HWND m_hwndFrom; // set during snRegisterConfig() or snRegisterConfig2()
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user