-
June 28th, 2009, 05:54 PM
#1
C++ Winapi - RegisterWindowMessage
I am trying to register:
Code:
UINT WM_USER_MOUSEMOVE = RegisterWindowMessage("uSer-mOuSeMoVe-mOuSeHoOk");
and using it here:
Code:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_USER_MOUSEMOVE:
{
and get error:
Code:
error: `WM_USER_MOUSEMOVE' cannot appear in a constant-expression|
when multiple examples say to use it like this. Any ideas? thanks.
-
June 28th, 2009, 09:41 PM
#2
Re: C++ Winapi - RegisterWindowMessage
Originally Posted by zaryk
I am trying to register:
Code:
UINT WM_USER_MOUSEMOVE = RegisterWindowMessage("uSer-mOuSeMoVe-mOuSeHoOk");
and using it here:
Code:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_USER_MOUSEMOVE:
{
and get error:
Code:
error: `WM_USER_MOUSEMOVE' cannot appear in a constant-expression|
when multiple examples say to use it like this. Any ideas? thanks.
You can not use the registered window message in Swith case. if you want to use in callback, compare with if condition..
for more please look at this thread
go through this thread, it will be clear
http://www.codeguru.com/forum/showthread.php?t=343079
-
June 29th, 2009, 06:17 AM
#3
Re: C++ Winapi - RegisterWindowMessage
Well, thats kinda lame. If message is UINT, and RegisterWindowMessage is UINT....I would think it would work in switch/case statement. Oh well. Thanks!
-
June 29th, 2009, 06:37 AM
#4
Re: C++ Winapi - RegisterWindowMessage
switch' case statement can only take CONSTANT INTEGERS!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|