Here's the work in progress, I haven't gotten around to printing the input to making sure it is getting what is being typed due to this error but, i'm sure i will mostlikely ask for advice and how one would go about it.
#!/usr/bin/perl -w use strict; use diagnostics; use Win32::API; my ($hook, $hooker, $idHOOK, $lpfn, $hmod, $dwThreadId); $idHOOK = 'WH_KEYBOARD_LL'; $lpfn = " " x 80; $hmod = 0; $dwThreadId = 0; $hook = new Win32::API('user32', 'SetWindowsHookEx', 'LLLL', 'L'); if(not defined $hook) { die "Can't import API SetWindowsHookEx: $!\n" } $hooker = $hook->Call($idHOOK, $lpfn, $hmod, $dwThreadId); #print $hooker;
Here's the error that is spit out.
D:\project>keyhook.pl Can't locate object method "API=HASH(0x15d4ebc)" via package "Win32" a +t D:\project\keyhook.pl line 16, <DATA> line 164 (#1) (F) You said to do (or require, or use) a file that couldn't be found. Perl looks for the file in all the locations mentioned in @ +INC, unless the file name included the full path to the file. Perhaps +you need to set the PERL5LIB or PERL5OPT environment variable to say w +here the extra library is, or maybe the script needs to add the library + name to @INC. Or maybe you just misspelled the name of the file. See perlfunc/require and lib. Uncaught exception from user code: Can't locate object method "API=HASH(0x15d4ebc)" via package " +Win32" at D:\project\keyhook.pl line 16, <DATA> line 164.
I'm not sure of what file th error is talking about i've used both user32 and the win32 module in programs before. Please shed some light on this for me.. thanks. Link to MSDN SetWindowsHookEx http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp

In reply to Win32 Keyboard hook in perl by xdeletex

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.