sendmessage - Convert string to IntPtr -
sorry english poor. convert string intptr using
copydatastruct cd = new copydatastruct(); cd.dwdata = 0; cd.lpdata = marshal.stringtohglobalauto(msg).toint32(); cd.cbdata = msg.length; marshal.stringtohglobalauto(msg); and send window using sendmessage method when receive , read intptr string using
copydatastruct cd = (copydatastruct)marshal.ptrtostructure(lparam, typeof(copydatastruct)); byte[] b = new byte[cd.cbdata]; intptr lpdata = new intptr(cd.lpdata); string temp = marshal.ptrtostringuni(lpdata); marshal.copy(lpdata, b, 0, cd.cbdata); string strdata = encoding.default.getstring(b); i receive data m\0s\0g\0!\0@\01\0|\01\0|\0c\0:\0\\0u\0s\0e\0r\0s\0\\0f\0.\0a\0l\0s\0a\0
when make strdata.replace("\0","")
i receive message truncated. msg!@1|1|c:\users\f.alsa
original message msg!@1|1|c:\users\f.alsayyed\desktop\file.ktb
to me looks replace function found 0 termination earlier string ends, seems received data contains zero's inside string too.
Comments
Post a Comment