in reply to Anyone use Win32::API?

You might want to try the new Inline.pm. From reading the recent announcement for it in comp.lang.perl.announce, the author(s) really knew what they were doing. One thing it will give you is that you won't have to know which DLL a routine is in.

It provides what is probably the simplest possible interface for accessing C routines from Perl. You can use it in a script (in which case the script won't be able to run on a machine that doesn't have a C compiler and have Perl configure so that MakeMaker knows how to use it). Or you can use it to write modules. You can probably make a PPM for such a module (nearly?) the same way you would for any other module.

You can also look into the modules FFI and C::Dynalib, both of which appear to have a better design than Win32::API (as well as being portable to other platforms -- though that doesn't matter here) -- though I've never used either. I've used Win32::API enough to be frustrated with the design and the gotchas involved in getting it installed. But it is certainly powerful and I've used it successfully (before I'd heard of FFI and C::Dynalib). Now days I usually throw together a quick XS module instead of using any of these.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
(Guildenstern) REx2: Anyone use Win32::API?
by Guildenstern (Deacon) on Aug 21, 2000 at 18:30 UTC
    i find it interesting that using PPM supplied with ActiveState's Perl, none of these PM's showed up.
    Inline.pm looks like a good solution if we were rolling out our packages (internal term, not Perl packages) to machines that we knew had C compilers on them. in the Fortune 5000 world, i think this does not have a high probability. :) very interesting, though and i'll have to see if i can put into some development stuff.
    FFI looks to almost be more clunky than Win32::API. look at this chunk of code from the module's examples section:
    $clib_file = ($^O eq "MSWin32") ? "MSVCRT40.DLL" : "-lc"; $clib = DynaLoader::dl_findfile($clib_file); $strlen = DynaLoader::dl_find_symbol($clib, "strlen"); $n = FFI::call($strlen, "cIp", $my_string); DynaLoader::dl_free_file($clib);

    looks like a lot of work IMO.
    C::Dynalib looks good, but it appears that it still requires some knowledge of where the functions you want to call are located.
    it looks like for our use, Win32::API might just be the best option. we will be using several registry calls which are fairly well supported already, and after some design talks it looks like we'll only need to call one method through Win32::API, which shouldn't be too bad. if it were larger scale, Inline.pm looks very good.
    thanks for the excellent info!