Re: Help with Win32::GUI

2012-09-07 Thread Jack
On 07/09/2012 12:48 PM, Barry Brevik wrote:
 I am lost with this simple app, and I hope I am posting to the correct
 list; the Sourceforge list appears to dead.

 Anyway, the problem is with the event model (I guess). I have 2 fields
 and all I want is when the user presses ENTER or TAB in the first field,
 I want to capture the text, and have the focus move to the next field. I
 have Change set for the fields, which is alright, but I fail to see how
 I can capture the RETURN or TAB key. Annoyingly, the LostFocus event
 fires every time a key is pressed, which makes no sense to me.

 Below is my simplified code which displays the action. I'm sorry that it
 is about 90 lines in length. Can anyone help?

It seems that the dialogui will overwrite the Enter key binding. Also it 
depends on whether the Textfield is multiline or not.

So. you can roll your own key checking into these boxes. The revised 
code is below.

I have bound Enter in the username to go to the password box. I have 
bound Enter in the password box to show the username and password in a 
label...

##
use strict;
use warnings;
use Win32;
use Win32::GUI();
use Win32::GUI::Constants qw(VK_RETURN VK_TAB);

my $main = Win32::GUI::Window - new
(
   -name   = 'Main',
   -title  = 'Test v0.1',
   -width  = 430,
   -height = 200
);

my $monoinput = Win32::GUI::Font - new(-name = 'Consolas', -size =
10, -bold = 0, -italic = 0);
my $monolabel = Win32::GUI::Font - new(-name = 'Consolas', -size =
10, -bold = 1, -italic = 0);

my $userlabel = $main - AddLabel
(
   -font = $monolabel,
   -pos  = [10, 22],
   -text = 'username:',
   -foreground = 0xff
);

# Create a text input field.
my $userfield = $main - AddTextfield
(
   -eventmodel   = byname,
   -name = username,
   -align= left,
   -pos  = [96, 20],
   -size = [100, 24],
   -width= 100,
   -height   = 20,
   -password = 0,
   -passwordChar = chr(249),
   -background   = 0xff,
   -font = $monoinput,
   -text = '',
);

my $passlabel = $main - AddLabel
(
   -font = $monolabel,
   -pos  = [10, 64],
   -text = 'password:',
   -foreground = 0xff
);

# Create a text input field.
my $passfield = $main - AddTextfield
(
   -eventmodel   = byname,
   -name = password,
   -align= left,
   -tabstop  = 1,
   -pos  = [96, 60],
   -size = [100, 24],
   -password = 1,
   -passwordChar = chr(249),
   -background   = 0xff,
   -font = $monoinput,
   -text = '',
  # -dialogui = 1  # Enable keyboard navigation like DialogBox
);
my $resultLabel = $main - AddLabel
(
   -font = $monolabel,
   -pos  = [10, 100],
   -text = ' ',
   -wrap = 0,
   -width = 400,
   -foreground = 0x00,
   -background = 0xff
);

$userfield - MaxLength(16);
$passfield - MaxLength(16);

$userfield - SetFocus();
$main - Show();
Win32::GUI::Dialog();

exit(0);

#--
sub password_KeyDown {
 my($flags,$key) = @_;
 if($key == VK_RETURN){
 my $string = Username: . $userfield-Text().  Password: . 
$passfield-Text();
 $resultLabel-Change(-text=$string);
 }
 elsif ($key == VK_TAB) {
 $userfield -SelectAll();
 $userfield -SetFocus();
 }
 return 1;
}
#--
sub username_KeyDown {
 my($flags,$key) = @_;
 if($key == VK_RETURN or $key == VK_TAB){
 $passfield -SelectAll();
 $passfield -SetFocus();
 }
 return 1;
}
#--
sub Main_Terminate {-1;}



Jack D.

 Thank you,

 Barry Brevik
 ---
 use strict;
 use warnings;
 use Win32;
 use Win32::GUI();

 my $main = Win32::GUI::Window - new
 (
-name   = 'Main',
-title  = 'Test v0.1',
-width  = 400,
-height = 200
 );

 my $monoinput = Win32::GUI::Font - new(-name = 'Consolas', -size =
 10, -bold = 0, -italic = 0);
 my $monolabel = Win32::GUI::Font - new(-name = 'Consolas', -size =
 10, -bold = 1, -italic = 0);

 my $userlabel = $main - AddLabel
 (
-font = $monolabel,
-pos  = [10, 22],
-text = 'username:',
-foreground = 0xff
 );

 # Create a text input field.
 my $userfield = $main - AddTextfield
 (
-eventmodel   = byname,
-name = username,
-align= left,
-tabstop  = 1,
-pos  = [76, 20],
-size = [100, 24],
-width= 100,
-height   = 20,
-password = 0,
-passwordChar = chr(249),
-background   = 0xff,
-font = $monoinput,
-text = '',
-dialogui = 1  # Enable keyboard navigation like DialogBox
 );

 my $passlabel = $main - AddLabel
 (
-font = $monolabel,
-pos  = [10, 64],
-text = 'password:',
-foreground = 0xff
 );

 # Create a text input 

