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

GetPopupHandle

Expand Messages
  • ls5302
    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
    Message 1 of 3 , Mar 31 2:46 PM
    • 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);
    Your message has been successfully submitted and would be delivered to recipients shortly.