hung2k
asked on
How to intercept DrawText request upon WM_PAINT message ?
I was told that we can intercept the call to DrawText function of Window DLL so that whenever a window is asked to redraw the text, and calls DrawText to do that, the interceptng function will get called and know the text that may be written on
Does anyone know how to do this ? I need this functionality in my program
Thank you very much for you rhelp
Hi,
I doubt whether it is possible, I will check & come back with updates.
From
MRN Murthy
I doubt whether it is possible, I will check & come back with updates.
From
MRN Murthy
Hi hung2k,
Intercepting calls to a system DLL is difficult and inadvisable. Please describe what you wish to accomplish. Perhaps somebody will be able to come up with some ideas on how to solve your problem without needing to intercept a system API call.
Hi MRNMurthy,
Why do you make all of these "informationless" posts? If you have something to contribute, then please do. But saying "I'll get back soon with some information" (which I've now seen you do several times) contributes nothing.
-- Dan
Intercepting calls to a system DLL is difficult and inadvisable. Please describe what you wish to accomplish. Perhaps somebody will be able to come up with some ideas on how to solve your problem without needing to intercept a system API call.
Hi MRNMurthy,
Why do you make all of these "informationless" posts? If you have something to contribute, then please do. But saying "I'll get back soon with some information" (which I've now seen you do several times) contributes nothing.
-- Dan
ASKER
Well,
What I want to do here is:
- When I press right button on a word in a HTML page in my application, I can get the word text and look for its meaning in my own dictionary
The problem with normal method - select the text and retrieve the selected text out - doesnot work here since the word user selects may be part of the link, which HTML View prevent us to select or retrieve part of the word
I intend to intercept DrawText to see what would be redrawn in the adjacent part of the cursor where user clicks right button and hope to get the text
Is there any other way to do that ?
What I want to do here is:
- When I press right button on a word in a HTML page in my application, I can get the word text and look for its meaning in my own dictionary
The problem with normal method - select the text and retrieve the selected text out - doesnot work here since the word user selects may be part of the link, which HTML View prevent us to select or retrieve part of the word
I intend to intercept DrawText to see what would be redrawn in the adjacent part of the cursor where user clicks right button and hope to get the text
Is there any other way to do that ?
Jus to see if I understand:
So have a CHtmlView in which you are already handling right clicks of the mouse (How? There are several methods and the way that you have implemented this part helps to frame the question).
When the user right-clicks, you currently select the clicked word (How? By simulating a double-click of the left mouse button??), copy it to the clipboard, then examine the clipboard. Now you look up the word and pop up a definition for it.
Is that correct?
But the problem is that is the user right-clicks on a multiple-word hyperlink, the action that you currently take (see the second "How?", above) result in you ending up with several words so you don't know which one to look up.
Is that correct?
Depending upon your response to the above "How?" questions, I can think of several ways to solve your problem.
-- Dan
So have a CHtmlView in which you are already handling right clicks of the mouse (How? There are several methods and the way that you have implemented this part helps to frame the question).
When the user right-clicks, you currently select the clicked word (How? By simulating a double-click of the left mouse button??), copy it to the clipboard, then examine the clipboard. Now you look up the word and pop up a definition for it.
Is that correct?
But the problem is that is the user right-clicks on a multiple-word hyperlink, the action that you currently take (see the second "How?", above) result in you ending up with several words so you don't know which one to look up.
Is that correct?
Depending upon your response to the above "How?" questions, I can think of several ways to solve your problem.
-- Dan
ASKER
Dan,
For the moment, in CHtmlView, user can highlight a text within the HTML page if this is not a link. I believe that in such case I can get the selection text whenever user right click the mouse, popup the dialog, lookup the selection text in dictionary and give out explanation. So the first of your questions above seems to be Yes. (but user need to highlight the text before right click)
This technique, I have not implemented yet, seemed unable to be used if the word is part of a multiple-word hyperlink: user can not highlight a word in such case. And I cannot get a whole link's text to lookup. So the second answer is also Yes
For the moment, in CHtmlView, user can highlight a text within the HTML page if this is not a link. I believe that in such case I can get the selection text whenever user right click the mouse, popup the dialog, lookup the selection text in dictionary and give out explanation. So the first of your questions above seems to be Yes. (but user need to highlight the text before right click)
This technique, I have not implemented yet, seemed unable to be used if the word is part of a multiple-word hyperlink: user can not highlight a word in such case. And I cannot get a whole link's text to lookup. So the second answer is also Yes
It sounds like you are in the exploratory phase -- you have not actually implemented any part of this. Is that correct?
I'm certain that the presence of hyperlinks -- and the way IE tends to highlight a link as as a single unit -- is not a showstopper. For one thing, it *is* possible to highlight a portion of a hyperlink (but you have to kinda sneak up on it from above or below). For another, it should be possible to use the location of the mouse pointer to zero in on a particular single word, regardless of whether it is in a link or otherwise.
So, go ahead an implement whatever part of the project you can, and I'll provide additional help when you get to the point where you actually need it.
-- Dan
I'm certain that the presence of hyperlinks -- and the way IE tends to highlight a link as as a single unit -- is not a showstopper. For one thing, it *is* possible to highlight a portion of a hyperlink (but you have to kinda sneak up on it from above or below). For another, it should be possible to use the location of the mouse pointer to zero in on a particular single word, regardless of whether it is in a link or otherwise.
So, go ahead an implement whatever part of the project you can, and I'll provide additional help when you get to the point where you actually need it.
-- Dan
hi hung2k,
Do you have any additional questions? Do any comments need clarification?
-- Dan
Do you have any additional questions? Do any comments need clarification?
-- Dan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dan,
Well,
I've done some code to read HTML file into my own browser
Now I want to capture the places where I press right button on the loaded page, to get the text of element of the page there
It seemed to me that something like IMarker may do this
But I'm not sure about the usage of this interface
Any advice is appreciated
Hung
Well,
I've done some code to read HTML file into my own browser
Now I want to capture the places where I press right button on the loaded page, to get the text of element of the page there
It seemed to me that something like IMarker may do this
But I'm not sure about the usage of this interface
Any advice is appreciated
Hung
ASKER
Dear all,
One more time, the solution for the subject question is not here. What I want is to get the right click on HtmlView page and get the word near to the mouse point
to start some special treatment.
But this seemed tricky and Dan had suggested me to implement a real app to investigate another way round
I had use CHtmlView and find out way to work with my own ShowContextMenu to process the right mouse click event
And this question must be closed without its correct reply
I still grant the points to Dan anyway, since he led me to another viewpoint
Thank you for it Dan
One more time, the solution for the subject question is not here. What I want is to get the right click on HtmlView page and get the word near to the mouse point
to start some special treatment.
But this seemed tricky and Dan had suggested me to implement a real app to investigate another way round
I had use CHtmlView and find out way to work with my own ShowContextMenu to process the right mouse click event
And this question must be closed without its correct reply
I still grant the points to Dan anyway, since he led me to another viewpoint
Thank you for it Dan
It's very hard to intercept calls system-wide in user mode.