RE: help with Win32

2012-06-04 Thread William . Hoopes
To the best of my knowledge (I'd love to be wrong here), this
information does not exist.

Best case scenario, you'd have to turn on some audit flags and from
there parse event log information. Also, this would only work from a
point in time.

We chose to leverage a logon script with a sub routine addition to
record a login to a database.  What flexibility/rights do you have with
regards to the workstations?



-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Barry Brevik
Sent: Monday, June 04, 2012 2:20 PM
To: perl Win32-users
Subject: help with Win32

I have both of the Roth books, but I've come up empty.

I have a need to determine which client machine a given user (or all
users) has logged into the domain from.

I'm willing to back into it by starting with all client machines. I'm
willing to process all of the machines and users in the domain if
necessary. In fact, I'm willing to jump through a fair number of hoops
to collect this information.

Does anyone out there know how to do this, or at least have an idea as
to how to do this?

Thanks in advance,

Barry Brevik

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: help with Win32

2012-06-04 Thread Steven Manross
Well, for starters...

The information is in your eventlogs on ALL the domain controllers
(collectively).

So, WMI and the Win32_Eventlog class is a good place to start (via
Win32::OLE).  

http://www.manross.net/download.aspx?file=/perl/scripts/wmi-generic.pl

C:\perl\scriptsperl wmi-Generic.pl DOMAINCONTROLLER1 Win32_NTLogEvent
-where=LogFile='Security' and EventCode=528 and
User='DOMAINNAME\\presidentofthecompany' and Type='Audit Success'

(above == logon events but it isnt perfect for your needs as you really
want an interactive logon, not network logons -- which this also
includes) -- I believe you want a LogonType == 2, but that's not a
WQL-able filter...  You'd have to write a regex and get perl to discard
the events you don't want to see for you.

If you are looking for specific users and all the computers they have
logged in to, this would probably be the most efficient way to do it and
allow you to zero in on specific systems to target.

If instead you had your heart set on physically checking every system
(maybe because your event logs don't go back to the beginning of time..
HA-HA)  You can check to see if the user profile is still loaded on that
system via the ProfileList registry entry (and the existance of the
user profile in Documents and Settings or the Users dir on newer
OSes)  

However, this still won't always tell you what you need as the profile
can be deleted by scripty admins who need/want to conserve space on
those systems for people that havent logged in for X days/months/years
and technically a computer could be removed from the domain and
reformatted without you getting to see the data you are after, first.

An easier way to do this would be to have a domain logon script that
writes info to a log file and then you can parse the list from there.
But then you would have had to start this a few years ago for you to be
able to harvest data now (and not had any errors maintaining that log
ever).  :)

HTH

Steven


-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Barry Brevik
Sent: Monday, June 04, 2012 11:20 AM
To: perl Win32-users
Subject: help with Win32

I have both of the Roth books, but I've come up empty.

I have a need to determine which client machine a given user (or all
users) has logged into the domain from.

I'm willing to back into it by starting with all client machines. I'm
willing to process all of the machines and users in the domain if
necessary. In fact, I'm willing to jump through a fair number of hoops
to collect this information.

Does anyone out there know how to do this, or at least have an idea as
to how to do this?

Thanks in advance,

Barry Brevik

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Help with Win32::Process::Create()

2011-08-23 Thread Jan Dubois
On Tue, 23 Aug 2011, Barry Brevik wrote:
 
 I ALREADY HAVE some code that does this (see below). My question is- is
 there a way to periodically poll the outside process to determine if it
 is still running? I've tried a few things already and none of them work.


if (defined $process) {
if ($process-GetExitCode() == Win32::Process::STILL_ACTIVE()) {
# process is still running
...
}
else {
# process has terminated; PID is still valid
...
# release process handle so the OS can do full cleanup
# of the already terminated process
$process = undef;
}
}

Cheers,
-Jan


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Help with Win32::Process::Create()

