?
Solved

How to capture "Net Send" messages from Windows Messenger?

Posted on 2004-04-20
4
Medium Priority
?
2,136 Views
Last Modified: 2010-05-18
Just need to capture messages coming to the user on whose system the VB program is running.  I do not need to capture messages on the entire network.

VB.NET example preferred but VB6 is ok.

Thanks for any ideas.
0
Comment
Question by:mistert006
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 1500 total points
ID: 10871649
This is in VB6. Try adding a Listbox and a timer.Set the Timer interval to 1000.


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Const BM_CLICK = &HF5
Const WM_GETTEXTLENGTH = &HE
Private Const WM_GETTEXT = &HD

Private Sub Timer1_Timer()
Dim lWin As Long
Dim Control As Long
Dim text As String
Dim textlen As Long
lWin = FindWindow(vbNullString, "Messenger Service ")
If lWin <> 0 Then
  Control = FindWindowEx(lWin, 0, "Static", vbNullString)
      textlen = SendMessage(Control, WM_GETTEXTLENGTH, vbNull, vbNull)
      textlen = textlen + 1
  text = Space$(textlen)
  Call SendMessage(Control&, WM_GETTEXT, textlen, ByVal text)
 
  Control = FindWindowEx(lWin, 0, "Button", vbNullString)
  SendMessage Control, BM_CLICK, 0, 0
  List1.AddItem text
End If
End Sub
0
 

Author Comment

by:mistert006
ID: 10878129
I tried the program.  It does work, but I would still see the message box flash on the screen.  I would like to intercept the message so the message box from Windows Messenger service is not displayed at all.

Thank you very much.
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 10888826
You could try lowering the timer interval,but I think you might still see the message flash.I've never seen anyone successfully intercept the message box before it appears using VB.I think you would need to create a hook using a DLL written in a language like C to accomplish this.

Good Luck.
0
 

Expert Comment

by:hello_2004
ID: 11691257
I have tried the code.. it works wonderful.. but it doesn't read the other window messages specifically those that have information icon (i.e. i inside a triangle)  in it.

How to read the tetx from such a message box.

Please help I will award points for this......

Regards
Hello_2004
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question