Miki Shah
Miki Shah

Reputation: 815

How to set CONNECT_PROMPT of WNetAddConnection2?

I have C# .Net windows application and using WNetAddConnection2 to connect network share folder. I want to validate SharedFolder with username/password with access rights. Please refer detail explanation of class at http://msdn.microsoft.com/en-us/library/windows/desktop/aa385413(v=vs.85).aspx

For CONNECT_PROMPT, it is instruction in msdn that "This flag is ignored unless CONNECT_INTERACTIVE is also set." My code like

 var result = WNetAddConnection2(netResource,credentials.Password,userName,0x00000010//CONNECT_PROMPT]);

So Question is how to set both CONNECT_INTERACTIVE and CONNECT_PROMPT for class to prompt username and password for shared folder?

Any help would be appreciated.

Upvotes: 1

Views: 1342

Answers (1)

John Willemse
John Willemse

Reputation: 6698

You should OR the values together using the | operator, e.g.:

var both = CONNECT_INTERACTIVE | CONNECT_PROMPT;

Upvotes: 3

Related Questions