Visual Basic .NET 網際網路程式設計

Preview:

DESCRIPTION

Visual Basic .NET 網際網路程式設計. Chpater 16. 16-1Windows Networking 基本概念. 在 Microsoft Windows 的環境裏,“ Windows Networking” 泛指由 Microsoft Windows NT/2000 Server 或 95/98 所提供的網路資源,如分享目錄、印表機等,可透過“連線網路磁碟機”、“中斷網路磁碟機”、“網路印表機”及“網路芳鄰”等功能來達成。. 一般而言,網路架構大致如下: - PowerPoint PPT Presentation

Citation preview

  • Visual Basic .NETChpater 16

  • 16-1Windows NetworkingMicrosoft WindowsWindows NetworkingMicrosoft Windows NT/2000 Server95/98

  • Network Service ProviderWindows NT/2000 ServerNovell NetWareLinuxAppleTalkDomainServerWindows NT ServerNetwork Resource

  • Microsoft .NETClass LibraryClass LibraryWindows APIMicrosoft WindowsAPIWindows NetworkingMicrosoft Windows Networking APIWNet

    Microsoft Windows Networking APINetwork ProviderMicrosoft Windows NT/2000 ServerNovellLinuxUNIXServerMicrosoft Windows Networking APINetwork IndependenceMicrosoft Windows Networking API

  • Microsoft Windows Networking APIMPR.DLLMicrosoft Windows Networking APIWNetAddConnectionWNetAddConnection2WNetAddConnection3WNetCancelConnectionWNetCancelConnection2WNetCloseEnumWNetConnectionDialogWnetConnectionDialog1WNetDisconnectDialogWNetDisconnectDialog1

  • WNetEnumResourceWNetGetConnectionLocal WNetGetLastErrorWNetGetNetworkInformationNetwork ProviderWNetGetProviderNameNetwork ProviderWNetGetResourceInformationNetwork ProviderWNetGetResourceParentNetwork ProviderWNetGetUniversalNameUNCUniversal Naming ConventionWNetGetUserWNetOpenEnumWNetUseConnectionWnetAdd Connection3MultinetGetConnectionPerformance

  • Microsoft Windows Networking API

    Enumerate Network ResourceAdd ConnectionCancel ConnectionNetwork Provider

  • 16-2 /Microsoft WindowsMap Network Driver

  • WNet APIWNetConnectionDialog Public Function WnetConnectionDialog _ (ByVal hwnd As Integer, _ ByVal dwType As Integer) As IntegerEnd Function

  • dwType

  • Integer0-1ERROR_EXTENDED_ERRORWNetGetLastError

  • 16-3 /WNetConnectionDialogWnet Disconnect Dialog

  • WNetDisconnectDialog Public Function WNetDisconnectDialog _ (ByVal hwnd As Integer, _ ByVal dwType As Integer) As IntegerEnd Function

  • Integer0-1ERROR_EXTENDED_ERRORWNetGetLastError

  • 16-4 - 1Microsoft Windows Networking APIAPIWNetAddConnection WNetAddConnection2WNetAddConnection3

    API

  • WNetAddConnection _Public Function WNetAddConnection _ (ByVal lpszNetPath As String, _ ByVal lpszPassword As String, _ ByVal lpszLocalName As String) As IntegerEnd Function

  • WNetAddConnectionlpszNetPathServerLeoHuangD\\LeoHuang\DlpszPassword(lpszLocalName)F:LTP116-4 WNetAddConnection.sln

  • 16-5 - 2WNetAddConnectionWNetAddConnection2Microsoft WindowsWNetAddConnection2ProviderMicrosoft Windows Network

  • WNetAddConnection2 Declare Function WNetAddConnection2 Lib "mpr.dll" _ Alias "WNetAddConnection2A"_ (ByRef lpNetResource As NETRESOURCE, _ ByVal lpPassword As String, _ ByVal lpUserName As String, _ ByVal dwFlags As Integer) As Integer

  • NETRESOURCE Structure NETRESOURCE Dim dwScope As Integer Dim dwType As Integer Dim dwDisplayType As Integer Dim dwUsage As Integer Dim lpLocalName As String Dim lpRemoteName As String Dim lpComment As String Dim lpProvider As StringEnd StructuredwScope

  • dwTypedwDisplayType

  • dwUsagelpLocalNameF:LTP1

    lpRemoteName

    lpProviderProviderInteger0-1ERROR_EXTENDED_ERRORWNetGetLastError

  • 16-6 - 3WNetAddConnectionWNetAddConnection2WNet APIWnetAddConnection3Declare Function WNetAddConnection3 Lib "mpr.dll" _ Alias "WNetAddConnection3A" _ (ByVal hwnd As Integer, _ ByRef lpNetResource As NETRESOURCE, _ ByVal lpPassword As String, _ ByVal lpUserName As String, _ ByVal dwFlags As Integer) As Integer

  • Integer0-1ERROR_EXTENDED_ERRORWNetGetLastError

  • 16-7 - 1Microsoft WindowsPopup Menu(D)

  • WNet APIAPIWNetCancelConnection WNetCancelConnection2

    APIWNetDisconnectDialogWNetDisconnectDialogWNetCancelConnectionWNetCancelConnection2

  • WNetCancelConnectionDeclare Function WNetCancelConnection Lib "mpr.dll" _ Alias "WNetCancelConnectionA"_ (ByVal lpszName As String, _ ByVal fForce As Integer) As Integer

  • 16-8 - 2WNet APIWNetDisconnectDialogWNetDisconnectDialog1WNetCancelConnectionAPIWNetCancelConnection2

    WNetCancelConnection2WNetCancelConnectionlpNamefForcedwFlags

  • WNetCancelConnection2Declare Function WNetCancelConnection2 Lib "mpr.dll" _ Alias "WNetCancelConnection2A" _ (ByVal lpName As String, _ ByVal dwFlags As Integer, _ ByVal fForce As Integer) As Integer

  • 16-9 Microsoft

    Microsoft Windows\\\Server

  • WNet APIWnetGetConnection Declare Function WNetGetConnection Lib "mpr.dll" _ Alias "WNetGetConnectionA" _ (ByVal lpszLocalName As String, _ ByVal lpszRemoteName As String, _ ByRef cbRemoteName As Integer) As Integer

  • 16-10Microsoft WindowsWNetGetUser Declare Function WNetGetUser Lib "mpr.dll" _ Alias "WNetGetUserA" _ (ByVal lpName As String, _ ByVal lpUserName As String, _ ByRef lpnLength As Integer) As Integer

  • 16-11WNet APIWNet API - WNetGetLastError

    WNet APIIntegerdwResultdwResultNO_ERROR=0ERROR_EXTENDED_ERROR=1208WNetGetLastError

  • WNetGetLastErrorDeclare Function WNetGetLastError Lib "mpr.dll" _ Alias "WNetGetLastErrorA" _ (ByRef lpError As Integer, _ ByVal lpErrorBuf As String, _ ByVal nErrorBufSize As Integer, _ ByVal lpNameBuf As String, _ ByVal nNameBufSize As Integer) As Integer Integer0ERROR_INVALID_ADDRESS

  • E N D