2011-08-23 Thread Ken Slater
 -Original Message-
 From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-
 win32-users-boun...@listserv.activestate.com] On Behalf Of Barry Brevik
 Sent: Tuesday, August 23, 2011 2:08 PM
 To: perl-win32-users@listserv.ActiveState.com
 Subject: Help with Win32::Process::Create()
 
 I'm working on an app that periodically needs to execute outside
 procedures. Ideally, I want to launch the outside procedure in fire
 and
 forget mode; that is, I do not want to wait for the outside process to
 terminate.
 
 I ALREADY HAVE some code that does this (see below). My question is- is
 there a way to periodically poll the outside process to determine if it
 is still running? I've tried a few things already and none of them
 work.
 
 = the code =
 use strict;
 use warnings;
 use Win32::Process;
 
 # Parameters for the Win32::Process::Create function:
 #
 #   Process  This is an empty string that will receive
 #a process ID used to address the child process.
 #Returns a string that looks like this:
 #Win32::Process=SCALAR(0x235478).
 #
 #   fullPath The full path to the program including the
 #program name and extension. Can be UNC.
 #
 #   newArg   The name of the program itself with an extension,
 #but no path. Also, command line arguments go here.
 #
 #   inheritHndls Should the child process inherit the parent's file
 handles?
 #
 #   flagsx   OR'd combination of the flags listed above.
 #
 #   dirx Startup directory for the child process.
 #
 my $process = '';
 my $dirx = '.';
 my $inheritHndls = 0;
 my $newArg = 'notepad.exe';
 my $fullPath = c:\\windows\\system32\\$newArg;
 my $flagsx = DETACHED_PROCESS | NORMAL_PRIORITY_CLASS;
 
 if (my $spawnhndl = Win32::Process::Create($process, $fullPath,
 $newArg,
 $inheritHndls, $flagsx, $dirx))
 {
   my $pid = $process-GetProcessID();
   print Child process returned PID: $pid\n;
 }
 else
 {
   my $errormsg = Win32::FormatMessage(Win32::GetLastError());
   print Failed to launch process $fullPath: $errormsg\n;
 }
 ___

Take a look at the GetExitCode method for Win32::Process.
HTH, Ken


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::Input

2010-02-05 Thread Chris Wagner
I would use Term::ReadKey to to do non blocking reads in this situation.  It
even accepts drag and drop file names while in the background.


At 04:21 PM 2/5/2010 -0800, Barry Brevik wrote:
I am writing an app that continously loops looking for files to appear
in a certain directory, and when they do, it reads those files and does
some work with them.
 
...BUT...


--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede malis

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::ODBC

2007-11-29 Thread Sisyphus

- Original Message - 
From: Barry Brevik [EMAIL PROTECTED]
To: perl-win32-users@listserv.ActiveState.com
Sent: Friday, November 30, 2007 11:46 AM
Subject: Help with Win32::ODBC


I am using the Win32::ODBC module, and I continually get the following
 error message:

  Can't locate auto/Win32/ODBC/GetTypeInfo.al in @INC (@INC contains:
 C:/Perl/site/lib C:/Perl/lib .) at odbcinfo.pl line 58


Looking at the documentation at 
http://search.cpan.org/~jdb/libwin32-0.28/ODBC/ODBC.pm there is no mention 
of the GetTypeInfo method. Either it is undocumented or does not exist (in 
that particular version of Win32::ODBC, at least).

The method certainly doesn't exist for the version of Win32::ODBC that you 
are running. Perhaps it exists in an earlier or later version.

As for the error message itself ... it is basically a red herring. When perl 
can't find the GetTypeInfo method it looks for a file called GetTypeInfo.al 
in the chance that the file exists (and defines the GetTypeInfo method). 
When it can't find that file it complains that GetTypeInfo.al can't be 
found. The correct thing for perl to do is to simply complain that the 
GetTypeInfo function is non-existent. There never was, nor should there be, 
a file named GetTypeInfo.al.

It is possible for module authors to write their modules in such a way that 
this red herring error message does not appear, and is instead replaced 
with a sane and meaningful message. But not all authors construct their 
modules that way :-)

Cheers,
Rob 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-26 Thread Matt Clark
I've opened up dsuiext.dll with the DLL Export Viewer and verified that it's 
DSBrowseForContainerW (or A for ansi but I want unicode).

Using $^E, the error I get is The specified procedure could not be found... I 
get that no matter which way I try to load the function (Win32::API-Import, 
Win32::API-new, new Win32::API, etc).  Any other thoughts?

Matt Clark
Unit Head, Desktop Services
IT Department
UCSD Libraries

 Sisyphus [EMAIL PROTECTED] 05/25/05 09:35PM 

- Original Message - 
From: Sisyphus [EMAIL PROTECTED]

 The function is called DsBrowseForContainer() - not as you have written
it.
 (It matters :-)


I meant DsBrowseForContainerW() - not as *I* have written it. (It possibly
also matters :-)

Cheers,
Rob



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-26 Thread Matt Clark
First hurdle cleared... someone pointed out to me that function names need to 
be case-sensitive, so DsBrowseForContainerW should work... but now I'm getting 
a separate error after calling Win32::API-Import on that function... $^E is 
coming up as Class already exists.  Help?

