0

The problem is below:

SendMessage(hwnd_SSMAIN_PARENTCONTAINER_RTFCONTROL,WM_SETTEXT,(WPARAM)0,(LPARAM&)webfilebuffer.str());
  1. hwnd_SSMAIN_PARENTCONTAINER_RTFCONTROL is an handle to an rtf control
  2. webfilebuffer is type stringstream

and compiles fine within dev c++ with an older version of gcc.

I just now updated to code blocks and used the import command from the file menu for dev c++ projects.

Now within code blocks I get this error for the send message above:

E:\Projects\PWS Source Studio 7-18-12\open-save-new dialog.h|94|error: invalid cast of an rvalue expression of type 'std::basic_stringstream::__string_type {aka std::basic_string}' to type 'LPARAM& {aka long int&}'|

I just now started to use the newer version of the gcc MinGW.

I looked this error up online and found nothing about it, if I just look up "invalid cast of an rvalue expression of type " instead of "invalid cast of an rvalue expression of type 'std::basic_stringstream::__string_type {aka std::basic_string}' to type 'LPARAM& {aka long int&}'|"

I find a couple of things on google which I tried to do that line above but it seems like no matter what I try to do it doesn't work.

From the looks of it I can no longer convert the str to lparam and that it will only accept lparam for now own ie it must be something like LPARAM something;

instead of string something; and then converting that to lparam for send message to accept this.

Can someone please explain to me what is going on and what I need to do to get this to work?

Thank you

4

1 回答 1

0

这样做

SendMessage(hwnd_SSMAIN_PARENTCONTAINER_RTFCONTROL,WM_SETTEXT,(WPARAM)0, 
    (LPARAM)webfilebuffer.str().c_str());

此代码将 char* 转换为 LPARAM,这应该是合法的。

您还必须更改接收消息的代码。如果您需要帮助,请发布该代码。

于 2013-09-13T06:02:41.420 回答