Introduction
In my local network, it is common an equipment to be turned off and others have mapped folders of it. Windows shows a warning window. It informs that the resource is not available in the moment and that the operator can choose for not more to use the unavailable resource.
Each user when doing logon, it's executed for he a script. This script makes all it adjusts them and necessary updatings in the system. I then opted to not to show any window type and simply to ignore the mistake screens.
My reality
There is a service that resides in all the equipments. It verifies periodically for updating files. When an user makes logon, the others are informed of the event (like MSN Messeger). The personal computer seeks for events associated the user and it executes.
Common events
The most common events are:
- to map a resource,
- to post a file,
- warnings,
Solution
I use applications VB to work the system. Then, I developed a small class to map the resources.
Example
My reports are printed like PDF and published in the browser. Then:
Sub MapReportFolder()
Dim Net As New clsNetworkClient
Dim Ret As Long
Ret = Net.Connect("R:", "\\file://ESRVD048829A03/REPORT">ESRVD048829A03\REPORT", Net.ComputerName, "")
"vb.net">
If Not Ret = 0 Then
Call LogEvent (date, time, WnetError(Ret))
End If
End Sub
Error Trap
The return code can be tested and show a mensage to user:
Private Const ERROR_SUCCESS As Integer = 0
Private Const WN_Success As Long = &H0
Private Const WN_Not_Supported As Long = &H1
Private Const WN_Net_Error As Long = &H2
Private Const WN_Bad_Pointer As Long = &H4
Private Const WN_Bad_NetName As Long = &H32
Private Const WN_Bad_Password As Long = &H6
Private Const WN_Bad_Localname As Long = &H33
Private Const WN_Access_Denied As Long = &H7
Private Const WN_Out_Of_Memory As Long = &HB
Private Const WN_Already_Connected As Long = &H34
Private Function WnetError(ByVal Errcode As Long) As String
Select Case Errcode
Case WN_Not_Supported
WnetError = "Function is Not supported."
Case WN_Out_Of_Memory
WnetError = "Out of Memory."
Case WN_Net_Error
WnetError = "An error occurred On the network."
Case WN_Bad_Pointer
WnetError = "The Pointer was Invalid."
Case WN_Bad_NetName
WnetError = "Invalid Network Resource Name."
Case WN_Bad_Password
WnetError = "The Password was Invalid."
Case WN_Bad_Localname
WnetError = "The local device name was invalid."
Case WN_Access_Denied
WnetError = "A security violation occurred."
Case WN_Already_Connected
WnetError = "The local device was connected To a remote resource."
Case Else
WnetError = "Unrecognized Error " + Str(Errcode) + "."
End Select
End Function
Gratefulness
My sincere gratefulness to the friend Wilsimar Ara�jo, a fantastic Designer.
Contact
MSN: willian_cpp_br@hotmail.com
Phone: +55 (61) 9162-8541