Say that I want to send a message to my WndProc, but I want to also send an integer.
SendMessage (m_hWnd, WM_DISPLAYCHANGE, NULL, int?);
My WndProc will receive it right? Then I want to send that lParam(integer) to a function.
case WM_DISPLAYCHANGE:
{
pD2DResources->OnRender(lParam);
}
break;
How do I send an integer as a lParam or wParam and then resend that integer to a function as a parameter?
LPARAM and WPARAM are just a typedef for long. So an int can be sent in as it is.
SendMessage(m_hWnd, WM_DISPLAYCHANGE, NULL, (LPARAM)yourInt)
In your wnd proc you could do
pD2DResource->Render((int)lParam)
As you are sending these custom information as a part of standard windows messages (message number below WM_USER) you should be careful to not pass the LPARAM values you receive in your window proc directly to DefWindowProc (default window proc) - because yourInt might have a special meaning for that particular standard windows message. Either you could pass in a fixed value from your window proc to the DefWindowProc or look at other ways to pass more than 4 byte of information through LPARAM/WPARAM. As SendMessage is synchronous, you could possibly pass address of a struct - just like many standard windows messages do.