Thanks guys, now it works.
I got similar answer from Clootie too.
Still having trouble with the client part tho, can't get it to connect to my server...
I keep getting "DPNERR_INVALIDHOSTADDRESS" when making the connection.
Code:
..
pHostName: PWideChar;
pw: array [0..127] of WideChar;
...
pHostName := StringToWideChar(pServerAddress, pw, Length(pServerAddress) + 1);
hr := DPHostAddress.AddComponent(DPNA_KEY_HOSTNAME, //pwszName
pHostName, //lpvData
(Length(pServerAddress) + 1) * 2, //dwDataSize in bytes
DPNA_DATATYPE_STRING ); //dwDataType
Is the data size wrong or what? But I don't get any kind of errors here, only later when trying to make the connection.
EDIT: pServerAddress is a String property.
Code:
DPDeviceAddress: IDirectPlay8Address;
DPAppDesc: DPN_APPLICATION_DESC;
DPClient: IDirectPlay8Client;
DPHostAddress: IDirectPlay8Address;
...
hr := DPClient.Connect(DPAppDesc, // pdnAppDesc
DPHostAddress, // pHostAddr
DPDeviceAddress, // pDeviceInfo
NIL, // pdnSecurity
NIL, // pdnCredentials
NIL, 0, // pvUserConnectData/Size
NIL, // pvAsyncContext
NIL, // pvAsyncHandle
DPNCONNECT_SYNC); // dwFlags
Any idea what's wrong this time?
Bookmarks