Matt Clark
Unit Head, Desktop Services
IT Department
UCSD Libraries

 Matt Clark [EMAIL PROTECTED] 05/26/05 09:44AM 
I've opened up dsuiext.dll with the DLL Export Viewer and verified that it's 
DSBrowseForContainerW (or A for ansi but I want unicode).

Using $^E, the error I get is The specified procedure could not be found... I 
get that no matter which way I try to load the function (Win32::API-Import, 
Win32::API-new, new Win32::API, etc).  Any other thoughts?

Matt Clark
Unit Head, Desktop Services
IT Department
UCSD Libraries

 Sisyphus [EMAIL PROTECTED] 05/25/05 09:35PM 

- Original Message - 
From: Sisyphus [EMAIL PROTECTED]

 The function is called DsBrowseForContainer() - not as you have written
it.
 (It matters :-)


I meant DsBrowseForContainerW() - not as *I* have written it. (It possibly
also matters :-)

Cheers,
Rob



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com 
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-26 Thread Sisyphus

- Original Message - 
From: Matt Clark [EMAIL PROTECTED]


 Using $^E, the error I get is The specified procedure could not be
found... I get that no matter which way I try to load the function
(Win32::API-Import, Win32::API-new, new Win32::API, etc).  Any other
thoughts?


Yep - that's the error I got. It's just another way of saying that there
aint no such function. Acording to my Visual Studio documentation the second
letter of the function's name is a lower case 's' ('DsBrowse...'), not an
upper case 'S' ('DSBrowse...'), and when I change the function name
accordingly, I can then import the function and the script you posted runs
witrhout error.

Cheers,
Rob

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-26 Thread Sisyphus

- Original Message - 
From: Matt Clark [EMAIL PROTECTED]
To: perl-win32-users@listserv.ActiveState.com
Sent: Friday, May 27, 2005 7:14 AM
Subject: Re: Help with Win32::API?


 First hurdle cleared... someone pointed out to me that function names need
to be case-sensitive, so DsBrowseForContainerW should work... but now I'm
getting a separate error after calling Win32::API-Import on that
function... $^E is coming up as Class already exists.  Help?


In your original script you read $!, irrespective of whether the Import()
succeeded or not. You really should read the error variables only if the
Import() fails (and you should, in that eventuality, also kill the script
there and then):

if(!Win32::API-Import('dsuiext', 'int DsBrowseForContainerW(LPDSBROWSEINFOW
pInfo)'))
{die $^E . \n;}

For me, once I corrected the function name, the Import() worked fine. It was
a little misleading to say that the script then ran without error - I
should have said ran without reporting any errors. For me, the call to
DsBrowseForContainerW() returns -1, indicating (according to the msdn
documentation) that the function call failed. That's about all that
happens - the script then exits normally.

I note also that the prototype for DsBrowseForContainer() lists pInfo as
being of type PDSBROWSEINFO, but Win32::API requires that it be written as
LPDSBROWSEINFO. I don't know if that discrepancy (which also carries over to
the wide version of the function) causes a problem. I suspect not  but I
don't know for sure.

Cheers,
Rob

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-25 Thread Sisyphus

- Original Message - 
From: Matt Clark [EMAIL PROTECTED]


 Win32::API-Import('dsuiext', 'int DSBrowseForContainerW(LPDSBROWSEINFOW
pInfo)');
 print $! . \n;


The function is called DsBrowseForContainer() - not as you have written it.
(It matters :-)

If you use $^E (as recommended in Win32-API docs) instead of $! you'll get a
more meaningful error message, too.

Cheers,
Rob

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::API?

2005-05-25 Thread Sisyphus

- Original Message - 
From: Sisyphus [EMAIL PROTECTED]

 The function is called DsBrowseForContainer() - not as you have written
it.
 (It matters :-)


I meant DsBrowseForContainerW() - not as *I* have written it. (It possibly
also matters :-)

Cheers,
Rob

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Help Installing Win32::GUI

2000-11-06 Thread Trevor Joerges
Title: RE: Help Installing Win32::GUI





Worked like a charm.


Thanks Jenda.
Trevor J. Joerges
http://members.home.net/tjoerges



-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: November 4, 2000 08:12 AM
To: [EMAIL PROTECTED]
Subject: RE: Help Installing Win32::GUI



 Hi Jenda,
 When I use the line you quoted below the .pm files all get installed okay
 but all of the HTML files get created but with a 0 byte count. Is this what
 you experience too?
 
 Regards,
 Trevor J. Joerges


Could you try it now? I forgot to include the docs in the version fo 
perl 5.6.


Sorry, Jenda


== [EMAIL PROTECTED] == http://Jenda.McCann.cz ==
 FUCK THE ARMY!
 Myself
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users