Invoking Win32 dll from Perl.

Discussion in 'Perl Misc' started by Sharad K, Jul 9, 2003.

  1. Sharad K

    Sharad K Guest

    Hi all,

    I am trying to invoke a function in kernel32.dll from my perl program which
    looks like this -

    use Win32::API;
    $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
    $PID = $GetPID->Call();

    But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
    contains: E:/Perl/lib E:/Perl/site/lib .
    ) at 1.pl line 2."

    Can anyone please point me the source of the error.

    Thanks in advance,
    Sharad
     
    Sharad K, Jul 9, 2003
    #1
    1. Advertising

  2. Sharad K

    Sharad K Guest

    "Cat" <> wrote in message
    news:...
    > Sharad K wrote:
    > >
    > > Hi all,
    > >
    > > I am trying to invoke a function in kernel32.dll from my perl program

    which
    > > looks like this -
    > >
    > > use Win32::API;
    > > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
    > > $PID = $GetPID->Call();
    > >
    > > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
    > > contains: E:/Perl/lib E:/Perl/site/lib .
    > > ) at 1.pl line 2."
    > >
    > > Can anyone please point me the source of the error.
    > >

    >
    > The message is telling you that perl can't find the Win32::API module.
    >
    > Use ppm or ppm3 to 'install' it.
    >
    > C:\ppm3
    > <blah blah blah>
    >
    > ppm> search Win32::API
    > Searching in Active Repositories
    > 1. Win32-API [0.41] Perl Win32 API Import Facility
    > 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API

    support
    > ppm> install 1


    Thanks for the reply.
    I downloaded the Win32::API perl extension from http://dada.perl.it/#api.
    After installing Win32::API and putting it in the right folders I got this
    error messsage -
    "Can't locate loadable object for module Win32::API in @INC".

    Can you tell me what is the cause of the problem now?

    Thanks again,
    Sharad
     
    Sharad K, Jul 9, 2003
    #2
    1. Advertising

  3. Sharad K

    Cat Guest

    Sharad K wrote:
    >
    > Hi all,
    >
    > I am trying to invoke a function in kernel32.dll from my perl program which
    > looks like this -
    >
    > use Win32::API;
    > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
    > $PID = $GetPID->Call();
    >
    > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
    > contains: E:/Perl/lib E:/Perl/site/lib .
    > ) at 1.pl line 2."
    >
    > Can anyone please point me the source of the error.
    >


    The message is telling you that perl can't find the Win32::API module.

    Use ppm or ppm3 to 'install' it.

    C:\ppm3
    <blah blah blah>

    ppm> search Win32::API
    Searching in Active Repositories
    1. Win32-API [0.41] Perl Win32 API Import Facility
    2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API support
    ppm> install 1
     
    Cat, Jul 9, 2003
    #3
  4. Sharad K

    Cat Guest

    Sharad K wrote:
    >
    > "Cat" <> wrote in message
    > news:...
    > > Sharad K wrote:
    > > >
    > > > Hi all,
    > > >
    > > > I am trying to invoke a function in kernel32.dll from my perl program

    > which
    > > > looks like this -
    > > >
    > > > use Win32::API;
    > > > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
    > > > $PID = $GetPID->Call();
    > > >
    > > > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
    > > > contains: E:/Perl/lib E:/Perl/site/lib .
    > > > ) at 1.pl line 2."
    > > >
    > > > Can anyone please point me the source of the error.
    > > >

    > >
    > > The message is telling you that perl can't find the Win32::API module.
    > >
    > > Use ppm or ppm3 to 'install' it.
    > >
    > > C:\ppm3
    > > <blah blah blah>
    > >
    > > ppm> search Win32::API
    > > Searching in Active Repositories
    > > 1. Win32-API [0.41] Perl Win32 API Import Facility
    > > 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API

    > support
    > > ppm> install 1

    >
    > Thanks for the reply.
    > I downloaded the Win32::API perl extension from http://dada.perl.it/#api.
    > After installing Win32::API and putting it in the right folders I got this
    > error messsage -
    > "Can't locate loadable object for module Win32::API in @INC".
    >
    > Can you tell me what is the cause of the problem now?
    >
    > Thanks again,
    > Sharad


    Check that you have the modules
    Win32::API::Type and
    Win32::API::Struct

    It looks to me that you haven't got all the ::API's installed
     
    Cat, Jul 9, 2003
    #4
  5. Sharad K

    Sharad K Guest

    "Cat" <> wrote in message
    news:...
    > Sharad K wrote:
    > >
    > > "Cat" <> wrote in message
    > > news:...
    > > > Sharad K wrote:
    > > > >
    > > > > Hi all,
    > > > >
    > > > > I am trying to invoke a function in kernel32.dll from my perl

    program
    > > which
    > > > > looks like this -
    > > > >
    > > > > use Win32::API;
    > > > > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '',

    'N');
    > > > > $PID = $GetPID->Call();
    > > > >
    > > > > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
    > > > > contains: E:/Perl/lib E:/Perl/site/lib .
    > > > > ) at 1.pl line 2."
    > > > >
    > > > > Can anyone please point me the source of the error.
    > > > >
    > > >
    > > > The message is telling you that perl can't find the Win32::API module.
    > > >
    > > > Use ppm or ppm3 to 'install' it.
    > > >
    > > > C:\ppm3
    > > > <blah blah blah>
    > > >
    > > > ppm> search Win32::API
    > > > Searching in Active Repositories
    > > > 1. Win32-API [0.41] Perl Win32 API Import Facility
    > > > 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API

    > > support
    > > > ppm> install 1

    > >
    > > Thanks for the reply.
    > > I downloaded the Win32::API perl extension from

    http://dada.perl.it/#api.
    > > After installing Win32::API and putting it in the right folders I got

    this
    > > error messsage -
    > > "Can't locate loadable object for module Win32::API in @INC".
    > >
    > > Can you tell me what is the cause of the problem now?
    > >
    > > Thanks again,
    > > Sharad

    >
    > Check that you have the modules
    > Win32::API::Type and
    > Win32::API::Struct
    >
    > It looks to me that you haven't got all the ::API's installed


    Thanks a lot. I got the problem fixed.
    I owe you a coffee now :).
     
    Sharad K, Jul 9, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    8,997
  2. pcarr01
    Replies:
    3
    Views:
    683
    Gordon Beaton
    Feb 17, 2005
  3. Ezmeralda
    Replies:
    1
    Views:
    847
    mlimber
    Apr 3, 2007
  4. H. Simpson
    Replies:
    4
    Views:
    342
    H. Simpson
    Aug 3, 2004
  5. martin
    Replies:
    1
    Views:
    134
    J├╝rgen Exner
    Apr 17, 2006
Loading...

Share This Page