Solved

Howto redraw text at any point on screen?

Posted on 2001-06-27
13
313 Views
Last Modified: 2010-04-06
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.
0
Comment
Question by:vanchai
13 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6231280
?
0
 

Author Comment

by:vanchai
ID: 6231377
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.
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6231938
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
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 6

Expert Comment

by:edey
ID: 6232421
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_rect,true);
 releaseDC(getDesktopWindow,dc);
end;

GL
Mike
0
 

Expert Comment

by:manata
ID: 6232461
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
0
 

Author Comment

by:vanchai
ID: 6233650
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.-> http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=11622218
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6237036
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.
0
 
LVL 6

Expert Comment

by:edey
ID: 6238165
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
0
 

Author Comment

by:vanchai
ID: 6238484
"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.
0
 
LVL 6

Expert Comment

by:edey
ID: 6238639
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
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6906975
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
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8685509
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
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 8816182
PAQ'ed and points not refunded,

PashaMod
Community Support Moderator @Experts Exchange
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now