المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : جلب معلومات الابي الخاص بك عن طريق vb.net



shihab
08-09-2013, 11:31 PM
اليوم أنا سوف اظهر لكم كيف يمكنك الحصول على عنوان MAC أجهزة الكمبيوتر، local ip and outgoing ip
أولا إنشاء مشروع جديد



1. افتح Visual Studio أو Visual الأساسية.
2. إنشاء مشروع جديد شكل النوافذ وتسميته ما تريد.


الآن لإضافة عناصر التحكم.
Now to add the controls.
Add 3 textboxes, name the first outtext the second iptext and the last mactext.
add 4 buttons, name the first copyout the second copyip and the last copymac, you dont need to rename
the last its just to get all the information.
Set the text on the copy buttons to copy.
الآن قم بإضافة في الجزء العلوي من التعليمات البرمجية الخاصة بك.






ImportsSystem.Net




then you add this below public class



Dim ip As New WebClient


Now add this so that when you click on the buttons you copy it




Private Sub CopyOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyOut.Click
Clipboard.SetText(OutText.Text)
End Sub

Private Sub CopyIp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyIp.Click
Clipboard.SetText(IPtext.Text)
End Sub

Private Sub CopyMac_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyMac.Click
Clipboard.SetText(MACText.Text)
End Sub



Now we will add the code that gets the mac address the outgoing ip and the local ip, add this to your code.


Private Sub getoutip()



'Get outgoing ip
Try
OutText.Text = ip.DownloadString("http://www.networksecuritytoolkit.org/nst/tools/ip.php/")
Catch ex As Exception
OutText.Text = "No connection"
End Try
End Sub
Private Sub obtip()
'MAC Address
For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.Get AllNetworkInterfaces()
MACText.Text = String.Format("{2}", nic.Description, Environment.NewLine, nic.GetPhysicalAddress())
Exit For
Next







'Get local ip
Dim host As String = System.Net.Dns.GetHostName()
Dim LocalHostaddress As String = System.Net.Dns.GetHostByName(host).AddressList(0). ToString()
IPtext.Text = LocalHostaddress
End Sub



What this does is that it, downloads your ip address from http://www.networksecuritytoolkit.org/nst/tools/ip.php/ (http://www.networksecuritytoolkit.org/nst/tools/ip.php/) so that we can see it in the textbox
and it finds the mac address and the local ip in the network.

now to the last button add this.




getoutip()
obtip()




You now done and it should look something like this

http://2.bp.blogspot.com/-aSotmrJAC7Y/URjWEDbsPGI/AAAAAAAAAJw/hDH8FxLQ3yw/s640/Unavngivet.png

JACK5
08-10-2013, 02:56 AM
مشكوووووووووووووووووور +5 نجوووووووووووووووووووووم

shihab
08-12-2013, 12:02 AM
شكرا لك على المرور

Dr.Rob3nX
08-13-2013, 12:24 AM
موضوع مفيد جداً شكراً لكم

134-dz
12-05-2013, 02:03 AM
شكرا لك اخييييي