Solved

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

Posted on 1997-03-23
1
318 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
[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
1 Comment
 
LVL 7

Accepted Solution

by:
faster earned 200 total points
ID: 1334201
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

627 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