I am writing a VBA to write text in a third party program. There are 2 window class name with the same name "Edit" under "subwin" - "wxWindowNR".
I am able to send message to the first "Edit" but not the second one.
How am i able to send text to the second "Edit?
Sub writeTextOnWin()
Dim i As Long
Dim wClass As Object
hWnd = FindWindow(vbNullString, "mkvmerge GUI")
start_doc = ShellExecute(hWnd, "open", "C:\Program Files\MKVToolNix\mmg.exe", "", 0, SW_NORMAL)
If start_doc = 2 Then Exit Sub
If start_doc = 3 Then Exit Sub
Do
DoEvents
hwindow2 = FindWindow(vbNullString, "mkvmerge GUI v7.7.0 ('Six Voices') 64bit")
Loop Until hwindow2 > 0
mainWin = FindWindowEx(hwindow2, 0&, "wxWindowNR", vbNullString)
subWin = FindWindowEx(subWin, 0&, "wxWindowNR", vbNullString)
editWin = FindWindowEx(subWin, 0&, "Edit", vbNullString)
editWin2 = FindWindowEx(subWin, 0&, "Edit", vbNullString)
Call SendMessageByString(editWin, WM_SETTEXT, 0, "hello")
Call SendMessageByString(editWin2, WM_SETTEXT, 1, "hello again")
end sub