From: Peter Duniho on
Cal Who wrote:
> I may try that just for fun.
> Do you think I should try code like we did before managed code came about (I
> still have my Petzold book).

I'm not aware of support in .NET that would specifically allow that.
But then, since I'm not familiar at all with the accessibility stuff,
for all I know that might have .NET support. For sure, the
SendMessage() approach would still require the unmanaged API, but of
course you can use p/invoke to access it from your managed code.

> Do people still code the old windows api

Sure, happens all the time. In the context of .NET, p/invoke is the
more common way to do that, but a C++/CLI wrapper is another possible
approach. For COM stuff, .NET will even handle most of the heavy
lifting for you, via COM interop.

There are still lots of programmers out there who don't do anything at
all with managed code. It's all the old-school unmanaged Win32 API for
them (for a small handful of them, they have no choice�for the rest,
they don't know what they're missing! :) ).

> If not, can you point me to an example - anything - not necessarily related
> to my original post.

I don't have any examples off the top of my head.

> What started this is I did a search for files and wanted to send the result
> list to someone but folders don't allow you to copy the displayed text.

Well, for that specific task, I can think of a number of alternatives
that are FAR superior to trying to scrape text from an Explorer window,
depending on the exact nature of the search:

� Use the DIR command
� Use the FINDSTR command (similar to grep)
� Write your own file search utility that provides a text export feature

The first two are just regular "user with a command prompt" solutions.
Just pipe the output to a file if you want to save the output.

Frankly, even if it comes down to needing the third approach, that's
going to be WAY easier than text scraping. For an experienced C#/.NET
developer who has a specific search criteria already in mind, I'd guess
the basic search logic could be written in 30-60 minutes, with maybe
another 15-30 minutes to get the output to a text file. And that's a
conservative guess; for a relatively simple search, it should take an
experienced programmer less than 30 minutes to do the whole thing.

For an inexperienced C#/.NET programmer, I suppose it could easily be
three or four times that long, or even days for a complete newbie that
has to spend most of their time just researching what APIs are involved
and how to use them.

But either the screen-scraping (done programmatically�obviously using
existing tools is much simpler) or direct-to-window/accessibility
techniques would be MUCH more complicated. For a programmer for whom it
would take days to implement the custom search utility approach, it
could easily take months or a year to accomplish the more complicated
technique. :)

Pete