Re: Problems with Win32::GUI::Brush / Pen
- Original Message - From: "Chris Rogers" <[EMAIL PROTECTED]> To: Sent: Tuesday, July 12, 2005 4:16 AM Subject: Problems with Win32::GUI::Brush / Pen > I have been playing around with samples/BitmapScroll.pl from the > Win32-GUI-1.0 source using perl 5.6 on WinXP SP2. I can't seem to get > a Brush or Pen working for me. No matter what I do (so far), the > rectangle is drawn with the brush/pen I think I'm specifying. Here's > a sample of my broken code: > 'samples/Draw.pl' (in the source distro) uses Brush and Pen. I imagine you've checked it out already - but if you haven't, then it might help. Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problems with Win32::GUI::Brush and PEN
I have been playing around with samples/BitmapScroll.pl from the Win32-GUI-1.0 source using perl 5.6 on WinXP SP2. I can't seem to get a Brush or Pen working for me. No matter what I do (so far), the rectangle is drawn with the brush/pen I think I'm specifying. The majority of this code is straight from the BtimapScroll.pl sample. use Win32::GUI; use strict; #create a new class which stops the WM_ERASEBKGND message from erasing the background #this stops the flicker of the window on resize. my $WC = new Win32::GUI::Class( -name => "NoFlicker", -style => 0, ); #Create the window and child controls. my $mainwin = new Win32::GUI::Window ( -pos => [100, 100], -size=> [330, 235], -name=> "Window", -text=> "Bitmap Scroll demo", -pushstyle => WS_CLIPCHILDREN, -class => $WC, #NEM Events for this window -onResize=> \&MainResize, -onTerminate => sub {return -1;} ); $mainwin->AddButton ( -name=> 'Open', -pos => [205, 20], -size=> [110, 20], -text=> 'Open Bitmap', -onClick => \&FindAndOpenBitmap, ); #Define global variables my $memdc; my $bitmap;#will hold the bitmap ### # my brush and pen objects our $dragpen = Win32::GUI::Pen->new(-color=>[0,255,0],-width=>5); our $dragbrush = Win32::GUI::Brush->new(-color=>[0,0,255]); ### #Create a child window with a scroll bars. my $ChildWin = new Win32::GUI::Window ( -parent => $mainwin, -name=> "ChildWin", -pos => [0, 0], -size=> [200, 200], -popstyle=> WS_CAPTION | WS_SIZEBOX, -pushstyle => WS_CHILD | WS_CLIPCHILDREN, -pushexstyle => WS_EX_CLIENTEDGE, -class => $WC, -hscroll => 1, -vscroll => 1, -onScroll=> \&Scroll, -onResize=> sub {&Resize($bitmap,@_)}, -onPaint => sub {&Paint($memdc,@_)}, -onMouseDown => \&MouseDown, -onMouseUp => \&MouseUp, -onMouseMove => \&MouseMove, -interactive => 1, ); #Create a memory DC compatible with the child window DC $memdc=$ChildWin->GetDC->CreateCompatibleDC(); #show both windows and enter the Dialog phase. $mainwin->Show(); $ChildWin->Show(); # my attempt at a rectangle $ChildWin->SelectObject($dragpen); $ChildWin->SelectObject($dragbrush); $ChildWin->GetDC->Rectangle(10,10,50,50); $ChildWin->GetDC->Validate(); Win32::GUI::Dialog(); The window displays with no errors. The rectangle is drawn with a thin black border and a white background. I was expecting a thick green border with a blue background. What am I doing wrong? Thanks, Chris ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: security question on someones code
Richard Morse wrote: On Jul 11, 2005, at 4:16 PM, lorid wrote: Just curious I found thisline in a sample perl program (which created a simple web page) line: delete @ENV{'BASH_ENV', 'CDPATH', 'ENV', 'IFS', 'PATH', 'SHELL'}; # For security. could someone tell me if I should include this on all web pages I create and if so why? Although I may be wrong, I would only include this if you intend to use any of the environment variables in question -- delete them and reset them to a sane value. Note that calls to system and using the qx (or backticks) operator will make use of these values. which is why perldoc perlsec recommends deleting them. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: security question on someones code
On Jul 11, 2005, at 4:16 PM, lorid wrote: Just curious I found thisline in a sample perl program (which created a simple web page) line: delete @ENV{'BASH_ENV', 'CDPATH', 'ENV', 'IFS', 'PATH', 'SHELL'}; # For security. could someone tell me if I should include this on all web pages I create and if so why? Although I may be wrong, I would only include this if you intend to use any of the environment variables in question -- delete them and reset them to a sane value. Note that calls to system and using the qx (or backticks) operator will make use of these values. HTH, Ricky ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
security question on someones code
Just curious I found thisline in a sample perl program (which created a simple web page) line: delete @ENV{'BASH_ENV', 'CDPATH', 'ENV', 'IFS', 'PATH', 'SHELL'}; # For security. could someone tell me if I should include this on all web pages I create and if so why? thanks Lori ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ANNOUNCE: Win32::GUI v1.02
I am please to announce that v1.02 of Win32::GUI is available for download from SourceForge. Win32::GUI is a Perl extension allowing creation of native Win32 GUI applications. Project summary and download: http://sourceforge.net/projects/perl-win32-gui/ Release notes: http://sourceforge.net/project/shownotes.php?release_id=341357 Regards, Rob. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problems with Win32::GUI::Brush / Pen
I have been playing around with samples/BitmapScroll.pl from the Win32-GUI-1.0 source using perl 5.6 on WinXP SP2. I can't seem to get a Brush or Pen working for me. No matter what I do (so far), the rectangle is drawn with the brush/pen I think I'm specifying. Here's a sample of my broken code: use Win32::GUI; use strict; ### # my brush and pen objects our $dragpen = Win32::GUI::Pen->new(-color=>[0,255,0],-width=>5); our $dragbrush = Win32::GUI::Brush->new(-color=>[0,0,255]); ### #create a new class which stops the WM_ERASEBKGND message from erasing the background #this stops the flicker of the window on resize. my $WC = new Win32::GUI::Class( -name => "NoFlicker", -style => 0, ); #Create the window and child controls. my $mainwin = new Win32::GUI::Window ( -pos => [100, 100], -size=> [330, 235], -name=> "Window", -text=> "Bitmap Scroll demo", -pushstyle => WS_CLIPCHILDREN, -class => $WC, #NEM Events for this window -onResize=> \&MainResize, -onTerminate => sub {return -1;} ); $mainwin->AddButton ( -name=> 'Open', -pos => [205, 20], -size=> [110, 20], -text=> 'Open Bitmap', -onClick => \&FindAndOpenBitmap, ); #Define global variables my $memdc; my $bitmap;#will hold the bitmap #Create a child window with a scroll bars. my $ChildWin = new Win32::GUI::Window ( -parent => $mainwin, -name=> "ChildWin", -pos => [0, 0], -size=> [200, 200], -popstyle=> WS_CAPTION | WS_SIZEBOX, -pushstyle => WS_CHILD | WS_CLIPCHILDREN, -pushexstyle => WS_EX_CLIENTEDGE, -class => $WC, -hscroll => 1, -vscroll => 1, -onScroll=> \&Scroll, -onResize=> sub {&Resize($bitmap,@_)}, -onPaint => sub {&Paint($memdc,@_)}, -onMouseDown => \&MouseDown, -onMouseUp => \&MouseUp, -onMouseMove => \&MouseMove, -interactive => 1, ); #Create a memory DC compatible with the child window DC $memdc=$ChildWin->GetDC->CreateCompatibleDC(); #show both windows and enter the Dialog phase. $mainwin->Show(); $ChildWin->Show(); # my attempt at a rectangle $ChildWin->SelectObject($dragpen); $ChildWin->SelectObject($dragbrush); $ChildWin->GetDC->Rectangle(10,10,50,50); $ChildWin->GetDC->Validate(); Win32::GUI::Dialog(); The rectangle is drawn but with a single pixel black border and white background. I was expecting a thick green border with a blue background. What am I doing wrong? Thanks, Chris ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re[2]: [OLE] QuitMessageLoop has no effect
Jan Ploski/BI/Offis schrieb am 11.07.2005 12:59:14: [EMAIL PROTECTED] schrieb am 11.07. 2005 11:41:02: > Здравствуйте Jan, > > Monday, July 11, 2005, 12:10:32 PM, Вы написали: > > JP> [EMAIL PROTECTED] schrieb am 08.07.2005 > JP> 20:40:56: > > >> Hello, > >> > >> I am unable to get Win32::OLE::QuitMessageLoop working consistently: > >> sometimes it causes a prior Win32::OLE::MessageLoop call to terminate, > >> sometimes it does not. > > JP> Responding to myself and thinking out loud: > > JP> I compiled a debug version of OLE.dll to see what is going on under the > JP> hood. > JP> With respect to debug output, there is not much else to add to my previous > JP> message: the PostThreadMessage call in Initialize(...) returns success, > JP> yet the GetMessage-while-loop a few lines above does not receive the > JP> message. > > JP> I found this tip, which seems related: http://www.devx. com/tips/Tip/14720 > > JP> My working hypothesis is that the thread to which PostThreadMessage > JP> is posted is also the same thread which created the MSIE browser window, > JP> and that there is a second message loop somewhere which (sometimes) > JP> consumes the posted event. > > JP> Perhaps someone could comment if the above sounds plausible and, if yes, > JP> what alternate mechanism I could use in OLE.dll to reliably break out > JP> of the MessageLoop? > > It's just a thought. Why did You think that error in in perl > module? I've read your problem description and thought that the > problem may be the fact that DocumentComplete event doesn't occur. > I'm not familiar with object model You deal with but OLE.pm is > general purpose module and its aim is establish and maintain data > exchange between client and server(s). On my opinion it's very > doubtful that your problem is caused with bug in this module. Hello, thanks for replying. Your guess is what I thought exactly before I have collected enough debugging output to become sure that all events are reported as expected. Moreover, I have hacked OLE.xs (the C part of Win32::OLE's implementation) to use a boolean flag in addition to the PostThreadMessage notification. It seems to have fixed my problems (though I still need to check it on another PC). Also note that there is a remark in Win32::OLE's documentation that support for OLE events should be considered experimental, which further increases my confidence that it is indeed an unresolved issue. Of course, the final judgement is up to Win32::OLE's developers. Best regards - Jan Ploski ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re[2]: [OLE] QuitMessageLoop has no effect
Здравствуйте Jan, Monday, July 11, 2005, 12:10:32 PM, Вы написали: JP> [EMAIL PROTECTED] schrieb am 08.07.2005 JP> 20:40:56: >> Hello, >> >> I am unable to get Win32::OLE::QuitMessageLoop working consistently: >> sometimes it causes a prior Win32::OLE::MessageLoop call to terminate, >> sometimes it does not. JP> Responding to myself and thinking out loud: JP> I compiled a debug version of OLE.dll to see what is going on under the JP> hood. JP> With respect to debug output, there is not much else to add to my previous JP> message: the PostThreadMessage call in Initialize(...) returns success, JP> yet the GetMessage-while-loop a few lines above does not receive the JP> message. JP> I found this tip, which seems related: http://www.devx.com/tips/Tip/14720 JP> My working hypothesis is that the thread to which PostThreadMessage JP> is posted is also the same thread which created the MSIE browser window, JP> and that there is a second message loop somewhere which (sometimes) JP> consumes the posted event. JP> Perhaps someone could comment if the above sounds plausible and, if yes, JP> what alternate mechanism I could use in OLE.dll to reliably break out JP> of the MessageLoop? It's just a thought. Why did You think that error in in perl module? I've read your problem description and thought that the problem may be the fact that DocumentComplete event doesn't occur. I'm not familiar with object model You deal with but OLE.pm is general purpose module and its aim is establish and maintain data exchange between client and server(s). On my opinion it's very doubtful that your problem is caused with bug in this module. -- С уважением, Сергейmailto:[EMAIL PROTECTED] ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: [OLE] QuitMessageLoop has no effect
[EMAIL PROTECTED] schrieb am 08.07.2005 20:40:56: > Hello, > > I am unable to get Win32::OLE::QuitMessageLoop working consistently: > sometimes it causes a prior Win32::OLE::MessageLoop call to terminate, > sometimes it does not. Responding to myself and thinking out loud: I compiled a debug version of OLE.dll to see what is going on under the hood. With respect to debug output, there is not much else to add to my previous message: the PostThreadMessage call in Initialize(...) returns success, yet the GetMessage-while-loop a few lines above does not receive the message. I found this tip, which seems related: http://www.devx.com/tips/Tip/14720 My working hypothesis is that the thread to which PostThreadMessage is posted is also the same thread which created the MSIE browser window, and that there is a second message loop somewhere which (sometimes) consumes the posted event. Perhaps someone could comment if the above sounds plausible and, if yes, what alternate mechanism I could use in OLE.dll to reliably break out of the MessageLoop? Best regards - Jan Ploski ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs