NAME

Win32::API::Interface - Object oriented interface generation

SYNOPSIS

    package MyModule;
	use base qw/Win32::API::Interface/;

	__PACKAGE__->generate( "kernel32", "GetCurrentProcessId", "", "N" );
	__PACKAGE__->generate( "kernel32", "GetCurrentProcessId", "", "N", 'get_pid' );

	1;

	my $obj = MyModule->new );
	print "PID: " . $obj->GetCurrentProcessId . "\n";
	print "PID: " . $obj->get_pid . "\n";

DESCRIPTION

This module provides functions for generating a object oriented interface to Win32 API functions.

METHODS

new

my $obj = Module->new;

Win32::API::Interface provides a basic constructor. It generates a hash-based object and can be called as either a class method or an object method.

generate

__PACKAGE__->generate( "kernel32", "GetCurrentProcessId", "", "N" );

This generates a method called GetCurrentProcessId which is exported by kernel32.dll. It does not take any input parameters but returns a value of type long.

__PACKAGE__->generate( "kernel32", "GetCurrentProcessId", "", "N", "get_pid" );

Actually the same as above, but this will generate a method called get_pid. This is useful if you do not want to rely on the API function name.

__PACKAGE__->generate(
    [ "kernel32", "GetTempPath", "NP", "N" ],
    [ "kernel32", "GetCurrentProcessId", "", "N", "get_pid" ],
);

You may call generate passing an array of array references.

__PACKAGE__->generate( {
    "kernel32" => [
        [ "GetTempPath", "NP", "N" ],
        [ "GetCurrentProcessId", "", "N", "get_pid" ],
    ],
    "user32" => [
        [ "GetCursorPos", "P", "I"]
    ],
} );

generated

Returns a list of all real generated API function names

__PACKAGE__->generated( );

AUTHOR

Sascha Kiefer, esskar@cpan.org

COPYRIGHT AND LICENSE

Copyright (C) 2006 Sascha Kiefer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.