Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Howto redraw text at any point on screen?

Posted on 2001-06-27
13
Medium Priority
?
346 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
[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
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 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