cancel
Showing results for 
Search instead for 
Did you mean: 

get access to ProfUIS controls

Highlighted
New Contributor

get access to ProfUIS controls

hello experts,



we have an mfc application which uses some ProfUIS controls like menubars, dockbars and so on. the problem is, i can not use methods like ClickItem oder SelectItem for those menubars. i can only use clicking by x-y-coordinates. we already compiled our application as opened but it does not work. 

is there any other solution to get access to ProfUIS controls. It would be great if there are some other solution because our application uses a lot of ProfUIS controls.




thanks in advance,

Quan

3 REPLIES 3
Highlighted
Staff

RE: get access to ProfUIS controls

Hi,



Here is a sample script that demonstrates how to work with ProfUIS controls by using Text Recognition:



Sub TextRecognitionSample

  ' Download the http://www.prof-uis.com/download/samples/win32/All_Prof-UIS_Samples.zip archive,

  ' unzip it and run the ProfStudio-m.exe sample

  Dim p, wMain, wMenu, strItem

  Set p = Sys.Process("ProfStudio-m")

  Set wMain = p.Window("Afx:400000:8*", "*")

  wMain.Activate

  Set wMenu = wMain.Window("ProfUIS-DockBar", "Menu bar").Window("ProfUIS-ControlBar", "Menu bar")

  strItem = "File|New"

  If ClickItem(wMenu, strItem) Then

    Log.Message "The '" & strItem & "' menu item was successfully clicked."

  End If

End Sub



Function ClickItem(wMenu, strItem)

  Dim p, arrayItem, menuItemObj, wSubMenu



  ClickItem = False

  arrayItem = Split(strItem, "|")

  If Not ClickChild(wMenu, "Text", arrayItem(0)) Then

    Exit Function

  End If

  Set p = getProcess(wMenu)

  Set wSubMenu = p.Window("Afx:400000:800*")

  If Not ClickChild(wSubMenu, "Text", arrayItem(1)) Then

    Exit Function

  End If

  ClickItem = True

  Log.UnlockEvents

  Log.Event "The '" & strItem & "' menu item was clicked."

End Function



Function ClickChild(wMenu, strProp, arrayItem)

  Dim menuItemObj

  ClickChild = False

  Log.LockEvents(1)

  Set menuItemObj = wMenu.FindChild(strProp, "*" & arrayItem & "*")

  If Not menuItemObj.Exists Then

    Log.UnlockEvents

    Log.Error "The '" & arrayItem & "' menu item was not found."

    Exit Function  

  End If

  menuItemObj.Click

  ClickChild = True

End Function



Function getProcess(obj)

  Do While Not IsSupported(obj, "ProcessName")

    Set obj = obj.Parent

  Loop

  Set getProcess = obj

End Function


BTW, you can vote for ProfUIS controls here.


------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Not applicable

RE: get access to ProfUIS controls

Hi all,



  I've tried the program but it doesn't work.I was not able to understand it very well.



  Could anyone help me understand it ?



  I'm trying to test an application written in SQLWindows 5.1 and it use ProfUIS components.



  Thanks in advance,



  Regards,



    Mauro Lopes
Highlighted

RE: get access to ProfUIS controls

Hi Mauro,



The script is more than four months old - it does not work with the current version of the sample.



The only observed way to work with Prof-UIS controls is to expose them by using the Text Recognition technology, so, before running the script, you need to add Afx:400000:4803*, ProfUIS-DockBar, ProfUIS-ControlBar and tooltips_class32 class names to the list of accepted windows as it is described in the Text Recognition Technology Support help topic. Also, I've made some modifications to the script, try using it:




' Before executing the TextRecognitionSample routine, download the 


' http://www.prof-uis.com/download/samples/win32/All_Prof-UIS_Samples.zip archive, 


' unzip it and run the ProfStudio-m.exe sample application.






Sub TextRecognitionSample


  Dim p, wMain, wMenu, strItem


  Set p = Sys.Process("ProfStudio-m")


  Set wMain = p.Window("Afx:400000:8*", "*")


  wMain.Activate


  Set wMenu = wMain.Window("ProfUIS-DockBar", "Text Editor").Window("ProfUIS-ControlBar", "Menu bar")


  strItem = "File|New"


  If ClickItem(wMenu, strItem) Then


    Log.Message "The '" & strItem & "' menu item was successfully clicked."


  End If


End Sub






Function ClickItem(wMenu, strItem)


  Dim p, arrayItem, menuItemObj, wSubMenu


  


  ClickItem = False


  arrayItem = Split(strItem, "|")


  If Not ClickChild(wMenu, "Text", arrayItem(0)) Then


    Exit Function


  End If 


  Set p = getProcess(wMenu)


  Set wSubMenu = p.Window("Afx:400000:4803*")


  If Not ClickChild(wSubMenu, "Text", arrayItem(1)) Then


    Exit Function


  End If  


  ClickItem = True


  Log.UnlockEvents


  Log.Event "The '" & strItem & "' menu item was clicked."


End Function






Function ClickChild(wMenu, strProp, arrayItem)


  Dim menuItemObj


  ClickChild = False


  Log.LockEvents(1)


  Set menuItemObj = wMenu.FindChild(strProp, "*" & arrayItem & "*")


  If Not menuItemObj.Exists Then


    Log.UnlockEvents


    Log.Error "The '" & arrayItem & "' menu item was not found."


    Exit Function  


  End If 


  menuItemObj.Click


  ClickChild = True


End Function





Function getProcess(obj)


  Do While Not IsSupported(obj, "ProcessName")


    Set obj = obj.Parent


  Loop


  Set getProcess = obj


End Function
--
Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors