vanchai
asked on
Howto redraw text at any point on screen?
i want redraw text output on screen by the word. i can redraw a line of text in window but can't redraw the word in window. please show some source code.
?
ASKER
i can use ddihook for hook ExtTextOut function. i can redraw a line of text but i can't force to redraw only one word in a line.
Hello vanchai,
can you post you code here...
cause i tried the api function and it works
procedure TForm1.Button1Click(Sender : TObject);
VAR
R : TRect;
begin
R := Rect ( 50,50,200,100);
ExtTextOut(
self.Canvas.Handle, // handle to device context
50, // x-coordinate of reference point
50, // y-coordinate of reference point
ETO_CLIPPED, // text will be clipped
@R, // optional clipping and/or opaquing rectangle
pChar('hello'), // points to string
5, // number of characters in string
NIL
);
end;
Best Regards
Cesario
can you post you code here...
cause i tried the api function and it works
procedure TForm1.Button1Click(Sender
VAR
R : TRect;
begin
R := Rect ( 50,50,200,100);
ExtTextOut(
self.Canvas.Handle, // handle to device context
50, // x-coordinate of reference point
50, // y-coordinate of reference point
ETO_CLIPPED, // text will be clipped
@R, // optional clipping and/or opaquing rectangle
pChar('hello'), // points to string
5, // number of characters in string
NIL
);
end;
Best Regards
Cesario
If you know where the word is I should expect that you could try somthing like:
var
dc : HDC;
begin
dc := getDC(getDesktopWindow);
invalidateRect(dc,some_rec t,true);
releaseDC(getDesktopWindow ,dc);
end;
GL
Mike
var
dc : HDC;
begin
dc := getDC(getDesktopWindow);
invalidateRect(dc,some_rec
releaseDC(getDesktopWindow
end;
GL
Mike
the easiest way may be to call upon any wincontrol that have a canvas like a form with the simple line
TWincontrol(Sender).Canvas .
TextOut(Mouse.x, Mouse.y, 'word to Write');
I hope this helps
Manata
TWincontrol(Sender).Canvas
TextOut(Mouse.x, Mouse.y, 'word to Write');
I hope this helps
Manata
ASKER
hello all experts,
:-)
Cesario,
i use Win32 Hooks to hook mouse button, when i click on screen i can retrieve point and some handle window by code.
...
procedure MyRedrawText(Wnd: HWND; P: TPoint);
var
ClientPoint: TPoint;
R: TRect;
begin
ClientPoint:= P;
MapWindowPoints(0, Wnd, ClientPoint, 1);
GetClientRect(Wnd, R);
R.Top:= ClientPoint.y;
R.Bottom:= ClientPoint.y+1;
SetMyDDIHook;
RedrawWindow(Wnd, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_UPDATENOW or RDW_NOCHILDREN);
DeleteMyDDIHook;
end;
.
.
.
GetCursorPos(P);
Wnd:= WindowFromPoint(P);
MyRedrawText(Wnd,P);
...
this code can redraw a line in control window such as notepad, title bar, button ... but in IE i can not redraw. why?
To edey,
'If you know where the word is '. this is very big problem for me. i don't know RECT structure of the word.
see more information about ddihook here.-> https://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=11622218
:-)
Cesario,
i use Win32 Hooks to hook mouse button, when i click on screen i can retrieve point and some handle window by code.
...
procedure MyRedrawText(Wnd: HWND; P: TPoint);
var
ClientPoint: TPoint;
R: TRect;
begin
ClientPoint:= P;
MapWindowPoints(0, Wnd, ClientPoint, 1);
GetClientRect(Wnd, R);
R.Top:= ClientPoint.y;
R.Bottom:= ClientPoint.y+1;
SetMyDDIHook;
RedrawWindow(Wnd, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_UPDATENOW or RDW_NOCHILDREN);
DeleteMyDDIHook;
end;
.
.
.
GetCursorPos(P);
Wnd:= WindowFromPoint(P);
MyRedrawText(Wnd,P);
...
this code can redraw a line in control window such as notepad, title bar, button ... but in IE i can not redraw. why?
To edey,
'If you know where the word is '. this is very big problem for me. i don't know RECT structure of the word.
see more information about ddihook here.-> https://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=11622218
To only redraw the word, can't you add:
R.Left := ClientPoint.x;
R.Right := ClientPoint.x+1;
? Just a thought. But maybe this way only the current CHARACTER is redrawn, don't know...
About IE: Maybe IE caches the current visible screen in a bitmap (some of my own controls do that to boost up the speed, too). In that case, if you invalidate a rect, IE only uses BitBlt to repaint the rect instead of (Ext)TextOutA/W. If that is the case, I have no idea about how to force IE to redraw the text with (Ext)TextOutA/W... :-(
Regards, Madshi.
R.Left := ClientPoint.x;
R.Right := ClientPoint.x+1;
? Just a thought. But maybe this way only the current CHARACTER is redrawn, don't know...
About IE: Maybe IE caches the current visible screen in a bitmap (some of my own controls do that to boost up the speed, too). In that case, if you invalidate a rect, IE only uses BitBlt to repaint the rect instead of (Ext)TextOutA/W. If that is the case, I have no idea about how to force IE to redraw the text with (Ext)TextOutA/W... :-(
Regards, Madshi.
Just out of curiosity, why do you need to repaint just one word? Perhaps if we knew more about -what_ you're trying to accomlish we could give a better solution.
GL
Mike
GL
Mike
ASKER
"R.Left := ClientPoint.x;
R.Right := ClientPoint.x+1;"
Thank you Madshi, i just try but the method not work. its worked in some control.
eday,
I want to know RECT of the word. If i know, i can implement application for disabled or can write program like babylon for people in my country(thai). In text editor, word processing or viewer application, when double-click, one word is selected. How to? I have idia to implement by send WM_LBUTTONDOWN and WM_LBUTTONUP message to application for repaint word but it not work for all case. e.g. hyper-link in IE.
Regard, vanchai.
R.Right := ClientPoint.x+1;"
Thank you Madshi, i just try but the method not work. its worked in some control.
eday,
I want to know RECT of the word. If i know, i can implement application for disabled or can write program like babylon for people in my country(thai). In text editor, word processing or viewer application, when double-click, one word is selected. How to? I have idia to implement by send WM_LBUTTONDOWN and WM_LBUTTONUP message to application for repaint word but it not work for all case. e.g. hyper-link in IE.
Regard, vanchai.
I would be tempted to sugest that you could use IE's DOM to get/set text in the webBrowser - unfortunatly I don't know if it's possible to get a refrence to explorer's document from it's HWND.
GL
Mike
GL
Mike
Please update the expert here who have so willingly stepped in to help you, since much time has passed since your last comments, and Email notifications may not have been generated to the participating experts here due to some problems at that time. If you've been helped, accept the respective question by that expert to grade and close it.
Somewhat off-topic, but important.
************************** **** ALERT********************* ********** *
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0
Thought you'd appreciate knowing this.
":0)
Asta
Somewhat off-topic, but important.
**************************
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0
Thought you'd appreciate knowing this.
":0)
Asta
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
To be PAQ/Refund
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thank you,
Russell
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
To be PAQ/Refund
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thank you,
Russell
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.