directplay how to bypass the enumconnection and the enumsession

Hello All i can do a small program like a chat with the dialog that ask the user to
choose their provider like tcpip or IPX or .... and assk the user to choose the session
in this provider. but i dont want to do it each time i connect

what should i do to connect directly to a server like a tcpic computer via a specific address

thanks
diplodocusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
0
chensuCommented:
Rejected without any comments. What do you want?
0
AdrianBrownCommented:
You need to create a IDirectPlayLobby interface and use the CreateCompoundAddress() function.  I use code similar to this.

char m_lpConData[256];
char m_lpConAddr[256];
DPCOMPOUNDADDRESSELEMENT m_lpAddressElements[16];

// Reset the data
void Reset(void)
{
    m_nCurConElement = 0;
    m_lpConDataPtr = m_lpConData;
}

// To add to the address
void AddConData(GUID guid, int nDataSize, char *szData)
{
    // Add the next element
    m_lpAddressElements[m_nCurConElement].guidDataType = guid;
    m_lpAddressElements[m_nCurConElement].dwDataSize = nDataSize;
    m_lpAddressElements[m_nCurConElement].lpData = m_lpConDataPtr;

    // Copy the data
    memcpy(m_lpConDataPtr, szData, nDataSize);

    // Now increase the pointers
    m_nCurConElement++;
    m_lpConDataPtr += nDataSize;
}

To create say a TCPIP connection you would do

ResetData();
AddConData(DPAID
_ServiceProvider, sizeof(GUID), DPSPGUID_TCPIP);
AddConData(DPAID_INet, 13, "192.168.1.36");

int nTotalSize = 256;

lpDirectLobby->CreateCompoundAddress(m_lpAddressElements, m_nCurConElement, m_lpConAddr, &nTotalSize);

lpDirectLobby->InitializeConnection(m_lpConAddr, 0);

This sets up a compound address with the provider of TCPIP and the address to connect to.  The address is then created and initialised.

Hope this helps, for more info see the SDK
DirectPlay->DirectPlay Essentials->DirectPlay Address
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.