用SendMessage()向窗口发送消息时,如何传递参数,
例如:把字符串“asdfsad”作为参数?
SendMessage()有两种:mfc的CWindow的成员和API函数
CWindow::SendMessage
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam );
例如:把字符串“asdfsad”作为参数?
SendMessage()有两种:mfc的CWindow的成员和API函数
CWindow::SendMessage
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam );
SendMessage(WM_MYMSG,0,(LPARAM)pChar);
::sendMessage(hWnd,WM_MSG,0,(LPARAM)&pChar);
------------------?
SendMessage(WM_MYMSG,0,(LPARAM)pChar);
在消息处理函数中再把pChar转换过来就行了
LPARAM lParam
这两个就是消息的参数,在消息处理中将他们转换成需要的就可以了