Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Suggestions for a new Perl Win32::API User?

by sudoer (Initiate)
on Apr 17, 2000 at 15:24 UTC ( #7809=perlquestion: print w/replies, xml ) Need Help??
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-}
  • Comment on Suggestions for a new Perl Win32::API User?

Replies are listed 'Best First'.
RE: Suggestions for a new Perl Win32::API User?
by buzzcutbuddha (Chaplain) on Apr 17, 2000 at 17:40 UTC

    I found the following link for you at MSDN:
    MSDN API Reference
    This 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.
Re: Suggestions for a new Perl Win32::API User?
by jbert (Priest) on Apr 17, 2000 at 18:38 UTC
    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.

Re: Suggestions for a new Perl Win32::API User?
by paulbort (Hermit) on Apr 17, 2000 at 19:10 UTC
    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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://7809]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2018-06-20 19:59 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.