Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1997-03-23
1
Medium Priority
?
323 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 600 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Integration Management Part 2

971 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