Eh?
 
Win32::API *can* be included in compiled .exe perl scripts. What packer are you using?
 
Steve 
 
 -----Original Message-----
From: perl-win32-gui-users-admin@lists.sourceforge.net [mailto:perl-win32-gui-users-admin@lists.sourceforge.net]On Behalf Of ramy@mehtag.com
Sent: 19 February 2004 11:02
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] New Win32 Package suggestion and sample code

Hello All,
 
I am suggesting we start a new package for Win32 like say Win32::Windows or Win32::General
where in this package we can add or request a specific windows functions that is not already included
in Win32 current packages. For example, I needed to get the Memory status function I know there is a module
called Sysinfo or so but is used by callng WIn32::API which can not currently included with compiled .exe perl scripts
therefore it was a must for me to build s little module for this function. However every little time I needed one other
function. Here is a code to get the memory ststus function and it is tested and working.
Any one is welcomed to start this package and set the rules for it.
 
TODO: of course anyone can help adding these needed by everyone:
 
1)- Loading Windows Help files using WinHelp function:
 
BOOL WinHelp(
    HWND hWndMain,
    LPCTSTR lpszHelp,
    UINT uCommand,
    DWORD dwData
);
 
WinHelp(ghWndMain, gszHELPfilename, HELP_QUIT, 0); // unload help
2)-Getting and changing the .DLL and .EXE version information, specially
these info is not updated to your compied .exe usig perlapp or perl2exe
if you see any .exe file you generated by windows explorer "property" it
will refer to indygostar website and perl.exe file only.
 
VS_VERSIONINFO {
    WORD  wLength;
    WORD  wValueLength;
    WORD  wType;
    WCHAR szKey[];
    WORD  Padding1[];
    VS_FIXEDFILEINFO Value;
    WORD  Padding2[];
    WORD  Children[];
};
typedef struct _VS_FIXEDFILEINFO {  // vsffi
    DWORD dwSignature;
    DWORD dwStrucVersion;
    DWORD dwFileVersionMS;
    DWORD dwFileVersionLS;
    DWORD dwProductVersionMS;
    DWORD dwProductVersionLS;
    DWORD dwFileFlagsMask;
    DWORD dwFileFlags;
    DWORD dwFileOS;
    DWORD dwFileType;
    DWORD dwFileSubtype;
    DWORD dwFileDateMS;
    DWORD dwFileDateLS;
} VS_FIXEDFILEINFO; 
 
// File version
            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
                TEXT("\\
StringFileInfo\\040904E4\\FileVersion"),
                (LPVOID *)&lpVersion,
                puVersionLen);

 
#================================================================
This code for 2 functions, get memory status and get system path directory
calling directly as my @Mems = &Win32::MemoryStatus::MemStatus();
 
 
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include <windows.h>
 
MODULE = Win32::MemoryStatus  PACKAGE = Win32::MemoryStatus  
 
PROTOTYPES: DISABLE
 #================================================
# GlobalMemoryStatus exists in the  kernel32.dll library
 
void
MemStatus()
 PREINIT:
  MEMORYSTATUS * mem;
 PPCODE:
  GlobalMemoryStatus(mem);
  EXTEND(SP, 8);
  PUSHs(sv_2mortal(newSVuv(mem->dwMemoryLoad)));
  PUSHs(sv_2mortal(newSVuv(mem->dwTotalPhys)));
  PUSHs(sv_2mortal(newSVuv(mem->dwAvailPhys)));
  PUSHs(sv_2mortal(newSVuv(mem->dwTotalPageFile)));
  PUSHs(sv_2mortal(newSVuv(mem->dwAvailPageFile)));
  PUSHs(sv_2mortal(newSVuv(mem->dwTotalVirtual)));
  PUSHs(sv_2mortal(newSVuv(mem->dwAvailVirtual)));
  PUSHs(sv_2mortal(newSVuv(mem->dwLength)));
  XSRETURN(8);
 
void
WinSystemDirectory()
 PREINIT:
  LPTSTR  lpBuff;
  UINT  PathLen;
  int  BufSize;
 PPCODE:
  BufSize = 300;
  lpBuff = (LPTSTR) safemalloc(BufSize);
  PathLen = GetSystemDirectory(lpBuff, BufSize);
  EXTEND(SP, 1);
  PUSHs(sv_2mortal(newSVpv(lpBuff, PathLen)));
  safefree(lpBuff);
  XSRETURN(1);
and this is a perl module suggestion for it, of course it can be called directly
 
 
package Win32::MemoryStatus;
 
#use 5.008002;
use strict;
use warnings;
 
require Exporter;       # to export the constants to the main:: space
require DynaLoader;     # to dynuhlode the module.
our @ISA = qw( Exporter DynaLoader );
 
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
 
# This allows declaration use Win32::MemoryStatus ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
 
) ] );
 
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
 
);
 
our $VERSION = '0.01';
 
#require XSLoader;
#XSLoader::load('Win32::MemoryStatus', $VERSION);
# kernel32.dll
bootstrap Win32::MemoryStatus;
 
sub MemoryStatus{
 
 my @Mems = &Win32::MemoryStatus::MemStatus();
 my %Meminfo;
 undef %Meminfo;
 #print join "\n=",@Mems;
 
 if ($Mems[7] == 0) {return undef;} #The size in bytes of the MEMORYSTATUS data structure.
 
 $Meminfo{MemLoad} = int($Mems[0]);
 $Meminfo{TotalPhys} = $Mems[1];
 $Meminfo{AvailPhys} = $Mems[2];
 $Meminfo{TotalPage} = $Mems[3];
 $Meminfo{AvailPage} = $Mems[4];
 $Meminfo{TotalVirtual} = $Mems[5];
 $Meminfo{AvailVirtual} = $Mems[6];
 return %Meminfo;
}
 
# Preloaded methods go here.
 
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
 
=head1 NAME
 
Win32::MemoryStatus - Perl extension for blah blah blah
 
=head1 SYNOPSIS
 
  use Win32::MemoryStatus;
  blah blah blah
 
=head1 DESCRIPTION
 
Stub documentation for Win32::MemoryStatus, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.
 
Blah blah blah.
 
=head2 EXPORT
 
None by default.
 
 
 
=head1 SEE ALSO
 
Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.
 
If you have a mailing list set up for your module, mention it here.
 
If you have a web site set up for your module, mention it here.
 
=head1 AUTHOR
 
A. U. Thor, E<lt>a.u.thor@a.galaxy.far.far.awayE<gt>
 
=head1 COPYRIGHT AND LICENSE
 
Copyright (C) 2004 by A. U. Thor
 
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.2 or,
at your option, any later version of Perl 5 you may have available.
 

=cut
 
 
Ramy