Re: WM_PAINT question...

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Stoitcho Goutsev \(100\) [C# MVP] (100_at_100.com)
Date: 06/15/04


Date: Tue, 15 Jun 2004 10:58:42 -0400

Hi Kevin,

Yes, ToString exists for bitmap objects as it exisits for all objects
because it is defined in the Object class. You can call it and you will get
a string which contains the name of the class. Something like
"System.Drawing.Bitmap". Thing of it. As the name suggests it is only an
area of pixels, which has some color. There are not strings, rectangles,
lines or whatsoever. There are only pixels. That's why if you want to
extract the text from a picture you have to use some algorithm for image
recognition (OCR). Such algorithms are fairly complex and are definitely
not somethig, which can be implemented "first thing in the morning". With
meta files (as the others suggested) is kind of different. The metafiles are
list of gdi (or gdi+) commands which are executed (played) over some device
context. As such they can be enumerated and all the commands inside can be
regognized and parsed. So with some degree probability TextOut commands can
be catched and the arguments (the text) could be extracted. Again there are
some problems of letting the controls to paint into an arbitrary device
context. It can be done via WM_PRINT and WM_PRINTCLIENT if implemented by
the target control, which usually is not for controls different than the one
provided by micorosoft.

-- 
HTH
Stoitcho Goutsev (100) [C# MVP]
"Kevin Dombroski" <kdombroski@comcast.net> wrote in message
news:jjBzc.57680$Sw.1000@attbi_s51...
> Thanks for the reply... How about this off the wall theory: since the text
> is being painted, can I obtain a bitmap of the client area (it's small, if
> that helps my cause). I'm sure that's doable - now all I need is a
> "ToString()" method for the bitmap object??? I'm sure I'm really reaching.
> Not sure if this method exists for a Bitmap object!?!?!
>
> "John Wood" <spam@isannoying.com> wrote in message
> news:u5TxNOnUEHA.3540@TK2MSFTNGP11.phx.gbl...
> > Not easily.
> > You might be able to forge a WM_PAINT and send that to the applicaiton,
> > providing a device context that you have initiated the recording of
> metadata
> > on, but that's only a theory and probably won't work in practice because
> of
> > calls to BeginPaint etc.
> >
> > Other than using OCR I think you might be out of luck.
> >
> > If you just want to do it occasionally, you could just get the
application
> > to print the stuff, and have it print to a postscript printer (print to
> > file), then you could probably pull the data out of the file.
> >
> > Hope that helps a little.
> > John
> >
> > "Kevin Dombroski" <kevin.dombroski@comcast.net> wrote in message
> > news:tHqzc.31914$2i5.16821@attbi_s52...
> > >
> > > Howdy - I would like my application to be able to read data from
another
> > > application. Specifically, I would like my to get the text from the
> > "client
> > > area" of another application's window whenever it's processing  a
> WM_PAINT
> > > message? Can I do that?  I've been searching around MSDN and Google,
but
> > I'm
> > > not really finding a way to do this. Please let me know if you have an
> > > idea - thanks!
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: Getting bitmap representation of UI controls
    ... > having the actual controls. ... > This happens in the context of a plug-in, the only thing I can return to ... > the hosting application is a bitmap, and I am receiving the events from ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Getting bitmap representation of UI controls
    ... > having the actual controls. ... > This happens in the context of a plug-in, the only thing I can return to ... > the hosting application is a bitmap, and I am receiving the events from ...
    (microsoft.public.win32.programmer.ui)
  • Re: different DPIs and dialog control layout
    ... a HUGE number of parameters OTHER than dpi (display size, display driver behavior, default ... simply removed the fancy bitmap from the background. ... default font larger than the normal linstalled font. ... those maps is do edge detection of areas of the map, and resize the controls to fit into ...
    (microsoft.public.vc.mfc)
  • BitBlt operations overwrite existing bitmap controls in the dialog
    ... I first put a few CStatic bitmap controls in the dialog with ResourceView, ... the memory device context to the current device context. ...
    (microsoft.public.windowsce.embedded.vc)
  • BitBlt operations overwrite existing bitmap controls in the dialog
    ... I first put a few CStatic bitmap controls in the dialog with ResourceView, ... the memory device context to the current device context. ...
    (microsoft.public.win32.programmer.ui)