DirectPlay8 and VB 
Author Message
 DirectPlay8 and VB

I want to know how to use VB to Automatic input IP, I don't like input
Server IP every time, because the server's IP is Fixed

Thanks!



Mon, 06 Dec 2004 23:41:18 GMT  
 DirectPlay8 and VB
The DirectPlay8Address object you pass to the EnumHosts method should
contain the IP of the system you want to connect to.  To put the IP and port
into the address object, you would do something like:

Address.AddComponentString "hostname", "192.168.1.100"

You could even add the port to the address object:

Address.AddComponentLong "port", 2302

hth

--
Eric DeBrosse
http://www.mvps.org/vbdx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.


Quote:
> I want to know how to use VB to Automatic input IP, I don't like input
> Server IP every time, because the server's IP is Fixed

> Thanks!



Wed, 08 Dec 2004 10:10:19 GMT  
 DirectPlay8 and VB
Private Sub cmdRefresh_Click()

    If mlSearch = StartSearch Then
        'Time to enum our hosts
        mfDoneEnum = False
        Dim Desc As DPN_APPLICATION_DESC
        Desc.guidApplication = msGuid

moDPA.AddComponentString "hostname", "192.168.100.1"  <<<<<<< I add this
line to here (cmdRefresh_Click) ..... is it Right ??????
'===========================================================================
============================

        If Not (moDPP Is Nothing) Then
            mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE, 0,
INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)
        ElseIf Not (moDPC Is Nothing) Then
            mlEnumAsync = moDPC.EnumHosts(Desc, Nothing, moDPA, INFINITE, 0,
INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)
        End If
        cmdRefresh.Caption = "Stop Search"
        mlSearch = StopSearch



Sat, 11 Dec 2004 00:03:07 GMT  
 DirectPlay8 and VB
if the DPNENUMHOSTS_OKTOQUERYFORADDRESSING flag is specified and the
provided AddrHost can't be found, it will ask you to enter an address.  It
looks like in the code below you are trying to set this in your local
DeviceInfo instead of the AddrHost (which you have set to Nothing).

--
Eric DeBrosse
http://www.mvps.org/vbdx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.


Quote:
> Private Sub cmdRefresh_Click()

>     If mlSearch = StartSearch Then
>         'Time to enum our hosts
>         mfDoneEnum = False
>         Dim Desc As DPN_APPLICATION_DESC
>         Desc.guidApplication = msGuid

> moDPA.AddComponentString "hostname", "192.168.100.1"  <<<<<<< I add this
> line to here (cmdRefresh_Click) ..... is it Right ??????

'===========================================================================
Quote:
> ============================

>         If Not (moDPP Is Nothing) Then
>             mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE,
0,
> INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)
>         ElseIf Not (moDPC Is Nothing) Then
>             mlEnumAsync = moDPC.EnumHosts(Desc, Nothing, moDPA, INFINITE,
0,
> INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)
>         End If
>         cmdRefresh.Caption = "Stop Search"
>         mlSearch = StopSearch



Sat, 11 Dec 2004 02:09:19 GMT  
 DirectPlay8 and VB

Quote:
> if the DPNENUMHOSTS_OKTOQUERYFORADDRESSING flag is specified and the
> provided AddrHost can't be found, it will ask you to enter an address.  It
> looks like in the code below you are trying to set this in your local
> DeviceInfo instead of the AddrHost (which you have set to Nothing).

It is Done !!!! ........ thanks very much for your Help !!!

p.s. the "Nothing" shoud be value "0" (Not string "Nothing")



Sat, 11 Dec 2004 13:04:37 GMT  
 DirectPlay8 and VB
I tried before, it is OK at my Local Networks but InterNet.

Quote:
>>> mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE,  0,

INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)

I modified this line to

Quote:
>>> mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE,  0,

INFINITE, 0, ByVal 0&, 0)

It was not show out the Input Address Box, and can connect to Host, even I
not add the line you mention before

Quote:
>>> Address.AddComponentString "hostname", "192.168.1.100"

But I use this program to Remote site, it can not connect Automatic !

I read the DirectPlay8 manual, the second parameter is for Host, but I don't
know how to set this .......

Quote:
>>> mlEnumAsync = moDPP.EnumHosts(Desc, >>>>Nothing<<<THIS ONE<<<, moDPA,

INFINITE,  0, INFINITE, 0, ByVal 0&, 0)

You are the only one person I can ask about DirectPlay8
Sorry for my English is no good, and thank you very much for your kindly
help!

Jacky



Sat, 11 Dec 2004 21:55:21 GMT  
 DirectPlay8 and VB
