|
-
Jul 31st, 2005, 11:02 PM
#1
Thread Starter
Need-a-life Member
SendMessage
How do you send an "ENTER" to an external's (another app) textbox without using SendKeys?. TIA,
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jul 31st, 2005, 11:14 PM
#2
Re: SendMessage
VB Code:
SendMessage hWndTextbox, WM_CHAR, (vbKeyReturn), 0
-
Aug 1st, 2005, 01:22 AM
#3
-
Aug 1st, 2005, 06:49 AM
#4
Thread Starter
Need-a-life Member
Re: SendMessage
 Originally Posted by |2eM!x
VB Code:
SendMessage hWndTextbox, WM_CHAR, (vbKeyReturn), 0
I could not make it work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 1st, 2005, 06:55 AM
#5
Re: SendMessage
Try WM_KEYDOWN, followed by WM_KEYUP, using VK_RETURN (vbKeyReturn).
so
VB Code:
Const WM_KEYDOWN = &H100
Const WM_KEYUP = &H101
'--------
SendMessage hWnd, WM_KEYDOWN, 13, 0
SendMessage hWnd WM_KEYUP, 13, 0
-
Aug 1st, 2005, 10:29 PM
#6
Thread Starter
Need-a-life Member
Re: SendMessage
Didn't work either. Besides... I'm having problems finding the handles automatically. Any ideas what could I be doing wrong?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 1st, 2005, 10:34 PM
#7
Re: SendMessage
Even harder if we can't see what you are trying to do.
It won't work if you use the wrong handle.
-
Aug 1st, 2005, 11:05 PM
#8
Re: SendMessage
keybd_event is the same as a SendKeys since they both require the receiving app to have focus.
Try using PostMessage maybe.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 11:05 PM
#9
Thread Starter
Need-a-life Member
Re: SendMessage
 Originally Posted by dglienna
Even harder if we can't see what you are trying to do.
It won't work if you use the wrong handle. 
Since I cannot get the handle (the last step is the problem) I'm inputboxing it. I can write some text to the textbox... so the handle is inputted (manually) correctly, but the ENTER is not working. This is my code:
VB Code:
tWindow = FindWindowEx(lhWnd, 0&, "AfxControlBar42s", "Watches")
tWindow = FindWindowEx(tWindow, 0&, "AfxWnd42s", "Output Window")
tWindow = FindWindowEx(tWindow, 0&, "Afx:400000:8", vbNullString)
hWndTextbox = FindWindowEx(tWindow, 0&, "Edit", vbNullString)
'hWndTextbox remains equals to 0.
SendMessage hWndTextbox, WM_SETTEXT, -1, ByVal sMsg
SendMessage hWndTextbox, WM_KEYDOWN, 13, 0
SendMessage hWndTextbox, WM_KEYUP, 13, 0
The message (sMsg) is written correctly, but the ENTER does not work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 1st, 2005, 11:07 PM
#10
Thread Starter
Need-a-life Member
Re: SendMessage
 Originally Posted by RobDog888
keybd_event is the same as a SendKeys since they both require the receiving app to have focus.
Try using PostMessage maybe.
I cannot use SendKeys because when this other app is activate, the focus is not on the textbox it should.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 1st, 2005, 11:09 PM
#11
Re: SendMessage
Oh its a textbox control. Then it doesnt accept an enter as a valid character unless you have a multiline textbox. What control is supposed to receive the enter keypress?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 11:10 PM
#12
Re: SendMessage
 Originally Posted by Mc Brain
I cannot use SendKeys because when this other app is activate, the focus is not on the textbox it should.
Correct, thats why I mentioned that keybd_event will NOT work because of its similarities with SendKeys.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 11:20 PM
#13
Re: SendMessage
Can't you just click on a button instead of pressing Enter?
-
Aug 1st, 2005, 11:34 PM
#14
Re: SendMessage
 Originally Posted by dglienna
Can't you just click on a button instead of pressing Enter?
The Edit class of window is a Textbox control and not a command button. I am wondering myself where the enter keypress fits into this?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2005, 12:14 AM
#15
Re: SendMessage
Im sorry, mine works for RTB's
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
|