Solved

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

Posted on 1997-03-23
1
316 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 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