|
Why don't you try to go deeper with the debugger? For instance, whenever the TranslateMessage fails, check out the details of the MSG structure.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Jusef Marzbany wrote: 1- where's WM_KEYUP?
You stated:
"I recieved WM_KEYUP as well as WM_KEYDOWN in my
message loop and I'm sure about that ..."
So you weren't actually getting both the messages before?
As cPallini mentioned, you'll need to debug this.
You're trying to force messages that are system messages.
Unless you do it the exact way the system does, it's not
going to work. That's why I said it's problematic.
TranslateMessage could be failing because you're not emulating the
system messages properly.
Keyboard input was never meant for multiple targets on Windows.
Only the one window with keyboard focus should get the key messages.
You may want to try posting messages to a window instead of
a thread.
Tip: Don't use MessageBox in the message loop!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you, Great
Thank you masters!
|
|
|
|
|
Does PostThreadMessage() succeed? Is the g_dwThreadID identifier valid?
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
Yes, It is ...
As I mentioned before, everything went fine and I recieved WM_KEYDOWN and WM_KEYUP ...
But TranslateMessage( ) fails ...
|
|
|
|
|
Apologies; in that case Mark's advice seems a good way to go.
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
Hi all,
in my application i am using the GetRawInputDeviceInfo and included the winuser.h and windows.h but it is saying
GetRawInputDeviceInfo' : undeclared identifier
can anyone tell the reason for this issue?
Thanks in advance..
modified on Saturday, September 13, 2008 1:05 PM
|
|
|
|
|
Hi all,
inmy application i have used the message shwon in the following line :
ON_MESSAGE(WM_INPUT, OnInput)
I am getting the error "WM_INPUT' : undeclared identifier"
can anybody tell me wat this error is and how i need to solve this???
|
|
|
|
|
"Minimum operating systems Windows XP"
Do you have the appropriate symbols defined for OS version in your stdafx.h file? Make sure they are 0x0501 to ensure the xp specific symbols get defined during compilation. Make sure to do a "Rebuild Solution" or equivalent to prevent any false negatives.
|
|
|
|
|
can you tell me clearly how to do that?
|
|
|
|
|
Most newer VC++ IDE's will place some version defines at the appropriate place in your stdafx.h file to ensure the symbols for the version of windows or IE your targeting get defined. You mentioned that you are using VC++ 6.0 in another thread so you will need the February 2003 Platform SDK in place for Windows XP symbols. (How to get the Platform SDK and getting it installed are described elsewhere on this site).
To get the symbols defined, you need to define the correct version symbols on newer IDE's. Sometimes with the Platform SDK installed and the directories listed in the proper order, you sometimes get the symbols without needing to define the symbol. (This might be due to a default version getting defined). If you still don't get the symbols defined that you desire, you can always try defining the version symbols explicitly like newer IDE's do in the stdafx.h file (I would try putting just the WINVER in, then _WIN32_WINNT, and so on until you get the symbols you need)...
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
|
|
|
|
|
Did you include Winuser.h, Windows.h?
|
|
|
|
|
Hi all,
in my MFC application i want to use the message WM_INPUT but i am not able to see this in the classs wizard,can any one suggest me how to get that????
|
|
|
|
|
Which version of Visual C++ are you using?
|
|
|
|
|
|
Sometimes in VC++ 6.0 you can go to the "Class Wizard", "Class Info" tab, and mess with the "Message Filter" in the "Advanced Options" section to get some messages to appear but I think the WM_INPUT message will not show since the Visual C++ 6.0 IDE was built before XP came out. I would doubt the WM_INPUT would show up on newer IDE's but I can only check up to VC++ 2003 and so far I cannot get the wizard to show it.
You will likely need to add the handler manually but first you will need the appropriate symbols. Anything that says it requires XP will likely mean you will need the February 2003 SDK (or something close in date but not later since this was the last SDK to be officially compatible with VC++ 6.0) for the required symbols in a Visual C++ 6.0 environment. How to get the SDK used to be posted all over the place but Microsoft tends to make it difficult to find stuff after it's lifecycle is declared over. You might be able to define the symbols yourself without the SDK but that is really beyond the scope of your question.
I really liked VC++ 6.0 IDE but I must admit that you should probably move up to a newer IDE if you are going to try and use functionality introduced with Windows XP. It is very painful to use VC++ 6.0 with newer features even with the Platform SDK installed.
I hope that helps.
|
|
|
|
|
Hi all,
I am new to the concepts on vc++, in my application i want to get the external hid device name connected to the system.
can anybody suggest me the right approach for doing this???
|
|
|
|
|
Hi,
I made a simple SDI application with only 2 events. The OnMouseMove
and onLButtonDown. Either of these I wrote a simple TRACE output of their
XY coordinates as shown bellow :
CString str;
str.Format("onMouseMove X=%d Y=%d \n",point.x,point.y);
TRACE (str);
The strange thing is that, some times and not everytime, when I press the left mouse button (without any movement - I checked this many times) at a specific XY coordinates let's say at 100,100 the mouse get slightly moved 1 pixel to the right or to the left ie 99,100. So the onLButtonDown reports a different XY from that is supposed to be.
I know that someone can say that I might move the mouse cursor without knowing but that's not true. I checked this many times and I found it very annoying since I use this for checking 1-pixel thumb nails.
Is there any recommendation? I use VC9 and SDI. I did not tested this with VS6 or older version.
Regards,
George
sdancer75
|
|
|
|
|
The last coordinates you get in a mouse move message aren't
necessarily going to be the same as the coordinates when you
stop moving the cursor.
You should use GetCursorPos to get the current position, not rely
on the coordinates from WM_MOUSEMOVE.
sdancer75 wrote: 1-pixel thumb nails.
Really?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark for you help.
I know that 1 pixel thumb-nail sounds extreme and I will try to make it up
but is used in a timeline control where 1 pixel corresponds to 1 second and a slice
might have only 1 second duration which as I already said coresponds to 1 pixel width.
Anyway, you suggest that I should ingore the XY coordinates I get from the WM_MOUSEMOVE
and check all over the time the GetCursorPos either on MouseMove or LButtonDown events? Is that a slow method?
I did not find anything related to this in the MSDN. I suppose you have right, but I can not understand why the XY-coords
are given from the above events, if they are unreliable.
Best Regards,
George
sdancer75
|
|
|
|
|
sdancer75 wrote: I can not understand why the XY-coords
are given from the above events, if they are unreliable.
They're reliable but they reflect the cursor position at the
time the message is created and dispatched. Since there's no
WM_MOUSESTOP message, it's not always possible to get the actual
current cursor position from the last received WM_MOUSEMOVE
message.
sdancer75 wrote: check all over the time the GetCursorPos either on MouseMove or LButtonDown events? Is that a slow method?
I personally use GetCursorPos() in all my mouse message handlers.
The mouse is a relatively slow device, so the time it takes to
call GetCursorPos() is insignificant.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you very much Mark,
You saved me from a many hours trying to find what's going worng here.
I thought that it was my bug and I have already spend about 3 days of work trying to fix this, before I ask for help to this forum.
Take care,
Greece
sdancer75
|
|
|
|
|
Hi
Is there any C++ project or toolkit for solving math equations?
or a good article?
www.logicsims.ir
|
|
|
|
|
There's Google , a powerfult toolkit for answering such a question [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sounds like someone's having trouble with their homework
|
|
|
|