|
Hi Masters!
--------------
I've asked this for 5 or 6 times since the last 3 days! But I've not get a correct answer yet.
Any way:
------------
I got a thread that doesn't show any window in it. This thread ends in an ordinary message loop.
On the other hand, within a DLL, I've posted a WM_KEYDOWN message with appropriate parameters to
that thread using PostThreadMessage() function.
Now what I expect is to get a WM_CHAR message within thread message loop, after tranlating WM_KEYDOWN
by TranslateMessage(); But It never happen and TranslateMessage fails all time!
If you need any information or clarification to answer me, just let me know. You may have my code if necessary.
Thank you masters!
|
|
|
|
|
Jusef Marzbany wrote: TranslateMessage fails all time!
Have you tried using GetLastError() to find out what goes wrong?
Besides that, what kinda weird things are you doing? You can install a system wide hook from within a DLL and control it (hook, unhook, etc.,) from an external app.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
No more extended error information is available for TranslateMessae() ...
and I'm already writing a system-wide keyboard hook!
By the way, I DO recive WM_KEYDOWN within the EXE part of my app; That's DLL has sent it correctly!
The problem lies in this that WM_KEYDOWN doesn't being translated. Please help me, I really need it.
Thank you masters!
|
|
|
|
|
Jusef Marzbany wrote: By the way, I DO recive WM_KEYDOWN within the EXE part of my app; That's DLL has sent it correctly!
Why is your DLL sending WM_KEYDOWN to your executbale?
Please explain your overall design and what exactly are you trying to achieve?
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
OK, here we go!
My goal is to design a system-wide keyboard hook. This app. consists of two parts:
1) An EXE file with one sigle thread ended in an ordinary message loop.
2) A DLL that installs the keyboard hook.
When a key is pressed any where in the system, the DLL catchs it, but with
a little information about it (that's almost a bare virtual-key as wParam).
Now It's my turn! I send this recived messages to the EXE using
PostThreadMessage, like this :
PostThreadMessage(g_dwThreadID, WM_KEYDOWN, lParam, wParam);
where g_dwThreadID is the ID of the mentioned thread, lParam and wParam are the same parameters as recieved by KeyboardProc.
And finally, within the EXE file, WM_KEYDOWN needs to be translated to get a WM_CHAR; But every things
go wrong from now on, because of TranslateMessage() ...
Thank you masters!
modified on Tuesday, September 16, 2008 4:02 AM
|
|
|
|
|
Jusef Marzbany wrote: When a key is pressed any where in the system, the DLL catchs it, but with
a little information about it (that's almost a bare virtual-key as wParam).
Now It's my turn! I send this recived messages to the EXE using
PostThreadMessage, like this :
PostThreadMessage(g_dwThreadID, WM_KEYDOWN, lParam, wParam);
Do you send all the messages that are generated on a key press to your EXE?
Regards,
Sandip.
|
|
|
|
|
Jusef Marzbany wrote: My goal is to design a system-wide keyboard hook. This app. consists of two parts:
1) An EXE file with one sigle thread ended in an ordinary message loop.
2) A DLL that installs the keyboard hook.
When a key is pressed any where in the system, the DLL catchs it, but with
a little information about it (that's almost a bare virtual-key as wParam).
Fair enough.
Jusef Marzbany wrote: Now It's my turn! I send this recived messages to the EXE using
PostThreadMessage, like this :
Why do you need to send this to the Executable again? Why can't you write your code in the DLL itself? That's the whole idea of having system-wide hooks in a DLL. What if your executable is minized? Your design looks flawed.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
The problem is how to translate a virtual-key into an Ascii or Unicode value, not where to do that.
Please direct me to the right way on translating a virtual-key into it's equivalent in Ascii or Unicode!
Thank you masters!
|
|
|
|
|
Jusef Marzbany wrote: The problem is how to translate a virtual-key into an Ascii or Unicode value, not where to do that.
Trust me, you don't want to put this stuff up into an executable. What about modularity? What happens when your executable is not having the focus?
Jusef Marzbany wrote: Please direct me to the right way on translating a virtual-key into it's equivalent in Ascii or Unicode!
Check out ToAsciiEx[^].
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Hi!
When I run my VC++ Program, it crashes and displys "Unhandled Exception in mt.exe". It's a repost only. Sorry. I'm fighting with this exception too frequently. The previous reply was to reinstall VC++. I've done that also. The problem was quite for a week. Then it occurs occasionally. My previous post is in this link:
http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=2709734[^]
How to resolve this exception?
|
|
|
|
|
Did you check your system for viruses?(error is c101008d)?
|
|
|
|
|
I've installed AVG8.0 Free Edition and do scans periodically. There is no threats found. What else should I do?
|
|
|
|
|
T.RATHA KRISHNAN wrote: Sorry. I'm fighting with this exception too frequently.
Is this issue happening only for some specific project or for all projects?
Regards,
Rane
|
|
|
|
|
Hi All
I need to do program for XML reading and writing.I searched in NET but no budy mention clearly.I done one program but thats reading char by char.I need to read full file and then write.Please give me link or if possible code.
Thanx in Advance
Mohan.T
Mohan t working for S/W Company
|
|
|
|
|
|
Try this out[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I used tinyXML[^] before. It's a nice little library and quite easy to use.
|
|
|
|
|
Display text with some color in CProgressCtrl VC6,
|
|
|
|
|
|
Here is an example.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
How can I change the name of existing registry key?
|
|
|
|
|
MPTP wrote: How can I change the name of existing registry key?
By writing a program?
On a serious note, see CRegKey[^] and Registry Functions[^]
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Which function is to be used?
|
|
|
|
|
For start see CRegKey::Open.
|
|
|
|
|
Rajesh R Subramanian wrote: On a serious note, see CRegKey[^] and Registry Functions[^]
Are you being facetious?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|