The MsgDlg is just a window running in the background to accept events such as messages from Shell_NotifyIcon.
It's a window in a utility DLL used to build a framework around API functions, so it isn't really possible to do it that way...
Code:
void AddTrayIcon(const CString& strToolTip, const CString& strBalloonTip, const CString& strBalloonTitle, HICON hIcon, UINT nTimeOut, CTrayCallbacks Callbacks)
{
// ...
traydata.hWnd = MsgDlg.m_hWnd; // hOwner;
// ...
MsgDlg.m_TrayCallbacks = Callbacks;
Shell_NotifyIcon(NIM_ADD, &traydata);
Shell_NotifyIcon(NIM_SETVERSION, &traydata);
}
Code:
CHotKey::CHotKey(int nId, uint32_t sModifier, uint32_t sKey, pp<CCallback> HotkeyCallback): m_nId(nId)
{
if (! ::RegisterHotKey(MsgDlg.m_hWnd, m_nId, sModifier, sKey) )
{
TRACE("WARNING! RegisterHotKey failed with:\nError: 0x%X\nDescription: %s", GetLastError(), ErrDescFromHRESULT( GetLastError() ));
DebugBreak();
}
MsgDlg.m_HotkeyCallback = HotkeyCallback;
}
Code:
class AFX_EXT_CLASS CHotKey