Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'Wake-Up' a shared network drive
Message
From
16/11/2001 18:22:41
 
 
To
16/11/2001 16:56:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00583008
Message ID:
00583027
Views:
29
This message has been marked as the solution to the initial question of the thread.
>Does anyone know of a way to get VFP to wake-up/activate a shared network drive?
>
>ex:
>
>- pc A has drive E: mapped to shared drive on pc B
>- turn pc B off and restart pc A
>- when pc A is booting and attempts to connect to drive E:, click cancel
>- turn pc B back on and let it boot
>- start VFP on pc A, ? DRIVETYPE('E:') returns 1, drive does not exist
>- on pc A, switch to Windows Explorer and mouse-click on E:
>- switch back to VFP, ? DRIVETYPE('E:') returns 4, removable or network drive
>
>Is there something that can be done in VFP to connect to drive E: without having too access it in Windows Explorer first?

You can call the Win32 API function WNetAddConnection2() or WNetAddConnection3() if the machine is on. If it's not on, and you have a NIC supporting "Wake On LAN", addressing the NIC's MAC address will cause the remote system to boot, and then you can use WNetAddConnection2() or WNetAddConnection3() once it's booted up.

My NETRESOURCE class, available for download in the Files section, includes a sample implementation of WNetAddConnection3(); you can also use the MapNetworkDrive method of the WSH's Wscript.Network COM object.

>
>Thanks,
>Mark
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform