Not sure what I am doing wrong:
Attempting to force a PASTE into another application
If I have the HWND of the application and force that application to focus using API calls should I not be able to use either sendkeys and or sendmessage to force a PASTE?
I am certain I have the correct HWND because the application does come into focus and is sitting on a textbox as the default control ... I can manually paste from the keyboard using ctrl-v but neither of the code attempts appear to work
Public Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function BringWindowToTop Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
dim AppHwnd as Long
dim apiRTN AS Long
AppHwnd = AppObj.HWND
apiRTN = BringWindowToTop( AppHwnd )
apiRTN = SetFocus ( AppHwnd )
Const WM_PASTE = &H302
apiRTN = SendMessage ( AppHwnd, WM_PASTE, 0 , BYVAL 0& )
OR
SendKeys "^V",0
Attempting to force a PASTE into another application
If I have the HWND of the application and force that application to focus using API calls should I not be able to use either sendkeys and or sendmessage to force a PASTE?
I am certain I have the correct HWND because the application does come into focus and is sitting on a textbox as the default control ... I can manually paste from the keyboard using ctrl-v but neither of the code attempts appear to work
Public Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function BringWindowToTop Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
dim AppHwnd as Long
dim apiRTN AS Long
AppHwnd = AppObj.HWND
apiRTN = BringWindowToTop( AppHwnd )
apiRTN = SetFocus ( AppHwnd )
Const WM_PASTE = &H302
apiRTN = SendMessage ( AppHwnd, WM_PASTE, 0 , BYVAL 0& )
OR
SendKeys "^V",0