Jump to content
Sign in to follow this  
t123456

ControlSetText Not Working with MDI Form

Recommended Posts

t123456

Tried using ControlSend and it doesn't work, it acts like Send, eg, ignoring the handle.

I have a MDI form with a simple login. ControlSetText is putting the text in the right textboxes, but the application is not recognizing the text, "password" sould look like "*******" etc. And the okay button now says {space}

Here is a picture of what it looks like after I run the script.

Posted Image

Any way I can get this ap to recognize the keystrokes? Far as the program realizes, no text has been entered even though it appears. For example when I click the Okay button, it says, "You must enter in a user ID." even though it has "user" in the text box.

Here is my code:

#include <_EnumChildWindows.au3>
Local $sMessage = "OKAY"
Local $w, $sContent, $counter, $result
Local $hWnd="",$hControl=0,$sTitle=0,$sClass=0,$aEnumList
$w = Run("S:\PROG\util\proj.exe")
$hWnd = WinWait("PROG", "", 5)
Sleep(5000)
$aEnumList=_EnumChildWindows($hWnd,$hControl,$sTitle,$sClass)
$w = WinWait(get_handle($aEnumList, "proform", 1), "", 5)
Sleep(1000)
$hWin = get_handle($aEnumList, "JYACCmultitext", 1)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin,"","","user")
Sleep(1000)
$hWin = get_handle($aEnumList, "JYACCmultitext", 2)
Sleep(1000)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin, "", "", "password")
Sleep(1000)
$hWin = get_handle($aEnumList, "Button", 1)
Sleep(1000)
ControlFocus($hWin,"","")
Sleep(1000)
ControlSetText($hWin, "", "", "{Space}")
Exit 0

Func get_handle($aList, $sClass, $iIteration)
Local $h
For $i=1 to $aList[0][0]
if $aList[$i][1] = $sClass And $aList[$i][3] = $iIteration Then
    $h = $aList[$i][0]
EndIf
Next
Return $h
EndFunc
; from _EnumChildWindows.au3
;[0]|Handle|Classname|Control ID|Iteration|Title/Text
;[1]|0x001305F2|MDIClient|1|1|
;[2]|0x001D058A|proform|5000|1|USER LOGON
;[3]|0x0011056A|Static|0|1|AZTEC
;[4]|0x00100614|Static|0|2|COURT MANAGEMENT SYSTEM
;[5]|0x00170628|Static|6|3|User ID:
;[6]|0x000B0654|JYACCmultitext|7|1|
;[7]|0x001505A4|Static|8|4|Password:
;[8]|0x002205C2|JYACCmultitext|9|2|
;[9]|0x00130686|Button|10|1|     &OK
;[10]|0x002F0604|Button|11|2| &Cancel
;[16]|0x002105B4|msctls_statusbar32|59646|1|
;[17]|0x002B05B8|AfxControlBar42s|59419|1|
;[18]|0x000A0682|AfxControlBar42s|59422|2|
;[19]|0x00210606|AfxControlBar42s|59420|3|
;[20]|0x0016062A|AfxControlBar42s|59421|4
| Edited by t123456

Share this post


Link to post
Share on other sites
Melba23

t123456,

It sounds like there is some form of protection on that dialog - which is hardly surprising. ;)

Anyway, please read the Forum Rules - particularly the bit about not discussing login and security dialogs - before you post again. Thread locked. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×