Solved

Howto redraw text at any point on screen?

Posted on 2001-06-27
13
300 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
 
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

13 Experts available now in Live!

Get 1:1 Help Now