VB 6.0 - read the values by knowing wparam and lparam

Asked By dotnet developer on 14-Feb-12 12:48 AM
I have a third party application that displays data in a grid and it changes with time. I am trying to build an utility in vb  to capture that data. I used spy to identify the messages. It shows "ArmReReadMessage (Registered messages)" with wparam and lparam values. I am planning to hook this message and read the data before it gets displayed to the grid. Please guide me on how to read the data from wparam and lparam values/pointers. As its a third party application and I am unaware of the structure of the data.
Reena Jain replied to dotnet developer on 14-Feb-12 12:57 AM

wparam and lparam are really pointers to C++ UINT and LONG values respectively. In C# speak, they're pointers to uint and int. In case you're not sure what a WPARAM is, you can simply look it up where it is defined by right clicking in the C++ code and choosing "Go to definition". That takes you to this definition in windef.h.

here is the complete solution for you

Hope this will help you
Somesh Yadav replied to dotnet developer on 14-Feb-12 01:12 AM

Example 3: A message which has complex parameters, and which returns an interesting value:

*                           UWM_SET_COORD
* Inputs:
*       WPARAM: (WPARAM)(BOOL) FALSE for absolute
*                              TRUE for relative
* Result: LRESULT
*	(LRESULT)MAKELONG(x, y) previous coordinate value
* Effect:
*	Sets the coordinate in the view, and returns the previous
*       coordinate.
* Notes:
*	The x,y values are added to the current position if
*	WPARAM is TRUE, otherwise they replace the current 
*	position.
#define UWM_SET_COORD_MSG _T("UWM_SET_COORD-{4E7F6EC2-6ADC-11d3-BC36-006067709674}")

Note that I carefully document the casting that is required to get the desired WPARAM and LPARAM values. Then I know when I'm writing my method how I should cast it. Here's an example of a handler for another message, which takes a pointer to an object. 

*                       CMyView::OnAssignMyInfo
* Inputs:
*       WPARAM: ignored, 0
* Result: LRESULT
*	Logically void, 0, always
* Effect:
*	Modifies the current view by the values in LPMYINFO
* Notes:
*	If LPMYINFO.IsValidCount is FALSE, the count field is
*	not modified
LRESULT CMyView::OnAssignMyInfo(WPARAM, LPARAM lParam)
     LPMYINFO info = (LPMYINFO)lParam;
     visible = info.visible;
        count = info.count;
     return 0; // value is ignored

refer to the below link for more informtion.



Hope it helps you.
dotnet developer replied to Reena Jain on 14-Feb-12 01:14 AM
Can you please point me to a code that reads the data with unknown datastructure using wparam and lparam values using vb?
Asked By dotnet developer on 14-Feb-12 01:20 AM
Hi James,

Can you guide me to use this macro with vb6?