|
-
Oct 3rd, 2006, 07:38 PM
#1
Thread Starter
Frenzied Member
Why SendKeys "(^C)" doesn't work?
The following works except when it gets to the last part, it doesn't copy the text that's in the text box that has the focus?
VB Code:
SendKey vbKeyReturn
SendKey vbKeyTab
SendKey vbKeyTab
SendKey vbKeyReturn
SendKey vbKeyTab
SendKey vbKeyTab
SendKey vbKeyTab
SendKeys "(^C)"
-
Oct 3rd, 2006, 07:52 PM
#2
Re: Why SendKeys "(^C)" doesn't work?
The correct format of sending CTRL+C is:
VB Code:
SendKeys "^{C}" '^ is outside {}
-
Oct 3rd, 2006, 08:58 PM
#3
Thread Starter
Frenzied Member
Re: Why SendKeys "(^C)" doesn't work?
Okay, I think we're getting somewhere but it's acting kinda funky. Basically, what happens is this. When I execute the code as I originally posted, but with your change, it only happens the second time. So, I hit the button on my app and it finds the app I'm looking for and goes through the various SendKey commands to get to the appropriate screen. Once on that screen, a particular textbox gets focus which is what I'm trying to copy with the CTRL C command via SendKeys. However, it doesn't seem to work then. It's only if I hit the button again on my app and then copies the text. So I don't know if it's some sort of memory release issue?
-
Oct 3rd, 2006, 09:02 PM
#4
Re: Why SendKeys "(^C)" doesn't work?
What does your Q have to do with the APIs? Looks like pure VB6 to me...
-
Oct 3rd, 2006, 10:02 PM
#5
Re: Why SendKeys "(^C)" doesn't work?
Sendkeys is flaky by nature. Use SendMessage and WM_GETTEXT.
-
Oct 4th, 2006, 07:22 AM
#6
Re: Why SendKeys "(^C)" doesn't work?
When the textbox gets the focus, is it selecting the text within it? If not, then you would have to implement that also for CTRL+C to work.
But as PG said, Sendkeys is not a good way of acheiving this goal. Rather use SendMessage API with the WM_GETTEXT message.
-
Oct 4th, 2006, 10:00 AM
#7
Re: Why SendKeys "(^C)" doesn't work?
You will also need to use FindWindow and FindWindowEx to get the textbox's window handle for use with SendMessage.
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 
-
Oct 4th, 2006, 11:38 AM
#8
Re: Why SendKeys "(^C)" doesn't work?
all of which was mentioned in your other thread
-
Oct 20th, 2006, 02:51 PM
#9
Addicted Member
Re: Why SendKeys "(^C)" doesn't work?
actually, wat is da textbox is sorta encrypted? like in win live messenger? so dat copyin is disabled? wat do u do then? wud it be da same?
-
Feb 9th, 2011, 06:34 AM
#10
New Member
Re: Why SendKeys "(^C)" doesn't work?
Hi,
How to send Numpad "+" keys in code. while trying to send as sendkeys ("{NUMPAD+}"). it just paste the wording in the code. i want the action of "+" keys to be triggered.
Please help me on this.
Regards,
Dinesh
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
|