• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

How do you trap messages that are sent to a registered window?

I've got a window thats registered with another that sends messages to my window, and I've spied the messages it receives using spyxx, and it says my program's receiving the right messages. Such as:

message: 0x0536 [User-defined:WM_USER+310] wParam:0000023 lParam:0000022

now, how do I get my program to realize its been sent a message? And how do I get the wParam and lParam from it? I've tried using GetMessage and such, and it just halts the program in an endless loop, I probably used it wrong, so ya know, a snippet of code showing how to trap a message wouldn't be a hinderance. =)

Skitchy
0
LordSkitch
Asked:
LordSkitch
  • 4
  • 2
1 Solution
 
bruintjeCommented:
Hello LordSkitch,

just for my own learning i think you need subclasing your form to get a hold of the messages before windows does
http://www.mvps.org/the_nerd/VBSmartMirror/library/smartsubclass/smartsubclass.htm

but as said this is just to be linked in the thread and maybe it helps

HAGD:O)Bruintje
0
 
LordSkitchAuthor Commented:
People have told me that before, but I really don't understand subclassing lol, every time I see it, its to make bloody multi-line tooltips, or add an icon to the system tray, not exactly what im lookin to do... any help on how to trap messages?
0
 
LordSkitchAuthor Commented:
People have told me that before, but I really don't understand subclassing lol, every time I see it, its to make bloody multi-line tooltips, or add an icon to the system tray, not exactly what im lookin to do... any help on how to trap messages?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LordSkitchAuthor Commented:
AH! dont hit the back button after you post. lol it makes duplicates.
0
 
LordSkitchAuthor Commented:
AHA! ok, im just really really stupid.

i just use this one to hook into the queue,
Public Sub HookForm(F As Form)
    PrevProc = SetWindowLong(F.hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub

use this one to unhook,
Public Sub UnHookForm(F As Form)
    SetWindowLong F.hWnd, GWL_WNDPROC, PrevProc
End Sub


then add the things to check for here, and do whatever it is i need to do!

Public Function WindowProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    If uMsg = WM_USER + 303 Then
       
    End If
    WindowProc = CallWindowProc(PrevProc, hWnd, uMsg, wParam, lParam)
End Function
0
 
bruintjeCommented:
:)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now