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.
Re: C++ Winapi - RegisterWindowMessage
Quote:
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
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!
Re: C++ Winapi - RegisterWindowMessage
switch' case statement can only take CONSTANT INTEGERS!