|
-
Mar 11th, 2000, 06:16 AM
#1
Thread Starter
Hyperactive Member
Hi,
I can finally send data to the textboxes of a third party program, thanks to several examples from Aaron Young and vbapi.com. As usual, I have more questions.
How can I :
1. "SetFocus?" on the 3rd-party's textbox? It will not save the new data unless selected?
2. find out if the Parent is activated? I know its title.
3. find the handle of the parent via its title?
Finally, I would like a critique of the below. Be gentle as I'm only 10 months into VB and just starting trying to work with API's.
Thanks,
Al.
Code:
Public WinHandle()
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Const WM_SETTEXT = &HC
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Static winnum As Integer
winnum = winnum + 1
ReDim Preserve WinHandle(winnum)
WinHandle(winnum) = hwnd
EnumChildProc = 1
End Function
Sub Main()
Dim retval As Long
Parenthwnd = &H7FC
retval = EnumChildWindows(Parenthwnd, AddressOf EnumChildProc, 0)
EditData
End Sub
Private Sub EditData()
Dim sText As String
sText = "This is a test."
Call SendMessage(WinHandle(44), WM_SETTEXT, Len(sText), ByVal sText)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|