Results 1 to 5 of 5

Thread: I Need Some Help No One Well Help Me With it

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    You need to at least try something first. I can guarantee that nobody here, will do the entire thing for you. Try some things, and if you get stuck, then ask for help.

    Don't ask for entire projects to be done for you.

    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    Ok I Am Not Making A Trojan To Give out This Is For MY School For My Teacher I Told Him I would Make Him a Program So He Can Access The Other Computer Files From Him Computer In one Program I Cant Figure out How To Do It Tho

    Ok I Want Dir1 To Be The Dir Ove The other Computer along With File1 And Drive1 But I Can Figure out How To Do It And Im Using Winscok

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134

    Post

    Try this:
    ------------
    ' #VBIDEUtils#************************************************************
    ' * Programmer Name : Waty Thierry
    ' * Web Site : www.geocities.com/ResearchTriangle/6311/
    ' * E-Mail : waty.thierry@usa.net
    ' * Date : 25/09/98
    ' * Time : 11:18
    ' * Module Name : class_NetUse
    ' * Module Filename : NetUse.cls
    ' **********************************************************************
    ' * Comments : Connect/Disconnect shared network drives
    ' *
    ' *
    ' **********************************************************************

    Option Explicit

    Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
    Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long

    Const WN_Success = &H0
    Const WN_Not_Supported = &H1
    Const WN_Net_Error = &H2
    Const WN_Bad_Pointer = &H4
    Const WN_Bad_NetName = &H32
    Const WN_Bad_Password = &H6
    Const WN_Bad_Localname = &H33
    Const WN_Access_Denied = &H7
    Const WN_Out_Of_Memory = &HB
    Const WN_Already_Connected = &H34

    '-- Error number and message
    Public ErrorNum As Long
    Public ErrorMsg As String

    Public rc As Long

    Private Const ERROR_NO_CONNECTION = 8
    Private Const ERROR_NO_DISCONNECT = 9


    Private Type NETRESOURCE
    dwScope As Long
    dwType As Long
    dwDisplayType As Long
    dwUsage As Long
    lpLocalName As String
    lpRemoteName As String
    lpComment As String
    lpProvider As String
    End Type

    '----------------------------------------------
    'WNetAddConnection2

    'Allows the caller to redirect (connect) a local
    'device to a network resource. It is similar to
    'WNetAddConnection, except that it takes a pointer
    'to a NETRESOURCE structure to describe the network
    'resource to connect to. It also takes the addition
    'parameters lpUserID and dwFlags.

    'lpNetResource
    'Specifies the network resource to connect to.
    'The following fields must be set when making a
    'connection, the others are ignored.

    ' lpRemoteName: Specifies the network resource
    ' to connect to. This is limited
    ' to MAX_PATH.

    ' lpLocalName: This specifies the name of a local
    ' device to be redirected, such as "F:"
    ' or "LPT1". The string is treated in a
    ' case insensitive manner, and may be
    ' the empty string (or NULL) in which
    ' case a connection to the network resource
    ' is made without making a redirection.

    ' lpProvider: Specifies the NP to connect to. If NULL
    ' or empty string, Windows will try each
    ' NP in turn. The caller should set
    ' lpProvider only if it knows for sure
    ' which network it wants. Otherwise, it
    ' is preferable to let Windows determine
    ' which NP the network name maps to.
    ' If this is non NULL, Windows will try
    ' the named NP and no other.

    ' dwType: Specifies the type of resource to connect to.
    ' It must be RESOURCETYPE_DISK or RESOURCETYPE_PRINT
    ' if lpLocalName is not the empty string. It may
    ' also be RESOURCETYPE_ANY if lpLocalName is the
    ' empty string.

    'lpPassword
    'Specifies the password to be used in making the
    'connection, normally the password associated with
    'lpUserID. A NULL value or string may be passed in
    'to indicate to the function to use the current
    'default password.
    '
    'lpUserID
    'This specifies the identity of the user needed to
    'make the connection. If NULL, a default will be
    'applied. This is used when the user wishes to connect
    'to a resource, but has a different user name or
    'account assigned to him for that resource. This
    'identification represents a security context, and
    'is NP specific.
    '
    'dwFlags
    'This is a bit mask which may have any of the
    'following bits set:
    '
    ' CONNECT_UPDATE_PROFILE: If the connection should
    ' be made persistent. If set,
    ' Windows automatically restores
    ' this connection when the user
    ' logs on to the network. A connection
    ' is only made persistent if the
    ' connection was successful.
    Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long
    Private Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long
    Private Declare Function WNetConnectionDialog Lib "mpr.dll" (ByVal hWnd As Long, ByVal dwType As Long) As Long
    Private Declare Function WNetDisconnectDialog Lib "mpr.dll" (ByVal hWnd As Long, ByVal dwType As Long) As Long

    'Public Const RESOURCE_CONNECTED = &H1
    'Public Const RESOURCE_REMEMBERED = &H3
    'Public Const RESOURCEDISPLAYTYPE_DOMAIN = &H1
    'Public Const RESOURCEDISPLAYTYPE_GENERIC = &H0
    'Public Const RESOURCEDISPLAYTYPE_SERVER = &H2
    'Public Const RESOURCEUSAGE_CONTAINER = &H2

    Const NO_ERROR = 0
    Const CONNECT_UPDATE_PROFILE = &H1
    Const RESOURCETYPE_DISK = &H1
    Const RESOURCETYPE_PRINT = &H2
    Const RESOURCETYPE_ANY = &H0
    Const RESOURCE_GLOBALNET = &H2
    Const RESOURCEDISPLAYTYPE_SHARE = &H3
    Const RESOURCEUSAGE_CONNECTABLE = &H1

    Public Sub Connect(sDrive As String, sService As String, Optional sPassword As String = "")

    On Error GoTo Err_Connect
    Me.ErrorNum = 0
    Me.ErrorMsg = ""
    rc = WNetAddConnection(sService & Chr(0), sPassword & Chr(0), sDrive & Chr(0))
    If rc <> 0 Then GoTo Err_Connect

    Exit Sub

    Err_Connect:
    Me.ErrorNum = rc
    Me.ErrorMsg = WnetError(rc)

    End Sub

    Public Sub DisConnect(sDrive As String)

    On Error GoTo Err_DisConnect
    Me.ErrorNum = 0
    Me.ErrorMsg = ""
    rc = WNetCancelConnection(sDrive + Chr(0), 0)
    If rc <> 0 Then GoTo Err_DisConnect

    Exit Sub
    Err_DisConnect:
    Me.ErrorNum = rc
    Me.ErrorMsg = WnetError(rc)

    End Sub

    Private Function WnetError(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

    Public Function ConnectNetworkDialog() As Long
    ' *** Show the dialog to map a drive

    'If the function succeeds, the return value is
    'NO_ERROR (0). If the user cancels out of the
    'dialog box, it is &HFFFFFFFF.

    ConnectNetworkDialog = WNetConnectionDialog(0&, RESOURCETYPE_DISK)

    End Function

    Public Function DisconnectNetworkDialog() As Long
    ' *** Show t

  4. #4
    Junior Member
    Join Date
    Jan 1999
    Posts
    26

    Post


  5. #5
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    I Cant Figure This Out how To use this code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width