Home > Software engineering >  Vb how to the machine's IP address (internal network and external network) to send the specifie
Vb how to the machine's IP address (internal network and external network) to send the specifie

Time:09-30

Vb how to the machine's IP address (internal network and external network) to send the specified space
Dim aa As String
Dim strLocalIP As String
Dim winIP As Object
Aa=aa & amp; "The machine computer name:" & amp; Environ (" computername ") & amp; VbCrLf
Aa=aa & amp; "The machine user name:" & amp; Environ (" username ") & amp; VbCrLf
The Set winIP=CreateObject (" MSWinsock. Winsock ")
StrLocalIP=winIP. Localip
MsgBox aa & amp; "This machine IP:" & amp; StrLocalIP
Text1. Text=aa & amp; "This machine IP:" & amp; StrLocalIP
"C: \ 123. TXT" Open For Append As # 1
Print # 1, Text1. Text;
Close # 1
End sub

So just Intranet IP, the IP networks outside also show?

How to c: \ 123. TXT sent me email?
How do you write the code?

Please expert help

CodePudding user response:

Access to the network IP address please visit www.ip138.com

CodePudding user response:

Or visit http://www.baidu.com/s? Wd=IP

CodePudding user response:

refer to the second floor zhao4zhong1 response:
or visit http://www.baidu.com/s? Wd=IP

Can you detailed said once!
How to access the site in the background?
And how the TXT file to my mailbox?

CodePudding user response:


OpenURL method


Open and returns the specified URL of the document, the document returned to change body shape, the method is complete, the URL of the various attributes (and some part of the URL, such as protocol) will be updated, in accordance with the current URL,

Syntax

Object. The OpenUrl [url, datatype]

OpenURL attribute grammar contains the following parts:

Part of the description
Object expression, and its value is "applied" in the list of objects,
Url required, be retrieved document url,
Datatype optional, integers, as is shown in "Settings", specify the data type,


Set the value

Datatype setting values:

Constant value description
IcString 0, the default, the data as a string to retrieve,
IcByteArray 1 to retrieve the data as a byte array,


The return type

The Variant

Description

OpenURL method return values on the target URL, for example, if the URL of the target is a directory of the FTP server, will return to the directory, on the other hand, if the target is a file, then retrieve the documents,

OpenURL method is equivalent to: call the Execute method GET operation, and then call GetChunk method in the StateChanged events, however, OpenURL method will lead to returning to synchronize data flow from the site,

As shown below, if you are retrieving a binary file, before put it to disk, be sure to use a byte array as temporary variables:

Dim (b) As Byte
Dim strURL As String
'set strURL is a valid address,
StrURL="FTP://ftp.GreatSite.com/China.exe"
(b)=rc.inet1. OpenURL (strURL, icByteArray)

Open "C: \ Temp \ China. Exe" For Binary Access _
Write As # 1
Put # 1, and (b)
Close # 1

Pay attention to when using OpenURL method, before set the UserName and Password properties, set the URL attribute, if the last set URL attribute, the UserName and Password properties will be set to ", "

CodePudding user response:

Use ANSMTPLib email

CodePudding user response:


Private Sub TestReg ()
Dim strData As String
Dim reg As Object
Dim matchs the As Object, the match As Object

StrData=https://bbs.csdn.net/topics/getHtmlStr (" http://www.baidu.com/s? Wd=IP ")

The Set reg=CreateObject (" vbscript. RegExp ")
Reg. Global=True
Reg. The IgnoreCase=True
Reg. MultiLine=True
Reg. The Pattern="fk1 - fk=" "(/\ \ d +)", "
The Set matchs=reg. The Execute (strData)
The Debug. Print matchs (0). SubMatches (0)
End Sub

Private Sub TestReg2 ()
Dim strData As String

StrData=https://bbs.csdn.net/topics/getHtmlStr (" http://ip.changeip.com/")

The Debug. Print Left (strData, InStr (strData, & lt; "" ) - 1)

End Sub
Private Sub TestReg3 ()
Dim strData As String
Dim reg As Object
Dim matchs the As Object, the match As Object

StrData=https://bbs.csdn.net/topics/getHtmlStr (" http://ip.changeip.com ")

The Set reg=CreateObject (" vbscript. RegExp ")
Reg. The Pattern="^ [\ d \] +"
The Set matchs=reg. The Execute (strData)
The Debug. Print matchs (0)
End Sub
Private Function getHtmlStr (strUrl As String) As String
Dim XmlHttp As Object
The Set XmlHttp=CreateObject (" Microsoft. XmlHttp ")
XmlHttp. Open "GET", strUrl, False
XmlHttp. Send
GetHtmlStr=StrConv (XmlHttp. ResponseBody vbUnicode)
The Set XmlHttp=Nothing
End the Function
  • Related