case WM_MOUSEMOVE:
{
char buf[30];
wsprintf(buf, "Mouse X: %li Y: %li", LOWORD(lParam), HIWORD(lParam));
hdc = GetDC(hWnd);
TextOut(hdc, 10, 400, buf, strlen(buf));
ReleaseDC(hWnd, hdc);
}
my mouse x value has no problems, but the y value gives weird resutls sometimes, usually when i move the cursor to the upper right portion wherein i''ll get huge numbers or just plain weird values,
if i did this,
wsprintf(buf, "Mouse Y: %i X: %i", HIWORD(lParam), LOWORD(lParam));
ie, interchange it, then the x would be the one to give the weird result instead.,
many thanks,
i don't know if the problem is in my wsprintf(...) or in the WM_MOUSEMOVE..,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
wsprintf(buf, "Mouse X: %li Y: %li", long(LOWORD(lParam)), long(HIWORD(lParam)));
wsprintf expects 4-byte arguments for %li (ints, not shorts).
edit: clarified a bit.
[edited by - indirectx on July 5, 2002 12:53:46 AM]
wsprintf expects 4-byte arguments for %li (ints, not shorts).
edit: clarified a bit.
[edited by - indirectx on July 5, 2002 12:53:46 AM]
---visit #directxdev on afternet <- not just for directx, despite the name
The real question is, why are you using Unicode? Give sprintf() a spin.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
quote: Original post by ZealousElixir
The real question is, why are you using Unicode? Give sprintf() a spin.
that''s not unicode, that''s win32''s version of sprintf.
---visit #directxdev on afternet <- not just for directx, despite the name
Do not challenge my authority, f00. ''w'' stands for WIDE, not Win32. Wide chars = 16-bit = Unicode. *raspberry*
Word,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
Word,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
Actually, I do believe that swprintf() is the Wide character version and wsprintf() is the win32 partner.
I know only that which I know, but I do not know what I know.
I know only that which I know, but I do not know what I know.
I know only that which I know, but I do not know what I know.
Forgive my brashness.
Something still isn''t right though. What does the ''T'' in LPTSTR stand for?
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
Something still isn''t right though. What does the ''T'' in LPTSTR stand for?
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
TCHAR
edit: there are wsprinfA and wsprintfW, if you know what i'm talking about.
[edited by - indirectx on July 6, 2002 1:53:31 AM]
edit: there are wsprinfA and wsprintfW, if you know what i'm talking about.
[edited by - indirectx on July 6, 2002 1:53:31 AM]
---visit #directxdev on afternet <- not just for directx, despite the name
quote: Original post by ZealousElixir
'w' stands for WIDE, not Win32.
if you knew anything about unicode, you'd have known that in win32 'W' stands for WIDE when it's postfixed to the function name, and it is almost never mentioned in the docs (see ...A/...W macros). a notable exception is CommandLineToArgvW.
[edited by - indirectx on July 6, 2002 1:57:43 AM]
---visit #directxdev on afternet <- not just for directx, despite the name
ehm no, still same,
the value is something like this,
Mouse X: 50 Y: 50233 // last 3 number should not be included,
actually i think the numbers are alright, i just want to get rid of those unneseccary numbers,
thanks,
the value is something like this,
Mouse X: 50 Y: 50233 // last 3 number should not be included,
actually i think the numbers are alright, i just want to get rid of those unneseccary numbers,
thanks,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement