Swapnil Gupta
Swapnil Gupta

Reputation: 8941

Mount Network Drive Locally in MFC(VC++)?

How to Mount Network Drive Locally in MFC(VC++) ? Currently I am using WNetAddConnection2 to mount drive but it mount drive on network, I want to mount it has locally.

Any help is appreciated. Thanks.

Upvotes: 0

Views: 766

Answers (1)

Optimal Cynic
Optimal Cynic

Reputation: 797

Do you mean that you want to use a drive letter to attach a network share? I would call the system command net, like so:

net use X: \server\share /PERSISTENT:NO

where X is the drive letter you want to use. The PERSISTENT flag prevents it from remounting on boot. When you're finished, call net again with:

net use X: /DELETE

and it will umount the share.

Upvotes: 1

Related Questions