Hi,
I am currently trying to write a vba code that will open up an application that I use in my job and send text to the main text box in that application.
After doing that, I need to open up another application which has a child window (By that I mean a sort of text box within the application, like the ones where you enter login details in certain applications), and send text over there. The last step I need to do is press a button that is to the left of the text window inside this application.
Since the computers in my work are locked from the normal internet and are classified I cannot use apps such as SPY++ to get the window handles, so I would appreciate it if anyone could help me find a way to get the window handles names without a third party app such as SPY++.
Since I am currently using a normal computer I have tried practicing this on the Outlook app and trying to send message to the login text boxes though it has not worked for me so far, this is the code I written up to now:
I am currently trying to write a vba code that will open up an application that I use in my job and send text to the main text box in that application.
After doing that, I need to open up another application which has a child window (By that I mean a sort of text box within the application, like the ones where you enter login details in certain applications), and send text over there. The last step I need to do is press a button that is to the left of the text window inside this application.
Since the computers in my work are locked from the normal internet and are classified I cannot use apps such as SPY++ to get the window handles, so I would appreciate it if anyone could help me find a way to get the window handles names without a third party app such as SPY++.
Since I am currently using a normal computer I have tried practicing this on the Outlook app and trying to send message to the login text boxes though it has not worked for me so far, this is the code I written up to now:
VBA Code:
Sub check()
hwnd = FindWindow(vbNullString, "Outlook")
Dim start_doc As Long
start_doc = ShellExecute(hwnd, vbunullstring, "Outlook", vbNullString, "C:\", SW_SHOWNORMAL)
If start_doc = 0 Or start_doc = 2 Or start_doc = 3 Or start_doc = 5 Or start_doc = 6 Or start_doc = 8 Or start_doc = 10 Or start_doc = 11 Or start_doc = 12 Or start_doc = 13 Or start_doc = 14 Or start_doc = 15 Or start_doc = 16 Or start_doc = 19 Or start_doc = 20 Or start_doc = 21 Then
MsgBox "Error Occured While Trying to Open The Application"
Exit Sub
End If
Do
DoEvents
hwindow2 = FindWindow(vbNullString, "Outlook")
Loop Until hwindow2 > 0
timeout 0.3
Dim lngHWnd As Long
lngHWnd = FindWindowEx(hwindow2, 0, vbNullString, vbNullString)
Do Until lngHWnd = 0
Debug.Print lngHWnd
lngHWnd = FindWindowEx(hwindow2, lngHWnd, vbNullString, vbNullString)
Loop
Call SendMessageByString(lngHWnd, WM_SETTEXT, 0, "Test")
End Sub