SileNcer
asked on
LPCWSTR -> CString
I'm using a function called NetMessageBufferSend() that requires a LPCWSTR data type. This string does not seem to be compatible with the CString. I have created a WCHAR string that seems to work with the funtion, however, I am having problems transfering the data from the CString into the LPCWSTR.
I have tried wsprintf(),strcpy(),and wcscpy(), but none of them seem to work!
Can anyone please show me how to copy the contents of a CString into a WCHAR string(LPCWSTR)?
I have tried wsprintf(),strcpy(),and wcscpy(), but none of them seem to work!
Can anyone please show me how to copy the contents of a CString into a WCHAR string(LPCWSTR)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay! I figured out the problem. I needed to include netapi32.lib to my project, so it wasn't the pointers after all.
ASKER
The program will compile with this code:
LPBYTE message = (LPBYTE)*m_message.GetBuff
DWORD length = 500;
NetMessageBufferSend(
NULL, //server name
(LPCWSTR)*m_domain, //send to name
(LPCWSTR)*m_username, //from name
message, //message
length); //message length
But it keeps giving me this error:
error LNK2001: unresolved external symbol _NetMessageBufferSend@20
Is there something I'm not doing right with the pointers or something?