Click here to Skip to main content
16,013,322 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to use MFC dll in C#? Pin
Heath Stewart21-Jun-04 2:08
protectorHeath Stewart21-Jun-04 2:08 
GeneralRe: How to use MFC dll in C#? Pin
ting66821-Jun-04 3:08
ting66821-Jun-04 3:08 
GeneralRe: How to use MFC dll in C#? Pin
Heath Stewart21-Jun-04 3:13
protectorHeath Stewart21-Jun-04 3:13 
GeneralDrive Share account Pin
Guinness4Strength19-Jun-04 2:49
Guinness4Strength19-Jun-04 2:49 
GeneralRe: Drive Share account Pin
Heath Stewart19-Jun-04 7:03
protectorHeath Stewart19-Jun-04 7:03 
GeneralRe: Drive Share account Pin
Guinness4Strength19-Jun-04 11:15
Guinness4Strength19-Jun-04 11:15 
GeneralRe: Drive Share account Pin
Heath Stewart20-Jun-04 9:50
protectorHeath Stewart20-Jun-04 9:50 
GeneralRe: Drive Share account Pin
Guinness4Strength21-Jun-04 5:22
Guinness4Strength21-Jun-04 5:22 
Hey Heath,
Thanks again for all your help thus far. I've setup the P/Invoke for NetApi32.dll, but I keep getting the same error so I must have done something wrong....
[DllImport("NetApi32.dll")] private static extern int NetUseGetInfo(string SrvrName,string MappedDrive,int Level,ref structUSE_INFO_2 MapInfo);
[DllImport("NetApi32.dll")] private static extern int NetApiBufferFree(ref structUSE_INFO_2 MapInfo);


[StructLayout(LayoutKind.Sequential)]
private struct structUSE_INFO_2
{
	public string sLocal;
	public string sRemote;
	public string sPassword;
	public int iType;
	public int iRefCount;
	public int iUseCount;
	public string sUsername;
	public string sDomain;
}

...
....
...
static public string GetMappedDriveUsername(string DriveLetter)
{	
	string Username=null;
	try
	{
		structUSE_INFO_2 MappInfo = new structUSE_INFO_2();
		int Err=NetUseGetInfo(null,DriveLetter.Replace(":",""),2,ref MappInfo);
                Username=MappInfo.sUsername;
		NetApiBufferFree(ref MappInfo);
	}
	catch(Exception Err)
	{
		throw new Exception("GetMappedDriveUsername Error: "+Err.Message);
	}
	return Username;
}

The error I'm getting is 2250 (This network connection does not exist. ).
I think I'm not seending the mapped drive name correctly, I've tried just the letter, letter with colon, drive description...You said you have alot of experience with these API so I thought you would be able to tell me the NetUseGetInfo's UseName parameter format.
GeneralRe: Drive Share account Pin
Heath Stewart21-Jun-04 5:26
protectorHeath Stewart21-Jun-04 5:26 
GeneralRe: Drive Share account Pin
Heath Stewart21-Jun-04 5:27
protectorHeath Stewart21-Jun-04 5:27 
GeneralRe: Drive Share account Pin
Guinness4Strength21-Jun-04 5:50
Guinness4Strength21-Jun-04 5:50 
GeneralRe: Drive Share account Pin
Heath Stewart21-Jun-04 6:26
protectorHeath Stewart21-Jun-04 6:26 
GeneralRe: Drive Share account Pin
Guinness4Strength21-Jun-04 8:13
Guinness4Strength21-Jun-04 8:13 
QuestionHow repaint the color of ColumnHead in ListView? Pin
fu019-Jun-04 1:31
fu019-Jun-04 1:31 
AnswerRe: How repaint the color of ColumnHead in ListView? Pin
Heath Stewart19-Jun-04 6:58
protectorHeath Stewart19-Jun-04 6:58 
Generalform at runtime Pin
Member 114126618-Jun-04 22:45
Member 114126618-Jun-04 22:45 
GeneralRe: form at runtime Pin
Heath Stewart19-Jun-04 7:00
protectorHeath Stewart19-Jun-04 7:00 
GeneralYahoo and C# Pin
MeterMan18-Jun-04 21:55
MeterMan18-Jun-04 21:55 
GeneralRe: Yahoo and C# Pin
Nick Parker19-Jun-04 4:41
protectorNick Parker19-Jun-04 4:41 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 6:44
MeterMan19-Jun-04 6:44 
GeneralRe: Yahoo and C# Pin
Heath Stewart19-Jun-04 6:50
protectorHeath Stewart19-Jun-04 6:50 
GeneralRe: Yahoo and C# Pin
Heath Stewart19-Jun-04 6:48
protectorHeath Stewart19-Jun-04 6:48 
GeneralRe: Yahoo and C# Pin
MeterMan19-Jun-04 10:14
MeterMan19-Jun-04 10:14 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 15:24
eggie519-Jun-04 15:24 
GeneralRe: Yahoo and C# Pin
eggie519-Jun-04 15:51
eggie519-Jun-04 15:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.