Version 2.0!
Features
Tutorials
Files
Glossary
Projects
Contact
Links
Message Board
Extras
LuckyCam
Old News
Sign Guestbook
View Guestbook
VB Horoscope
VB Photo Album
.
ATTENTION READERS! Lucky's VB Gaming Site is no longer active. For updated game programming information and tutorials, please visit The Game Programming Wiki!

Enumeration of Service Providers

Resistance is futile, you will be enumerated! :)

Oops, are my dork genes showing? Heh, anyhoo, what we're here to do is create a list of the available service providers so that we can present the user with some choices. As stated in the introduction, we'll most likely find four providers (the fab four): IPX, Serial, Modem, and TCP/IP. To obtain information on the available service providers, we must first fill a DirectPlayEnumConnections object with data:

Dim objEnumConnections As DirectPlayEnumConnections

    Set objEnumConnections = dp.GetDPEnumConnections("", DPCONNECTION_DIRECTPLAY)

We can then determine the total number of available providers by calling the GetCount method.

Dim lngNumConnections As Long

    lngNumConnections = objEnumConnections.GetCount

Next, we loop through each service provider and extract its name so that we may present it to the user. In this case, we'll populate a list box as we go along.

Dim LstBox as ListBox

    For i = 1 To lngNumConnections
        LstBox.AddItem = objEnumConnections.GetName(i)
    Next

Are we having fun yet?

Keep on truckin! Read the Initializing a Connection tutorial. (click here to download this tutorial's source code)