Solved

Help!! to get text in my Hook : CALLWNDPROC()

Posted on 1997-03-23
1
312 Views
Last Modified: 2013-12-03
Hi,
   In my DLL :

   I use the SetWindowsHookEx(WH_CALLWNDPROC,CallWndProc, ..., 0 ) to Hook the text data in mesage WM_SETTEXT ...

   In the CallWndProc function....  I want to copy out the text data....
   But I just can't get those text.... even I have got the right text data in the CallWndProc funtion by using some DC to output the Text...

   But in otherplace(except the CallWndProc) of the DLL, I just can't get the right text data... why ??
   Is there any constraint in the CALLBACK CallWndProc function ??

   Why can't I get the correct text in other place in my DLL , even APP ??

   Is there any solution ??
   I have tried all the solution of IPC ( eg. send message, copy to global variable, external variable, even file ). I doubt that whether the CallWndProc have set the function( copy data to any memory) off.

   Thank you so much .....
0
Comment
Question by:Meiling
1 Comment
 
LVL 7

Accepted Solution

by:
faster earned 200 total points
Comment Utility
I guess you have an application, which installs the dll, and wants to get some information whenever the WM_SETTEXT happens.  But you have to be aware that if some application, say app1, does trigger such an event, then your hook procedure in the dll will be executed, but in the context of app1, not your app!  So if your app want to check out the value saved by your dll ( I assume that you copy the text in some buffer in the dll), actually it checks another memory and therefore you get nothing.  To solve this, you can try to put the buffer in a shared memory segment, which means that all app who use your dll will use the same memory, then you can retrive from your app the buffer filled by another app.  Please refer to SDK "shared memory" for more information for detail. Basically it wil be something like this:

/* in your dll source file */
#pragma data_seg(".sdata")
char buf[BUFLEN];
#pragma data_seg()

/* in your def file */
SECTIONS
   .sdata   READ WRITE SHARED


Hope this helps.

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now