LocusSolus LocusSolus - 2 months ago 25
Perl Question

How can I detect window resize event using Win32::GUI and WM_DISPLAYCHANGE?

I am struggling to make a simple receive

WM_DISPLAYCHANGE
informing my Win32::GUI app that the Windows Screen Resolution has changed, since the results for this question here is "0" accordingly informed by the search engine.

Could you provide a simple working example of a simple
Win32::GUI
program that detects a
WM_DISPLAYCHANGE
message and prints some info about that change in resolution?

Answer

From user "beech" at PerlMonks: http://perlmonks.org/index.pl?node_id=1171819

Try using the Hook method:

something like

$main->Hook( WM_DISPLAYCHANGE(), \&onDisplayChange );
sub onDisplayChange {
    my( $object, $wParam, $lParam, $type, $msgcode) = @_;
    print "Click handler called!\n";
}