Hi Bill, Thanks for the tip! Now I understand.
Paul Paul Voyer System/DB/PDM Administrator Engineering Applications Support Harris Corporation - Microwave Communication Division mailto:pvoyer@;harris.com -----Original Message----- From: $Bill Luebkert [mailto:dbe@;wgn.net] Sent: Thursday, October 24, 2002 6:03 PM To: Voyer, Paul Cc: [EMAIL PROTECTED] Subject: Re: Changing Environment variable Voyer, Paul wrote: > The module Win32::AdminMisc did not work for me, even if it returned successful! > > > I have used Bill's solution, it worked just fine! > I may miss something here. But how do we find those constant value for > HWND_BROADCAST and WM_SETTINGCHANGE? I have the SDK installed on my machine and an old Dev Studio and Cygwin and just grep them for the values I want. I call it typdef.pl and I have it aliased in tcsh 'alias td perl D:/home/dbe/bin/typedef.pl \!*' so I can just type td WM_SETTINGCHANGE or td 'WM_.*' and get all WM_ constants. I'll include my script here: #!perl -w -- #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - use strict; use Data::Dumper; $Data::Dumper::Indent=1; $| = 1; binmode STDOUT; our %A; # holds command line switches for (my $ii = 0; $ii < @ARGV; ) { last if $ARGV[$ii] =~ /^--$/; if ($ARGV[$ii] !~ /^-{1,2}(.*)$/) { # if not switch $ii++; next; # ignore } my $arg = $1; splice @ARGV, $ii, 1; # remove arg if ($arg =~ /^([\w]+)=(.*)$/) { # if assign $A{$1} = $2; } else { # boolean $A{$1}++; } } #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - my $usage = <<EOD; Usage: $0 [-c] [-i] [-m] [-p] [-s] <expr> ... -c search Cygwin includes -i case insensitive -m search MSDEV includes (default) -p print typedefs list out -s search SDK includes <expr> expr to match (usually a word) EOD die $usage if $A{h} or $A{help}; # I use these for picking Win32::API arg types my $defs = <<EOD; char = (8) uchar = (8) short = (16) ushort = (16) int = (32) uint = (32) long = (32) ulong = (32) WCHAR = WORD = ushort (16) wchar_t = ushort (16) WORD = ushort (16) DWORD = ulong (32) GLOBALHANDLE = HANDLE = void * = ulong (32) HANDLE = PVOID = void * = ulong (32) HINSTANCE = void * = ulong (32) HKEY = void * = ulong (32) HMODULE = HINSTANCE = void * = ulong (32) HWND = void * = ulong (32) LHANDLE = ulong (32) LOCALHANDLE = HANDLE = void * = ulong (32) LP = WCHAR FAR * = ulong (32) LPDWORD = DWORD * = ulong (32) LPHANDLE = HANDLE * = void * = ulong (32) LPLHANDLE = ulong (32) PDWORD = near * WORD = ulong (32) SPHANDLE = near * HANDLE = void * = ulong (32) OLE_HANDLE = uint (32) PHANDLE = HANDLE * = void * = ulong (32) PHKEY = HKEY * = void * = ulong (32) PWCHAR = WCHAR * = void * = ulong (32) SC_HANDLE = HANDLE = void * = ulong (32) SDWORD = long (32) SERVICE_STATUS_HANDLE = DWORD = ulong (32) SQLHWND = HWND = void * = ulong (32) UDWORD = ulong (32) DWORDLONG = __uint64 (64) or double (64) EOD print $defs and exit if $A{p}; my @dirs; my @bases = (); # modify to fit your installation of header files push @bases, 'H:/MSDev/include' if $A{m}; # msdev includes push @bases, 'O:/MicrosoftSDK/include' if $A{s}; # SDK includes push @bases, 'H:/Cygwin/usr/include' if $A{c}; # Cygwin push @bases, 'h:/msdev/include' if not @bases; # get subdirs of dirs foreach my $dir (@bases) { push @dirs, $dir; opendir DIR, $dir or die "Error opendir '$dir': $!"; my @d = grep { -d "$dir/$_" and not /^\.{1,2}$/ } readdir DIR; closedir DIR; push @dirs, "$dir/$_" foreach @d; } # search all dirs foreach my $dir (@dirs) { print "$dir:\n"; opendir DIR, $dir or die "Error opendir '$dir': $!"; while (my $file = readdir DIR) { next if $file =~ /^\.{1,2}$/ or -d "$dir/$file"; open IN, "$dir/$file" or warn "Error opening '$dir/$file': $!"; my $first = 0; while (<IN>) { foreach my $arg (@ARGV) { my $match = "(?-xism:$arg)"; $match = "(?i-xsm:$arg)" if $A{i}; if (/\b$match\b\s*;/ or /^\s*#define\s+\b$match\b/) { print "\t$dir/$file:\n" if ++$first == 1; print $_; } } } close IN; } closedir DIR; } __END__ -- ,-/- __ _ _ $Bill Luebkert ICQ=162126130 (_/ / ) // // DBE Collectibles Mailto:dbe@;todbe.com / ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/ _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs