Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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.  …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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 you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

721 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