Hello,

for an application I need the current username and the context from the
User. I insert the following C#-code:


Code:
--------------------
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void buttonGetNovellUserName_Click(object sender, EventArgs e)
{
int context = 0;
IcNovell.NWDSCreateContextHandle(ref context);
StringBuilder username = new StringBuilder(256);
IcNovell.NWDSWhoAmI(context, username);
labelUserName.Text = username.ToString();
IcNovell.NWDSFreeContext(context);
}
}

public class IcNovell
{
[DllImport("netwin32.dll", EntryPoint = "NWDSCreateContextHandle")]
public static extern int NWDSCreateContextHandle(ref int context);
[DllImport("netwin32.dll", EntryPoint = "NWDSWhoAmI")]
public static extern int NWDSWhoAmI(int context, StringBuilder NovellUserId);
[DllImport("netwin32.dll", EntryPoint = "NWDSFreeContext")]
public static extern int NWDSFreeContext(int context);
}
--------------------


I get the username but I dont get the Context. There is only a "1" in
the variable. Can someone help?


--
dimitribefuss
------------------------------------------------------------------------
dimitribefuss's Profile: http://forums.novell.com/member.php?userid=127800
View this thread: http://forums.novell.com/showthread.php?t=456405