有人做过MSN MessagerPlus!的插件么?

guojivip0420 2006-06-02 11:17:49
如何拦截在C#或者VB里面拦截 MessagerPlus!的MessengerPlus_DisplayToast~?谢谢!
...全文
102 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
guojivip0420 2006-06-02
  • 打赏
  • 举报
回复
晕~~话都不会说了~

在C#或者VB里面如何拦截 MessagerPlus!的MessengerPlus_DisplayToast~?谢谢!

也就是当MSN有新的聊天消息到达的时候弹出来的那个popups窗口,如果安装了
MessagerPlus! 系统会自动替换为MessagerPlus!的popups
这个popups的名称叫做MessengerPlus_DisplayToast
触发这个popups的代码如下~我现在想知道怎么感应系统弹出了这个popups

Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (<MarshalAs(UnmanagedType.LPStr)> ByVal lpString As String) As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal nMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer

Private Structure MPL_TOAST_INFO
Dim sTitle As Integer
Dim sMessage As Integer
Dim sProgram As Integer
Dim sSoundFile As Integer
Dim nReserved As Integer
End Structure

Public Function DisplayToast(ByVal sMessage As String, ByVal sTitle As String, ByVal sProgram As String, ByVal bPlaySound As Boolean) As Boolean
If (sMessage.Length() > 255) Then
sMessage = sMessage.Substring(0, 255)
End If

Dim info As MPL_TOAST_INFO
Dim titlePtr As System.Runtime.InteropServices.GCHandle
If (sTitle.Length() < 1) Then
info.sTitle = 0
Else
titlePtr = System.Runtime.InteropServices.GCHandle.Alloc(sTitle, Runtime.InteropServices.GCHandleType.Pinned)
info.sTitle = titlePtr.AddrOfPinnedObject.ToInt32
End If

Dim progPtr As System.Runtime.InteropServices.GCHandle
If (sProgram.Length() < 1) Then
info.sProgram = 0
Else
progPtr = System.Runtime.InteropServices.GCHandle.Alloc(sProgram, Runtime.InteropServices.GCHandleType.Pinned)
info.sProgram = progPtr.AddrOfPinnedObject.ToInt32
End If

Dim msgPtr As System.Runtime.InteropServices.GCHandle
If (sMessage.Length() < 1) Then
info.sMessage = 0
Else
msgPtr = System.Runtime.InteropServices.GCHandle.Alloc(sMessage, Runtime.InteropServices.GCHandleType.Pinned)
info.sMessage = msgPtr.AddrOfPinnedObject.ToInt32
End If

If (bPlaySound) Then
info.sSoundFile = -1
Else
info.sSoundFile = 0
End If

'Get the message identifier
Dim nMsg As Integer
nMsg = RegisterWindowMessage("MessengerPlus_DisplayToast")

Dim infoPtr As System.Runtime.InteropServices.GCHandle
infoPtr = System.Runtime.InteropServices.GCHandle.Alloc(info, Runtime.InteropServices.GCHandleType.Pinned)

'Send the message to Messenger Plus! to display the toast
Dim nResult As Integer
nResult = SendMessage(HWND_BROADCAST, nMsg, infoPtr.AddrOfPinnedObject.ToInt32, 1)

'Free the memory
If (info.sTitle <> 0) Then
titlePtr.Free()
End If
If (info.sProgram <> 0) Then
progPtr.Free()
End If
If (info.sMessage <> 0) Then
msgPtr.Free()
End If
infoPtr.Free()

DisplayToast = True 'There is no absolute way to detect if the function was successful
End Function

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