I migrated the code from C++ to VS C++.Net.
I got following error.

u.ui2_local = (char *) wcsLocal;
u.ui2_remote = (char *) wcsRemote;

error C2440: '=' : cannot convert from 'char *' to 'LPWSTR' for both.

rc = NetUseDel(NULL, (char *) wcsPath, lForce ? USE_LOTS_OF_FORCE : USE_NOFORCE);

error C2664: 'NetUseDel' : cannot convert parameter 2 from 'char *' to 'LPWSTR' 

I tried removing (char *) and it works fine. I am using VS 2010. I am a newbie in Win C++.

I am not sure as removing (char *) will still produce correct output. The project is big and i can't test by removing it and running the app to see the output.

Please Advise.

Your best bet would be to create a test project with the same types of objects on both sides of the = sign. Fill the right side with values and watch it copy from right to left in the debugger.

Also, when I converted an MFC project to MFC+CLI, I had to change the character set from Unicode to "Use Multi-Byte Character Set"