WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Microsoft Client
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Cancel Connection Information

Keywords:    netcancelcon wntcancel w95cancelcon w3cancelcon   wncancelcon

This article refers to the following network cancel connection functions:
  1. Before issuing any of the above cancelcon functions, it is a good idea to first do a DirChange back to your local C: drive.

    Also make sure you do not have an Explorer window up, with the drive already logged. In fact, it's a good idea to close all instances of Explorer.

  2. netCancelCon is one of the easy generic functions. When we see a netCancelCon we look at the current OS and call either wntCancelCon or w95CancelCon for you, so to make it easy for you to have a script that runs on either Win95 or WinNT. But as soon as you stray from the simply stuff...then there are no more net functions. If you find you need to use w95 or wnt functions, you might as well change your net functions at the same time.

  3. If you are using either the w3cancelcon or wncancelcon functions for 16-bit Windows, you MUST specify the drive letter, rather than the UNC path.

  4. You can use EITHER the drive letter OR UNC path name in the netcancelcon, wntcancelcon, w95cancelcon functions, in the 32-bit network extenders. Note that when you specify the UNC path name in these 3 functions, that any drive letters that are mapped to that UNC path will be broken when you cancel the connection.

  5. The ..CancelCon functions do the same thing as going into Explorer, and doing an unmap drive.

  6. Note on ...CancelCon behavior with NT vs 95 workstation to Novell server: If you map drive LETTERS with wntAddDrive, wntCancelCon will unmap your drives AND log your NT workstation out of a Novell server. w95CancelCon, however, will unmap the drives, but WILL NOT log your Win95 workstation out of the server. So, if you do not need to map drive LETTERS... if for example, you can use @NONE in your ...AddDrive command, the Win95 workstation WILL be detached from the Novell server.

    The real solution to successfully unmap and detach from a Novell server from Win95 is to specify a server UNC SERVER NAME (only) for Win95 (as opposed to a UNC PATH to the resource) instead of a drive letter as the first parameter to w95CancelCon, per the WIN API documentation: "If this parameter specifies a redirected local resource, only the specified redirection is broken; otherwise, all connections to the remote network resource are broken."

    So here is the general solution that worked for one user is this situation (detaching from Novell server from Win95 and NT workstations):

    a) xxxCancelCon to release the drive letter (needed for WinNT -- not needed for W95, but won't hurt)

    b) Jump to end if WinNT platform, since WinNT workstation is already detached from server as a result of the first xxxCancelCon.

    c) (Win95 platform) xxxCancelCon again, this time using the UNC server name -- but not the path to the resource. Detaches W95 platform from server.

Question: RE: Error 513

I am using the w95CancelCon statement to cancel a connection to a server. However, the Windows 95 user keeps getting error message 513: Open files on device and force=@FORCE. Here is the code I used in the script:

        w95CancelCon("\\ISD_DB\SYS",@TRUE,@TRUE)
I thought that if you set the Force Flag to @TRUE, it would break the connection regardless of open files. Does this mean it returns an error message as well? Thanks.

Answer:

  1. Try doing a:
    
            DirChange("C:\") 
    
    before the w95CancelCon.

  2. FORCE tells the system to allow the closing of open files UNLESS the application that made the connection requested an "IGNORE FORCE" option, in which case the function will fail. So make sure you don't have an application that have your files open when you're trying to do the cancel connection.

  3. Make sure:
    • WinBatch is not logged to the drive (DirChange did that).

    • No Explorer windows open on the drive.

    • You don't have a program accessing that drive when you're doing the cancelcon.

    • You don't have WinBatch DLLs on the drive that you're trying to unmap.

Question (continued): RE: Error 513

Tried doing DirChange("C:\") and no luck. I still keep getting error message 513: Open files on device and force=@FORCE. Here is more code:

wntAddDrive("Guest","","\\ISD_DB\SYS",@NONE,@FALSE)
RunZoom("\\ISD_DEV\VOL1\ISDDOCS\FOLIO\ADOBERDR\ACRORD32.exe","\\ISD_DB\CD_EY_DOCSET\amepdf\appimprv\%InvFile%")
w95CancelCon("\\ISD_DB\SYS",@TRUE,@TRUE) 

Answer:

It's the RunZoom. Try RunZoomWait.

The runzoom runs the application and then the script continues. We can't break the connection because the program is using it.

If you change runzoom to runzoomwait, it should wait until the program exists before continuing the script.

Also, for debugging, try adding a message after the runzoomwait to make sure we are not also delaying with a "loader program problem" (see elsewhere on this website about loader program problems).


wntAddDrive("Guest","","\\ISD_DB\SYS",@NONE,@FALSE)
RunZoomWait("\\ISD_DEV\VOL1\ISDDOCS\FOLIO\ADOBERDR\ACRORD32.exe", "\\ISD_DB\CD_EY_DOCSET\amepdf\appimprv\%InvFile%")
Message("debug","Did this box pop up when you exited the acrord32.exe program or before???")
w95CancelCon("\\ISD_DB\SYS",@TRUE,@TRUE) 

Question: RE: Reconnect at Logon Checkbox

The w95Cancelcon function works fine, as long as the "Reconect at Logon" checkbox is *not* selected in the "Map Network Drive" dialog. This is what I'm using:

	w95CancelCon("L:", @false, @false)

Answer:

Change your force flags to @true, and that will do it, eg.

	w95CancelCon("L:", @true, @true)

Article ID:   W13523
Filename:   Cancel Connection Information.txt
File Created: 2001:01:29:15:05:22
Last Updated: 2001:01:29:15:05:22