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

Re: Cannot WMGetText where control id is 1

Expand Messages
  • Dennis K. Paulsen
    If this is a copy and paste of your code, a couple of thoughts: * print $label should be print $label1 * There may be two controls on the form with the same
    Message 1 of 3 , Jul 14 6:37 PM
    • 0 Attachment
      If this is a copy and paste of your code, a couple of thoughts:

      * print $label should be print $label1

      * There may be two controls on the form with the same window id
      (0x1). If that is the case, you can specify the class name to
      FindWindowLike to constrain the search more..

      * Finally, FindWindowLike returns an array of window handles, not a
      single window handle, so specifying it as a parameter to WMGetText
      directly is not a good idea, even though it may seem to work..
      Better to use ($varname) = FindWindowLike(..) convention and use
      $varname in the WMGetText call.

      Regards,
      Dennis K. Paulsen


      > The problem I realised was when the control id happens to be 1. I
      > have two input text boxes in one of my windows. The control ids
      are 1
      > and 2. The foll code returns the value :
      >
      > my ($dlg) = FindWindowLike(0, "Threshold");
      > my ($label1) = WMGetText(FindWindowLike($dlg, "", "", 0x2));
      > print $label;
      >
      > But when I replace 0x2 with 0x1, nothing gets printed. Any
      thoughts?
      >
      > Regards,
      > -skanitkar
    • shsk7203
      Hi Dennis, Sorry, I didnt actually copy paste. Next time I ll make sure to do that. But putting in the classname worked! Though I still dont know why it
      Message 2 of 3 , Jul 14 10:32 PM
      • 0 Attachment
        Hi Dennis,


        Sorry, I didnt actually copy paste. Next time I'll make sure to do
        that.

        But putting in the classname worked!

        Though I still dont know why it wouldnt work without it. When I look
        at the windows open, there's just one by the Title "Threshold", and
        there's just one item under this with control id as 1.

        Thanks anyway,
        Regards,
        -skanitkar

        --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
        <ctrondlpaulsden@y...> wrote:
        > If this is a copy and paste of your code, a couple of thoughts:
        >
        > * print $label should be print $label1
        >
        > * There may be two controls on the form with the same window id
        > (0x1). If that is the case, you can specify the class name to
        > FindWindowLike to constrain the search more..
        >
        > * Finally, FindWindowLike returns an array of window handles, not a
        > single window handle, so specifying it as a parameter to WMGetText
        > directly is not a good idea, even though it may seem to work..
        > Better to use ($varname) = FindWindowLike(..) convention and use
        > $varname in the WMGetText call.
        >
        > Regards,
        > Dennis K. Paulsen
        >
        >
        > > The problem I realised was when the control id happens to be 1. I
        > > have two input text boxes in one of my windows. The control ids
        > are 1
        > > and 2. The foll code returns the value :
        > >
        > > my ($dlg) = FindWindowLike(0, "Threshold");
        > > my ($label1) = WMGetText(FindWindowLike($dlg, "", "", 0x2));
        > > print $label;
        > >
        > > But when I replace 0x2 with 0x1, nothing gets printed. Any
        > thoughts?
        > >
        > > Regards,
        > > -skanitkar
      Your message has been successfully submitted and would be delivered to recipients shortly.