Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Detecting PPP stack after connect using RAS

Posted on 1998-05-14
2
Medium Priority
?
227 Views
Last Modified: 2006-11-17
How do I detect I have stack IP from server after dialing up using the Windows RASAPI.  I dial and connect but need to delay sending web string until I have my IP address from the server.
0
Comment
Question by:jw608ems
2 Comments
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 400 total points
ID: 1449551
jw608ems,

Use RasGetProjectionInfo API function to retreive your IP address after you establish the RAS connection, see the following example.

Example
=======
 Private Type RASPPPIP
  dwSize As Long
  dwError As Long
  szIpAddress(15) As Byte
  szServerAddress(15) As Byte
 End Type

 Private Const RASP_PppIp = &H8021&

Private Sub RasGetProjectionInfo()
 Dim lpraspppip As RASPPPIP
 Dim lpcb As Long
 Dim rasprojection As Long
 Dim strIPAddress As String

 rasprojection = RASP_PppIp
 lpraspppip.dwSize = 40
 lpcb = 40
 lngRetcode = RasGetProjectionInfo(lnghRasConn, rasprojection, lpraspppip, lpcb)   'lnghRasConn is RAS connection handle
 If lngRetcode Then
  strIPAddress = "Not Available"
 Else
  strIPAddress = StrConv(lpraspppip.szIpAddress, vbUnicode)
  strIPAddress = Left$(strIPAddress, InStr(strIPAddress, Chr$(0)) - 1)
 End If

 Msgbox "My IP is " & strIPAddress
End Sub


Best regards
Bin Huwairib
0
 

Author Comment

by:jw608ems
ID: 1449552
bin_huwairib:  Thanks, I have knocked myself silly looking for answer to this one.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question