To connect over the internet, you *must* specify a host, and possibly a port
to connect to.  Only on your local network subnet can you broadcast for
hosts, without first providing an IP address.  Now -- that second parameter
you are setting to Nothing *must* be set to an address object with the ip
you want to connect to.

In the line: Address.AddComponentString "hostname", "192.168.1.100" --
change the private ip 192.168.1.100 to the IP of the host on the Internet
you are trying to connect with.

Like this:

Dim moHostAddr as DirectPlay8Address
moHostAddr.AddComponentString "hostname", "192.168.1.100"
moHostAddr.AddComponentLong "port", 2302
mlEnumAsync = moDPP.EnumHosts(Desc, moHostAddr, moDPA, _
INFINITE,  0, INFINITE, 0, ByVal 0&, 0)

I hope this is helping,

--
Eric DeBrosse
http://www.mvps.org/vbdx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.


Quote:
> I tried before, it is OK at my Local Networks but InterNet.

> >>> mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE,  0,
> INFINITE, DPNENUMHOSTS_OKTOQUERYFORADDRESSING, ByVal 0&, 0)

> I modified this line to

> >>> mlEnumAsync = moDPP.EnumHosts(Desc, Nothing, moDPA, INFINITE,  0,
> INFINITE, 0, ByVal 0&, 0)

> It was not show out the Input Address Box, and can connect to Host, even I
> not add the line you mention before
> >>> Address.AddComponentString "hostname", "192.168.1.100"

> But I use this program to Remote site, it can not connect Automatic !

> I read the DirectPlay8 manual, the second parameter is for Host, but I
don't
> know how to set this .......

> >>> mlEnumAsync = moDPP.EnumHosts(Desc, >>>>Nothing<<<THIS ONE<<<, moDPA,
> INFINITE,  0, INFINITE, 0, ByVal 0&, 0)

> You are the only one person I can ask about DirectPlay8
> Sorry for my English is no good, and thank you very much for your kindly
> help!

> Jacky



Sun, 12 Dec 2004 02:51:45 GMT  
 DirectPlay8 and VB

Quote:
> Like this:

> Dim moHostAddr as DirectPlay8Address
> moHostAddr.AddComponentString "hostname", "192.168.1.100"
> moHostAddr.AddComponentLong "port", 2302
> mlEnumAsync = moDPP.EnumHosts(Desc, moHostAddr, moDPA, _
> INFINITE,  0, INFINITE, 0, ByVal 0&, 0)

Hello Eric,

Thanks for your kindly help ! ........ you are really very helpful !!!

I tried it and DONE !! ...... it is now work fine !!

But I tried create a new Address Object is no good ( I don't know, may be I
have something wrong)

Now I doing like this is OK, even for InterNet
------------------------------------------------

Dim moHostAddr as DirectPlay8Address
Set  moHostAddr = moDPA  ' <<<<<<<<<<< I Copy the moDPA to moHostAddr
moHostAddr.AddComponentString "hostname", "192.168.1.100"

mlEnumAsync = moDPP.EnumHosts(Desc, moHostAddr, moDPA, _
INFINITE,  0, INFINITE, 0, ByVal 0&, 0)

p.s. I just going to your Web-Site, it is a nice place, I did bookmark (Of
Cause!), and would be tell my friend about this great WWW

With Best Regards,

Jacky



Sun, 12 Dec 2004 03:59:59 GMT  
 DirectPlay8 and VB

Quote:
> Set  moHostAddr = moDPA  ' <<<<<<<<<<< I Copy the moDPA to moHostAddr

Yes, I forgot some steps.  You would have needed to create the address
object:

Set moHostAddr = g_oDirectX.DirectPlayAddressCreate

Glad you worked it out!

--
Eric DeBrosse
http://www.mvps.org/vbdx/
Microsoft Visual Basic DirectX MVP

The opinions expressed in this message are my own personal views and
do not reflect the official views of Microsoft Corporation. The MVP program
does not constitute employment or contractual obligation with Microsoft.



Sun, 12 Dec 2004 05:33:55 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. VB.NET and DirectPlay8 samples

2. VB & DirectPlay8

3. Question about DirectPlay8.2

4. Need help with DirectPlay8!

5. DirectPlay8 Samples

6. DirectPlay4 and DirectPlay8

7. How do you get the guid of another application.(directplay8)

8. Detecting Mouse Click in Non-VB or VB app (in VB 6)

9. vb MSCOMM Control works in VB 5 and not VB 6

10. Debugging VB Usercontrols in VB without 2nd VB Test project

11. optimizing performance and data transfer vb->excel and vb->vb

12. optimizing performance and data transfer vb->excel and vb->vb

 

 
Powered by phpBB® Forum Software