Loading ...
Sorry, an error occurred while loading the content.

393Problem with SendMessage()

Expand Messages
  • s03nk3
    Jan 26, 2004
    • 0 Attachment
      Hi,

      recently I discovered Win32::Guitest - thx for wríting this module!

      But currently, I'm stuck with sending a simple Buttonclick:

      --------- 8< --------

      #!perl

      #use strict;
      use Win32::GuiTest qw(FindWindowLike SendMessage SetActiveWindow);
      use Win32::API;

      my $WM_USER = 0x0400;
      my $BM_SETSTATE = 0x00F3;
      my $BM_CLICK = 0x00F5;
      my $WM_LBUTTONDOWN = 0x0201;
      my $WM_LBUTTONUP = 0x0202;
      my $MK_LBUTTON = 0x0001;

      $Win32::GuiTest::debug = 1; # Set to "1" to enable verbose mode

      my @windows = '';
      my $status = '';

      @_ = FindWindowLike(0, "^eMule");
      for (@_) {
      @windows = FindWindowLike($_, "^Reload");
      for (@windows) {
      my $hwnd = $_;
      $status = SendMessage($hwnd, $BM_Click, 0, 0);
      print "\n $status "; # Debug
      $status = SendMessage($hwnd, $BM_SETSTATE, 1, 0);
      print "$status "; # Debug
      $status = SendMessage($hwnd, $WM_LBUTTONDOWN, $MK_LBUTTON, 0);
      print "$status "; # Debug
      $status = SendMessage($hwnd, $WM_LBUTTONDUP, $MK_LBUTTON, 0);
      print "$status :: $hwnd found\n"; # Debug
      }
      }

      --------- >8 --------

      The window handle returned by FindWindowLike() is correct (verified
      with Spy&Capture (http://kobik.videodot.net/spy_capture.asp)), but my
      W32 application doesn't receive the message with this "fake" click.

      Please be so kind as to tell me where I'm wrong, as I'm not familiar
      with Windows programming.

      Bye,
      Soenke J. Peters
    • Show all 2 messages in this topic