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

1760GetPopupHandle

Expand Messages
  • ls5302
    Mar 31, 2007
    • 0 Attachment
      I'd like to use the GetPopupHandle function to obtain the handle to
      the context menu within notepad. Unfortunately, like some earlier
      posts the function return zero and not the handle. The code I have so
      far is below (header removed). The context menu appears in the correct
      place but the handle is 0.

      Any help is most appreciated.

      Thanks

      system "start notepad.exe";
      sleep(1);

      @windows = FindWindowLike(undef, "^Untitled - Notepad");

      if (not @windows) {
      die "Could not find Notepad\n";
      } elsif (@windows > 1) {
      die "There might be more than one Notepad running\n";
      }

      ($lx,$ty,$rx,$by)=GetWindowRect($windows[0]);

      @children = GetChildWindows($windows[0]);

      if (not @children) {
      die "Could not find children of Notepad\n";
      }

      $hpopup=GetPopupHandle($children[0],($lx+$rx)/2,($ty+$by)/2);
      printf("hpopup: %d\n", $hpopup);

      $hpopup=GetPopupHandle($children[1],($lx+$rx)/2,($ty+$by)/2);
      printf("hpopup: %d\n", $hpopup);

      $hpopup=GetPopupHandle($windows[0],($lx+$rx)/2,($ty+$by)/2);
      printf("hpopup: %d\n", $hpopup);
    • Show all 3 messages in this topic