|
Chesnokov Yuriy wrote: But on every reply there are two choices: 'Was this a good answer to your question? Yes No'
There is a third option of not clicking on anything, if you were unable to explain your problem the right way at the first place.
And if you hadn't known that, YES, the votes considerably degrades the status - which we don't care about. Actually, what is annoying is - someone who is a fellow MVP, keeps on low-voting you, without even explaining the problem properly and the problem has something to do with the very fundamentals of the language.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Have you added file.c to your project?
|
|
|
|
|
don't know who voted us '1', but I countered yours up.
|
|
|
|
|
toxcct wrote: but I countered yours up.
Thanks. I already incremented yours..
|
|
|
|
|
toxcct wrote: don't know who voted us '1',
I know[^]
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Trolls all around. Just squaring off the low-vote.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Thanks
|
|
|
|
|
|
|
I'm not sure if the other answers help, but I think you are missing the extern and extern "C" keyword.
Iain.
# ifdef __cplusplus
extern "C"
{
# endif
extern int somefunc (int a);
# ifdef __cplusplus
}
# endif
#include <other.h>
int somefunc (int a)
{
...
return ...
}
...
#include "other.h"
...
bool CSomeClass::SomeFunc (int b)
{
int c = somefunc (b);
...
}
|
|
|
|
|
|
|
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
|
|
|
|