sudoer has asked for the
wisdom of the Perl Monks concerning the following question:

I've been using Perl for quite some time now and have used
half a dozen languages before it. Of course Perl is by far
the best 8-}
Unfortunately, I have to do some work on Win32 systems,
particularly using the Windows API. I'm at home in Unix
but totally lost when it comes to the Win32::API...
I just read through the Win32::API pod and there just isn't
a whole lot there. I don't understand how you *know* which
API function you are going to use for a particular task.
Is there *any* logic behind how this stuff is divided up?
I only plan on accessing the Windows API from Perl, so what
sources of information would you recommend to really get an
understanding of:
# How/why a particular API function is stored in a given
module (dll)
# How/where to find the parameters that are passed to the
function and returned from the function.
# How do the Microsoft Foundation Classes relate to the
Win32 API and are the MFC's useable/useful from Perl?
Thanks 8-}

I found the following link for you at MSDN:MSDN API ReferenceThis should give you the actually listing of all of the API's and what they
are used for. I hope this is a start. As far as the MFC are concerned, I'm sorry that I can't
provide more guidance, but I am just learning that now for work myself, so I'm a neophyte.

The Win32::API module is a nice bit of technology but can be a bit desperate to use. Its not very perl-like. (e.g. you have to pre-allocate strings before passing into the API)

IMHO, there is a nice chunk of work for people to do in adding Win32 support to standard CPAN modules using the Win32::API stuff.

This would allow:

Most people stay away from the pain which is Win32::API

More scripts written to use 'standard' CPAN modules "just work" on Win32 because the support is in the module

Err...thats it

So if you do something funky with the API, consider how it might be rolled into an existing CPAN module and/or provide the same interface.

Oh...and one thing which might help regarding functions in modules is mentioned in the WIn32::API docs themselves. 'Quick View' on a DLL will show you which functions are exported.

This isn't ideal since you still need to leaf through DLLs (kernel32.dll has most things I need) and also for some reason you can't copy + paste from the Quick View, so you can't get the information out of the tool.

Rant rant. There is a Windows NT tool to extract the information I need. It doesn't let me export this information in a usable format. That sucks.

Another good DLL to look at is ADVAPI32.DLL, especially if you need to fiddle with permissions.
If you want a reference book, there are a couple on using the Win32 API with Visual Basic, which also doesn't like the API stuff much (mostly strings).

Is the way Perl accesses the Win32::API more similar to
the way C, Visual BASIC, or some other language?
Have any of you read books about the Windows API and
have 1 (or more) that stand out as being superior?