Scapping a WinForm

S

scottf35

Hi,

I need to be able to scrape a winform and save the contents to a file.
The user can either pass in the handle to the form or scape the chose
the form with focus.

Can someone please direct me to a link that would help or explain how
to do this (just the scapping and windows handle bit)?

Thanks!
 
S

scottf35

Thanks for Responding!

Looking back on my spelling attempt for that question I don't know how
you made hide-nor-hare of it. But you seemed to know exactly what i
meant!

I can find the handle to the form ok, but I can't seem to find an API
to let me copy the contents of it.

I could use sendkeys and send a ctrl+a and ctrl+c but obviously I would
rather stay away from that method if I could.

Any ideas of any API's for copying the contents of a form?

BTW it is going to be HTML after all but the only native methods I know
of in .net for copying HTML is with the URL to the server and not the
handle of the form in the window.

Cheers.
 
H

Herfried K. Wagner [MVP]

I can find the handle to the form ok, but I can't seem to find an API
to let me copy the contents of it.

I could use sendkeys and send a ctrl+a and ctrl+c but obviously I would
rather stay away from that method if I could.

Any ideas of any API's for copying the contents of a form?

Did you miss the link to the sample above?
 
S

scottf35

Thanks for the link but I need to capture all the text in a window not
just what is showing on the screen.

The example app seems to show how to take an image of whats on the
screen as it uses DC and GetWindowRec and creates BitMap's.
 
H

Herfried K. Wagner [MVP]

Thanks for the link but I need to capture all the text in a window not
just what is showing on the screen.

To do that, you'll have to use p/invoke. Relevant functions: 'FindWindow',
'FindWindowEx', 'EnumWindows', 'EnumChildWindows',
'GetWindowText'/'SendMessage' + 'WM_GETTEXT'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top