Help: What am I doing wrong? 
Author Message
 Help: What am I doing wrong?

Hi everybody!

I wanted to use the API-call SendMessageByString to pass a string from my VB
Application to a textbox in an HTML-Form.
But the only thing I can do is to change the text of the window.
What am I doing wrong? Can someone help me, please?

I got the window-handle (hwnd) and then use the SendMessageByString in this
context to pass "Test" to the textbox:

SendMessageByString(hWnd, WM_SETTEXT, 0, "Test")

May it be possible that I rather should use SendMessage instead?
Have you got an answer?

Thanks a lot!
Best wishes,
Eric



Fri, 13 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
If I'm not mistaken, You need to get the hWnd of the textbox itself and pass it
that way. Since you've found the main window, use FindWindowEx or similar API to
loop through all the other controls on that form until you've found the one you
want.

Matt

Quote:

> Hi everybody!

> I wanted to use the API-call SendMessageByString to pass a string from my VB
> Application to a textbox in an HTML-Form.
> But the only thing I can do is to change the text of the window.
> What am I doing wrong? Can someone help me, please?

> I got the window-handle (hwnd) and then use the SendMessageByString in this
> context to pass "Test" to the textbox:

> SendMessageByString(hWnd, WM_SETTEXT, 0, "Test")

> May it be possible that I rather should use SendMessage instead?
> Have you got an answer?

> Thanks a lot!
> Best wishes,
> Eric



Fri, 13 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
You should be able to get the handle of the edit control of a combo by
calling :-

GetWindow( hWndCombo, GW_CHILD )

AS for the list box part, it belongs to the parent and not the combo so
you need to do a little more work :-

Detect WM_PARENTNOTIFY
Check LoWord( wParam ) = WM_CREATE
Cast lParam to hWnd to get hWndChild
Init a buffer string, say sClassName, to length 32
Call GetClassNameA(hWndChild, sClassName, 32)
Check sClassName = 'ComboLBox'
if so the list box handle = hWndChild

I'm not strictly speaking a VB programmer, so I can't give you a VB
example. Sorry!

Mark



Sat, 14 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
Hi Mark!

Thanks a lot for your help.
Your idea is great, 'cause I want to get this hwnd of the only existing
textbox (editbox) in that window...
But somehow, I can't get the hwnd...GetWindow returns some hwnd... but none
of it works...hmmm... :-((
Do you know the classname of textboxes (editboxes)?

Many thanks and best wishes,
Eric



Quote:
> You should be able to get the handle of the edit control of a combo by
> calling :-

> GetWindow( hWndCombo, GW_CHILD )

> AS for the list box part, it belongs to the parent and not the combo so
> you need to do a little more work :-

> Detect WM_PARENTNOTIFY
> Check LoWord( wParam ) = WM_CREATE
> Cast lParam to hWnd to get hWndChild
> Init a buffer string, say sClassName, to length 32
> Call GetClassNameA(hWndChild, sClassName, 32)
> Check sClassName = 'ComboLBox'
> if so the list box handle = hWndChild

> I'm not strictly speaking a VB programmer, so I can't give you a VB
> example. Sorry!

> Mark



Sun, 15 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
Hi Matt!

Thanks so much for your help! That's exactly what I need!
I was trying to loop through the controls in the window, but I was not able
to get any hwnd - always a 0 (probably 'cause I don't know the classname for
textboxes in FindWindowEx...).
There is only one textbox (editbox) in that window and I like to get it's
hwnd. Do you know, how to get this?

I would be very thankful, if you got an answer and could help me!

Many thanks and best wishes,
Eric



Quote:
> If I'm not mistaken, You need to get the hWnd of the textbox itself and
pass it
> that way. Since you've found the main window, use FindWindowEx or similar
API to
> loop through all the other controls on that form until you've found the
one you
> want.

> Matt


> > Hi everybody!

> > I wanted to use the API-call SendMessageByString to pass a string from
my VB
> > Application to a textbox in an HTML-Form.
> > But the only thing I can do is to change the text of the window.
> > What am I doing wrong? Can someone help me, please?

> > I got the window-handle (hwnd) and then use the SendMessageByString in
this
> > context to pass "Test" to the textbox:

> > SendMessageByString(hWnd, WM_SETTEXT, 0, "Test")

> > May it be possible that I rather should use SendMessage instead?
> > Have you got an answer?

> > Thanks a lot!
> > Best wishes,
> > Eric



Sun, 15 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
Seems as if, apparently, combos create the edit controls using the ID 1001.
They are of the standard EDIT classname. So GetDlgItem( Combo1.hWnd, 1001 )
will return the edit control portion.

If you need to send a msg to it, just use the API prototype
SendDlgItemMessage( Combo1.hWnd, 1001, msg, wParam, lParam )

Have Fun!



Mon, 16 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
Here is a little example.

--------------------------------------

Private Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal
nIDDlgItem As Long) As Long
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

Private Const WM_SETTEXT = &HC

Private Sub Command1_Click()
    Dim hWndChild As Long

    hWndChild = GetDlgItem(Combo1.hwnd, 1001)

    Call SendMessage(hWndChild, WM_SETTEXT, 0, ByVal "Hello There")
End Sub



Mon, 16 Sep 2002 03:00:00 GMT  
 Help: What am I doing wrong?
Hi Mark!

So many thanks again!
Your idea was nearly the solution but it only works, if I know or can
retrieve the handle of the Combo...
As my textboxes (e.g. on an HTML-form in the IE5) are not necessarily a part
of a combo and are not part of a (known) VB-Form it is not possible to use
the Combo.hwnd.
So, where do I get the handle of the textbox in any window from?

Thanks so much for your time and help!
Best wishes,
Eric



Quote:
> Seems as if, apparently, combos create the edit controls using the ID
1001.
> They are of the standard EDIT classname. So GetDlgItem( Combo1.hWnd,
1001 )
> will return the edit control portion.

> If you need to send a msg to it, just use the API prototype
> SendDlgItemMessage( Combo1.hWnd, 1001, msg, wParam, lParam )

> Have Fun!



Tue, 17 Sep 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. HELP: what am i doing wrong??

2. HELP: what am i doing wrong??

3. HELP - What Am I Doing Wrong

4. HELP: what am i doing wrong??

5. Help with syntax. What am I doing wrong

6. Help on GPF...what am I doing wrong???

7. What am i doing wrong here????? HELP

8. Recordset: What am I doing wrong?

9. What am I doing wrong??

10. What am I doing wrong?

11. What am I doing wrong?

12. What am I doing wrong?

 

 
Powered by phpBB® Forum Software