Forum Discussion

anuprai29's avatar
anuprai29
Occasional Contributor
10 years ago

Returns a LONG integer value created from two SHORT integers.

Hi,

 

Is there anyway in VBScript to Returns a LONG integer value created from two SHORT integers.

 

e.g: I have two co-ordinates X and Y and I want to convert these two interger value in a single value.

 

Thanks 

  • HKosova's avatar
    HKosova
    10 years ago

    Hi Anup,

    Here you are:

     

    Call PostMessage(..., MakeLParam(739, 441))
    
    Function MakeLParam(x, y)
      MakeLParam = (x And &HFFFF&) Or (y * &H10000)
    End Function

     

    But I still recommend using DblClick, because it does all the extra work for you - like bring the window to front, make sure it can receive clicks (that is, not overlapped by a modal window), and so on. Maybe DblClick just needs different coordinates. Try recording the click and see how it's recorded.

  • Hi,

    I'm not sure what the value of why it is necessary to convert the result to a long, as VBScripts variant variables should be able to cope with it anyway.

    Variables can be converted to a long integer using clng(expression).

    • anuprai29's avatar
      anuprai29
      Occasional Contributor

      Hi,

       

      I'm having screen co-ordinates X and Y and want to use that values in a single integer value to pass as a parameter in.

      PostMessage() method for click on a X,Y co-ordinates.

      eg.

       

      PostMessage (hWnd, WM_LBUTTONDBLCLK, MK_LBUTTON,  (739, 441))

       

      where WM_LBUTTONDBLCLK = 515, MK_LBUTTON = 1 

       

      and 4rth parameter that I want to convert in a single long interger value.

       

      Please suggest me.

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        TestComplete has built-in methods for mouse clicks. Try DblClick:

         

        obj.DblClick(739, 441);