This example is to use the API to open the online/interrupted Network Disk Drive dialog box. We must use the flat. the wnetconnectiondialog and wnetdisconnectdialog types of the DLL api library are completed. The following tapimpr categories are the operation records. dll library category.
1:''' <Summary>
2:''' Network neighbor-related correspondence Library (FLPs. dll ).
3:''' </Summary>
4:Public Notinheritable ClassTapimpr
5:
6:Public EnumEresourcetypeAs Integer
7:''' <Summary>
8:''' Any resource.
9:''' </Summary>
10:Resourcetype_any = & H0
11:''' <Summary>
12:''' Network Disk Drive.
13:''' </Summary>
14:Resourcetype_disk = & H1
15:''' <Summary>
16:''' Network printer.
17:''' </Summary>
18:Resourcetype_print = & H2
19:''' <Summary>
20:''' Unknown.
21:''' </Summary>
22:Resourcetype_unknown = & hffffffff
23:End Enum
24:
25:''' <Summary>
26:''' Online Network Disk Drive dialog box.
27:''' </Summary>
28:<Dllimport ("MIP. dll", Charset: = charset.Auto)> _
29:Public Shared FunctionWnetconnectiondialog (ByvalHwndAsIntptr,ByvalTypeAsEresourcetype)As Integer
30:End Function
31:
32:''' <Summary>
33:'''Disconnect a Network Disk Drive dialog box.
34:''' </Summary>
35:<Dllimport ("MIP. dll", Charset: = charset.Auto)> _
36:Public Shared FunctionWnetdisconnectdialog (ByvalHwndAsIntptr,ByvalTypeAsEresourcetype)As Integer
37:End Function
38:
39:EndClass
The following figure shows how to call the wnetconnectiondialog API and wnetdisconnectdialog function.
1:''' <Summary>
2:''' Online Network Disk Drive dialog box.
3:''' </Summary>
4:''' <Param name = "handle"> window handle. </Param>
5:''' <Returns> returns true after going online, and false if not. </Returns>
6:Public Overloads Shared FunctionNetconnectiondialog (ByvalHandleAsIntptr)As Boolean
7:DimIresultAs Integer
8:
9:Iresult = tapimpr. wnetconnectiondialog (handle, tapimpr. eresourcetype. resourcetype_disk)
10:ReturnIresult = 0
11:End Function
12:
13:''' <Summary>
14:'''Disconnect a Network Disk Drive dialog box.
15:''' </Summary>
16:''' <Param name = "handle"> window handle. </Param>
17:''' <Returns> returns true successfully. Otherwise, returns false. </Returns>
18:Public Overloads Shared FunctionNetdisconnectdialog (ByvalHandleAsIntptr)As Boolean
19:DimIresultAs Integer
20:
21:Iresult = tapimpr. wnetdisconnectdialog (handle, tapimpr. eresourcetype. resourcetype_disk)
22:ReturnIresult = 0
23:End Function