简体   繁体   中英

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.

You should OR the values together using the | operator, eg:

var both = CONNECT_INTERACTIVE | CONNECT_PROMPT;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM