Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding computer
Message
From
18/10/2001 22:14:38
 
 
To
18/10/2001 12:34:44
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00570334
Message ID:
00570604
Views:
17
>I need to find a communication app that is installed on a Win2000 box somewhere on a network. We install it in folder "suggested" by a 3rd party provider. I'd like to know if the app is running, although that isn't required. I do need to monitor a specific sub-folder and remove files as they are placed there. I've mapped a drive on my box to a drive designator and everything works, but I rather use something like "\\commserver\appsname\export\" instead.
>
>Any suggestions?
>Mike




I still use Chin Win95

There are two set of WinAPI function for network drive mapping.
First pair is to map the drive programmatically.
Last pair is to call the Explorer map drive dialog box.

You can decide use which type of API.

Currently, I donno why WOFF disconnect API always fail to do
but WON always success.

Another command was from Win95-DOS type:

!Net Use M: \\Terence\C

Net.exe is under c:\Windows
**	Add New Driver Letter on Netware
PROCEDURE WON
LPARAMETERS cShareName, cDriverLetter

DECLARE INTEGER WNetAddConnection IN Win32API STRING, STRING, STRING

IF PCOUNT() = 1
	nOk = WNetAddConnection(cShareName, .NULL., "M:")
ELSE
	nOk = WNetAddConnection(cShareName, .NULL., cDriverLetter + ":")
ENDIF
IF nOk = 0
	WAIT WINDOW cShareName + " is Successful connected!" NOWAIT
ELSE
	WAIT WINDOW cShareName + " is Failed to connect! " + ALLTRIM(STR(nOk)) + " return" NOWAIT TIMEOUT 3
ENDIF

RETURN nOk
ENDPROC

**	Delete Net Driver Letter on Netware
PROCEDURE WOFF
LPARAMETERS cDriverLetter
DECLARE INTEGER WNetCancelConnection2 IN Win32API STRING, INTEGER

IF PCOUNT() = 1
	nOk = WNetCancelConnection2("M:", 1)
ELSE
	nOk = WNetCancelConnection2(cDriverLetter + ":", 1)
ENDIF
IF nOk = 0
	WAIT WINDOW cDriverLetter + ": is Successful disconnected!" NOWAIT
ELSE
	WAIT WINDOW cDriverLetter + ": is Failed to disconnect! " + ALLTRIM(STR(nOk)) + " return" NOWAIT TIMEOUT 3
ENDIF

RETURN nOk
ENDPROC

* show Network Connect Dialog Box
PROCEDURE NETCON
#DEFINE RESOURCE_DRIVES    1
#DEFINE NO_ERROR           0    && No error occurred.
#DEFINE ERROR_CANCELLED 1223    && The user cancelled
DECLARE INTEGER WNetConnectionDialog IN Win32API;
	INTEGER HWND, INTEGER fdwResourceType
lnerr = WNetConnectionDialog(0, RESOURCE_DRIVES)
IF NOT INLIST(lnerr, NO_ERROR, ERROR_CANCELLED)
* An error occurred
ENDIF
ENDPROC

* Show Network Disconnect Dialog Box
PROCEDURE NETDIS
#DEFINE RESOURCE_DRIVES    1
#DEFINE NO_ERROR           0    && No error occurred.
#DEFINE ERROR_CANCELLED 1223    && The user cancelled
DECLARE INTEGER WNetDisconnectDialog IN Win32API;
	INTEGER HWND, INTEGER fdwResourceType
lnerr = WNetDisconnectDialog(0, RESOURCE_DRIVES)
IF NOT INLIST(lnerr, NO_ERROR, ERROR_CANCELLED)
* An error occurred
ENDIF
ENDPROC
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform