Re: Problem with SendKeys ... please help!
Quote:
Originally Posted by JonnyPoet
Do you know a way to imitate this click on the icon ? Maybe this would be a workaround ?
As you have mentioned in Bold, if it's going to the wrong application ... well, to cross check this, I added debug.Print for GetForegroundWindow just before the SendKeys and it always returned the same hWnd as previous. So, it's clear that the same Window is active. Still, to make sure that SendKeys is going to the same Window, I used SetForegroundWindow with last active window hWnd (which is a module level variable, declared in the header) before SendKeys ... just to make sure that it sends key sequence to the same application window. But this did not work.
The only thing that I still feel is: I'm using the System Tray Form template from vbAccelerator. There is no logic behind it, but it might be the case that this Object steals the focus and as the form is not visible, GetForegroundWindow will not detect it. So, debug.print is actually the false information given back, saying that the same application window is active.
I'm trying to get the System Tray icon stuff ready in a Module and removing the Form template. Actually, I started working on this sort of application for my personal purpose thinking that it will be easy to accomplish; but it looks like a tricky one! Due to other business work, this project is delayed a bit, I know. But hey, though this is just for personal use, I'm going to take it very seriously; mainly because the problem is not solved yet! Let's see if we all together can get it done or not. (Hopefully Yes!)
-- Ruturaaj.
Re: Problem with SendKeys ... please help!
George,
Did you post your source code.
Someone's reply implied that you did, but I cannot find it ?
Thanks,
Rob
Quote:
Originally Posted by
George1111
You are not doing anything wrong
However, Microsoft have seen fit to block simple sendkey functions because they want to. (You can't even send ^C - you have to key it)
Try using your application within a VB program - No problems
Try using your program with NotePad - No problems
I ALSO have this problem as I have developed program which allows text case to be reversed (because you forgot to push the caps lock key before typing)
The problem lies in MS Word specifically - perhaps you are better to make a post to a site which specialises in MS Word quirks (and please - please report your findings back here if you get a good answer)
You are probably doing
1) Highlight the area of text
2)Press the Hotkey combination
3)Reverse case, whatever
4)Replace the text back where it came from
The idea being that all you have to do is hit ONE KEY at step 2
Another solution could be
1) Highlight the area of text
2)Press ^C on the keyboard
3)Press you Hotkey (grab the data from the clipboard - not from MSWord)
4)Reverse case, whatever
5)Move the new text back to the clipboard
6)Press ^V on the keyboard to replace the text
So the operator does
Highlight Text
^C
Hotkey press
^V
Bit messy but after all, you are trying to work with MS Word
I am sure that someone has the ability to come up with a solution - this is the ultimate application which solves the problem which affects millions of people very second of every day.
eg, The brilliance of the thousands of gurus at Microsoft has built this type of function into PARTS OF MS Word, but they think that everyone in the world just uses only word and one would never need this fundamental basic function in other programs such as "Code Guru Forums"
ie, THIS FUNCTION SHOULD BE AVAILABLE IN THE OPERATING SYSTEM !
Have a look at my feeble attempt to create the Hotkey Wonder
Once the program is launched the idea is to simply highlight text - then press F12 to give you Propercase or F11 to give you reversed case (I PLAYED AROUND WITH COMPLEX HOTKEY COMBINATIONS BUT THEY MAKE NO DIFFERENCE WITHIN WORD)
InCase.exe
You need this program In Case you make a mistake typing the CASE of words - so its called "InCase"
Cheers (Happy hunting for hoykeys !)
Now if Jonny Poet got hold of this problem in his teeth I am sure the problem would be resolved !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(I am happy to post my source code but I don't want all the gurus to fall on the floor laughing)
Re: Problem with SendKeys ... please help!
It is the attachment on the second post, named InCase.zip. You can download and unzip it.
Although it is there for the last three years it would still be good. ;)
Re: Problem with SendKeys ... please help!
Quote:
Originally Posted by
WoF
It is the attachment on the second post, named InCase.zip. You can download and unzip it.
Although it is there for the last three years it would still be good. ;)
Thanks for responding.
I had already downloaded that, and I just did it again to be certain.
All it contains is the file InCase.exe
Which will run and proves that it works.
However there are no other files in the zip, and no source code.
Regards,
Rob
Re: Problem with SendKeys ... please help!
Then, that should NOT be there. You took a great risk by running an EXE 'fr!om the WILD' as it were. Scan for malware immediately
Re: Problem with SendKeys ... please help!
Right. I must admit, I never looked into it...
Re: Problem with SendKeys ... please help!
Is This Thread still unresolved ?
I have played around with it a bit and it seems to work fine for me.