PDA

Click to See Complete Forum and Search --> : SendMessage EM_STREAMIN


ChimpFace9000
Jul 18th, 2001, 02:53 AM
This is my code..

SendMessage(hEditMain, EM_STREAMIN, SF_TEXT, EditStream);

The error...

error C2664: 'SendMessageA' : cannot convert parameter 4 from 'struct _editstream' to 'long'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

EditStream is a structure. I putting (long) next to it and it wont work. Any ideas?

abdul
Jul 18th, 2001, 02:19 PM
Try declaring the EditStream structure as long

ChimpFace9000
Jul 18th, 2001, 02:28 PM
But then it wont be an editstream structure.

parksie
Jul 18th, 2001, 03:29 PM
Try passing a pointer using &EditStream (you'll need a cast).

ChimpFace9000
Jul 18th, 2001, 05:13 PM
I tired &EditStream, didnt work. Whats a cast?

parksie
Jul 18th, 2001, 05:16 PM
long location;
char *ptr;
char val = 5;

ptr = &val; // Fine
location = (long)ptr; // Needs the cast to change indirection level

ChimpFace9000
Jul 19th, 2001, 12:33 AM
Oh ok, i know what those are. Ive tried every combination i could think of of those.

parksie
Jul 19th, 2001, 05:21 AM
Does it fail to compile, or fail to work properly?

Megatron
Jul 19th, 2001, 12:11 PM
You need to convert it to LPARAM. Try this:

SendMessage(hEditMain, EM_STREAMIN, SF_TEXT, (LPARAM) &EditStream);

ChimpFace9000
Jul 19th, 2001, 01:30 PM
Parksie, it fails to compile.

Megatron, i get this error
error C2440: 'type cast' : cannot convert from 'struct _editstream' to 'long'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Edit:
Megatron, i forgot to add the '&', and it works now. Thanks.