Site Navigation

User Guide

Reference

Packages

 

SYNOPSIS

  use Win32:GUI::Constants;

or

  use Win32:GUI::Constants ();

or

  use Win32::GUI::Constansts [@pragmata,] [@symbols];

Win32::GUI::Constants is a module that provides definitions and export capabilities for Win32 API constant values. There is access to more than 1700 Win32 API constants. Nothing is exported by default.

EXPORT SYNTAX

Win32::GUI::Constants provides its own 'import' funcion for performance reasons, but follows the Exporter module's definition for the syntax, with some additional pragmata to control the export behaviour.

Standard Syntax

use Win32::GUI::Constants;

This imports all the default symbols into your namespace. Currently there are no default symbols.

use Win32::GUI::Constants ();

This loads the module without importing any symbols.

use Win32::GUI::Constants qw(...);

This imports only the symbols listed into your namespace. An error occurs if you try to import a symbol that does not exist. The advanced export features are accessed like this, but with list entries that are syntactically distinct from symbol names.

Advanced Syntax

If any of the entries in an import list begins with !, : or / then the list is treated as a series of specifications which either add to or delete from the list of names to import. They are processed left to right. Specifications are in the form:

  [!]name         This name only
  [!]:tag         All names in class 'tag'
  [!]/pattern/    All names which match pattern

A leading ! indicates that matching names should be deleted from the list of names to import.

Remember that most patterns (using //) will need to be anchored with a leading ^, e.g., /^TPM_/ rather than /TPM/.

You can say BEGIN { $Win32::GUI::Constants::Verbose=1 } before your use Win32::GUI::Constants qw( ... ); line to see how the specifications are being processed and what is actually being imported into your namespace.

If any of the entries in an import begins with a - then the entry is treated as a pragma that affects the way in which the exporting is performed.

PRAGMATA

The following pragmata ae provided to affect the behaviour of the export capabilities of Win32::GUI::Constants.

-inline

Causes the constant subroutine body to be generated at compile time. This sacrifices some compile time speed for the ability for the constants that are listed to be inlined by the compiler, which gains some runtime speed.

-noexport

The same behaviour as -inline, except that the constants that are listed are not exported, and so must be used by their fully qualified package names. (e.g. Win32::GUI::Constants::CW_USEDEFAULT)

-exportpkg, pkgname

Causes exported symbols to be exported to the pkgname namespace, rather than to the caller's namespace. pkgname must appear as the next item in the list. Omitting pkgname from the list is likely to cause behaviour that is difficult to understand.

-autoload

Causes Win32::GUI::Constants' AUTOLOAD() subroutine to be exported, making all non-exported constants available in that namespace. Don't do this if the package you are exporting to already has an AUTOLOAD() subroutine.

EXPORT TAGS

See the Win32::GUI::Constants::Tags documentation for available tag classes.

Use of :tag export definitions adds some overhead both in terms of compile-time speed and memory usage.

FUNCTIONS

constant

  my $value = Win32::GUI::Constants::constant('SOME_CONST');

The constant() function may be used to perform the lookup of a string constant identifier to its numeric value. This has the advantage of not resulting in any memory overhead due to created symbol table entries, at the expense of speed, as the lookup must be performed every time this function is called.

Returns the constant's numeric value on success, undef on failure.

REQUIRES

No prerequsites other than perl core modules (strict, warnings, warnings::register, Carp).

Win32::GUI::Constants may be useful to other Win32::* packages.

SEE ALSO

MSDN http://msdn.microsoft.com and individual api documentation for more information on constants required for any particular call.

Win32::GUI

SUPPORT

Homepage: http://perl-win32-gui.sourceforge.net/.

For further support join the users mailing list (perl-win32-gui-users@lists.sourceforge.net) from the website at http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users. There is a searchable list archive at http://sourceforge.net/mail/

BUGS

Not all constants are covered. If you find missing constants please raise a feature request at http://sourceforge.net/tracker/

AUTHORS

Robert May, <robertemay@users.sourceforge.net>

ACKNOWLEDGEMENTS

Many thanks to the Win32::GUI developers at http://perl-win32-gui.sourceforge.net/ for suggestions and assistance.

COPYRIGHT & LICENSE

Copyright 2005..2008 Robert May, All Rights Reserved.

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