>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