StringChCopy - Giving me crap

Hey Guys,

Im working on a video wrapper through a 3rd party SDK in app C++ 6 and MFC. I get the following error C2664: 'StringCchCopyW' cannot convert parameter 1 from 'char [256]' to 'unsigned short *'

Any ideas?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
LONG CPelcoDX8100Ctrl::Connect(LPCTSTR address, short port, LPCTSTR userId, LPCTSTR password) 
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

	LPST_SERVER_BASE_INFO pServerInfo;

	pServerInfo = new ST_SERVER_BASE_INFO();
	if (!pServerInfo)
		return 1;

	::ZeroMemory(pServerInfo, sizeof(pServerInfo));
	
	StringCchCopy(pServerInfo->szServerAddr, sizeof(pServerInfo->szServerAddr), address);
	StringCchCopy(pServerInfo->szUserID, sizeof(pServerInfo->szUserID), userId);
	StringCchCopy(pServerInfo->szUserPasswd, sizeof(pServerInfo->szUserPasswd), password);

	//pServerInfo->lpfnConectCallback = CPelcoDX8100Ctrl::OnConnectedCallback;

	pServerInfo->usServerPort = port;

	DxSetSocketTimeOut(m_ConnectTimeout);

	m_hServer = DxConnect(pServerInfo);

	if (!m_hServer)
	{
		m_iLastError = DxGetLastError();
		return m_iLastError;
	}

	delete pServerInfo;

	SetTimer(TID_SERVER_CONNECT, 500, NULL);

	return 0;
}


Thanks,

Larry
It would help if you have the definitions for all these variables. Without the definitions we have no idea what types of variables you have there.
Topic archived. No new replies allowed.