WPARAM wparam
This is getting me pissed off, I cant pass WPARAM to another function.
I have my standard function:
LRESULT CALLBACK WindowProc (HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam)
{
}
notice the WPARAM wParam in there, and it works fine.
but if I want to pass that wParam to another function like:
LRESULT CALLBACK WindowProc (HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam)
{
MyFunction (wParam);
}
void MyFunction(WPARAM wParam)
{
//what ever in here
}
from the the function MyFunction I get the error
error C2275: ''WPARAM'' : illegal use of this type as an expression
I keep getting this damn thing! and its pissing me off hehe. Why does it work just fine the windows message handler function but now mine?
Possibility
I got to say.. I tried it and no complaints from the VC 6 compilier, even at level 4 warning
Is Function declared before you called it??. ie extern..
Is Function declared before you called it??. ie extern..
I can pass hWnd, uMsg, wParam, lParam to other functions and I don''t get any errors. I''m using lcc-win32.
Maybe you should post the contents of the function?
========================================================
If something sounds stupid but works, it's not stupid
Maybe you should post the contents of the function?
========================================================
If something sounds stupid but works, it's not stupid
Are you sure that you are passing things exactly as you example suggests?
The error code is likely to have been generated by you writing
WPARAM
when you meant to write
wParam
on the line where the error is reported or somewhere close by.
Regards,
Ralph Potter
ralph.potter@digital-magi.com, http://www.digital-magi.com
The error code is likely to have been generated by you writing
WPARAM
when you meant to write
wParam
on the line where the error is reported or somewhere close by.
Regards,
Ralph Potter
ralph.potter@digital-magi.com, http://www.digital-magi.com
Now, I dont have any types, hehe.
Here is what I have:
and I also have
class EVENTS_WINDOW Events_Window;
in my main.cpp just like my 200 other classes which all work fine.
and then in
Now I only get the error at the point in the class Events_Window where I declare the Message_Handler member function.
error C2275: 'WPARAM' : illegal use of this type as an expression
I cant figure out for the life of me why this wont work.
Possibility
Edited by - Possibility on June 2, 2000 1:53:58 PM
Here is what I have:
class EVENTS_WINDOW{public: void Message_Handler (WPARAM);};extern class EVENTS_WINDOW Events_Window;
and I also have
class EVENTS_WINDOW Events_Window;
in my main.cpp just like my 200 other classes which all work fine.
and then in
//-------- windows message handler --------------//LRESULT CALLBACKWindowProc (HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam){ switch (uMsg) { case WM_DESTROY: Cleanup(); PostQuitMessage(0); break; //get the mouse coordinates case WM_MOUSEMOVE: previous_mouse_x = mouse_x; previous_mouse_y = mouse_y; mouse_x = LOWORD(lParam);//x is contained in the lower 16 bits mouse_y = HIWORD(lParam);//y is contained in the upper 16 bits mouse_x_difference = mouse_x - previous_mouse_x; mouse_y_difference = mouse_y - previous_mouse_y; break; //the mouse buttons case WM_LBUTTONDOWN: GUI.bMouseButtonDown[0] = TRUE; GUI.buttonDown(); break; case WM_LBUTTONUP: GUI.bMouseButtonDown[0] = FALSE; GUI.buttonUp(); break; case WM_RBUTTONDOWN: GUI.bMouseButtonDown[1] = TRUE; GUI.buttonDown(); break; case WM_RBUTTONUP: GUI.bMouseButtonDown[1] = FALSE; GUI.buttonUp(); break; case WM_LBUTTONDBLCLK: break; //the keyboard keys case WM_KEYDOWN: Events_Window.Message_Handler(wParam); break; default: return DefWindowProc (hWnd, uMsg, wParam, lParam); } return 0L;}
Now I only get the error at the point in the class Events_Window where I declare the Message_Handler member function.
error C2275: 'WPARAM' : illegal use of this type as an expression
I cant figure out for the life of me why this wont work.
Possibility
Edited by - Possibility on June 2, 2000 1:53:58 PM
After looking at you posted code in miniaturised fonts, I am now squint eyed
Anyway, I can''t see what your problem is. Maybe in your prototype of Message_Handler, you should declare the WPARAM variable as well, as in WPARAM wParam, instead of only WPARAM.
Heck I doubt this will work but its still worth a try. In short, I have no idea why your code doesn''t work.
========================================================
If something sounds stupid but works, it's not stupid
Anyway, I can''t see what your problem is. Maybe in your prototype of Message_Handler, you should declare the WPARAM variable as well, as in WPARAM wParam, instead of only WPARAM.
Heck I doubt this will work but its still worth a try. In short, I have no idea why your code doesn''t work.
========================================================
If something sounds stupid but works, it's not stupid
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement