Eshock has asked for the wisdom of the Perl Monks concerning the following question:
use Win32::API; my $debug = 1; ## Needed Files my $ADDRLN = 'c:\pw\acelib\addrln.dct'; my $LASTLN = 'c:\pw\acelib\lastln.dct'; my $PWCAS = 'c:\pw\acelib\pwcas.dct'; my $FIRMLN = 'c:\pw\acelib\firmln.dct'; my $CITY07 = 'h:\city07.dir'; my $REVZIP4 = 'h:\revzip4.dir'; my $ZCF07 = 'h:\zcf07.dir'; my $ZIP4US = 'h:\zip4us.dir'; my $ACE3553 = 'c:\pw\acelib\ace3553.frm'; my $ACENDI = 'c:\pw\acelib\acendi.frm'; my $ACELIBKEY = 'c:\pw\acelib\acelib.key'; my $ace_dll = 'c:\pw\acelib\ace32.dll'; ## ACE32 Functions my $ace_init = new Win32::API("$ace_dll", "ace_init", [V], I); my $ace_term = new Win32::API("$ace_dll", "ace_term", [V], I); my $ace_init_addr = new Win32::API("$ace_dll", "ace_init_addr", [P], I +); my $ace_term_addr = new Win32::API("$ace_dll", "ace_term_addr", [P], I +); my $ace_open = new Win32::API("$ace_dll", "ace_open", [P], I); my $ace_close = new Win32::API("$ace_dll", "ace_close", [P], I); my $ace_set_file = new Win32::API("$ace_dll", "ace_set_file", [P, I, P +], I); my $ah = pack('L', 0); my $addrln_path = pack('Z', "$ADDRLN"); my $res; ## ACE Initialization debug("ACE Initialization"); if (($res = $ace_init->Call()) != 0) { die("Unable to initialize ACE: Result -> $res\n"); } ## ACE Address Handle Initialization debug("ACE Address Handle Initialization"); if (($res = $ace_init_addr->Call(\$ah)) != 0) { $ace_term->Call(); die("Unable to initialize Address Handle: Result -> $res\n"); } ## Set addrln.dct File debug("Set addrln.dct File"); if (($res = $ace_set_file->Call($ah, 5, $addrln_path)) != 0) { $ace_term_addr->Call($ah); $ace_term->Call(); die("Unable to set $ADDRLN: Result -> $res\n"); } print $ace_term_addr->Call($ah) . "\n"; print $ace_term->Call() . "\n"; exit(0); ## ## Subroutines and Functions ## ## Debug sub debug { if ($debug) { my ($msg) = @_; print "$msg\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Win32::API help
by tye (Sage) on Dec 10, 2001 at 23:30 UTC |