What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » how to catch the MessengerPlus_DisplayToast in VB.NET or C#?

how to catch the MessengerPlus_DisplayToast in VB.NET or C#?
Author: Message:
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#?
code:
// C++
// Initialisation
HHOOK cwp = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, dllInstance, GetCurrentThreadId());
HHOOK gmp = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, dllInstance, GetCurrentThreadId());
UINT msgID = RegisterWindowMessage(_T("MessengerPlus_DisplayToast"));

// Uninitialisation
UnhookWindowsHookEx(cwp);
UnhookWindowsHookEx(gmp);

// CallWndProc - Used for SendMessage() calls
LRESULT CALLBACK CallWndProc(int code, WPARAM wParam, LPARAM lParam)
{
    if (code >= 0) {
        CWPSTRUCT *msg = (CWPSTRUCT*)lParam;
        if (msg->message == msgID) {
            // Process msg->LPARAM here: MP_TOAST_INFO*
        }
    }
    return CallNextHookEx(cwp, code, wParam, lParam);
}

// GetMsgProc - Used for PostMessage() calls
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
    if (code >= 0 && wparam == PM_REMOVE) {
        MSG *msg = (MSG*)lParam;
        if (msg->message == msgID) {
            // Process msg->LPARAM here: MP_TOAST_INFO*
        }
    }
    return CallNextHookEx(gmp, code, wParam, lParam);
}
cwp, gmp, and msgID will need to be globally accessible as they will be used in multiple functions.
_T() is a C++ macro that is used to ensure all string l=iterals are the correct type. C++ defines two character types: the ANSI char type, and the Unicode wchar_t type. _T() resolves to L in Unicode, and disappears entirely in ANSI.
MP_TOAST_INFO is defined in the Messenger Plus! API.
To get dllInstance, save the hInstance argument to DllMain in a global variable.

Edit: Dammit, why does this board remove tabs?

This post was edited on 06-06-2006 at 12:04 PM by RaceProUK.
[Image: spartaafk.png]
06-06-2006 12:01 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by guojivip on 06-02-2006 at 03:15 AM
RE: how to induce the MessengerPlus_DisplayToast in VB.NET or C# - by J-Thread on 06-02-2006 at 06:07 AM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C# - by guojivip on 06-02-2006 at 07:08 AM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by J-Thread on 06-02-2006 at 11:44 AM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by guojivip on 06-02-2006 at 12:23 PM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by RaceProUK on 06-03-2006 at 09:05 PM
RE: RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by J-Thread on 06-05-2006 at 04:15 PM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by RaceProUK on 06-06-2006 at 12:01 PM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by J-Thread on 06-06-2006 at 03:17 PM
RE: how to catch the MessengerPlus_DisplayToast in VB.NET or C#? - by RaceProUK on 06-07-2006 at 02:16 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On