Click here to Skip to main content
15,891,657 members
Home / Discussions / C#
   

C#

 
AnswerRe: Send EnterKey to telnet Pin
Heath Stewart5-Nov-05 11:45
protectorHeath Stewart5-Nov-05 11:45 
QuestionCan't parse SOAP with XPath Pin
Zhornyk5-Nov-05 3:23
Zhornyk5-Nov-05 3:23 
AnswerRe: Can't parse SOAP with XPath Pin
leppie5-Nov-05 3:32
leppie5-Nov-05 3:32 
GeneralRe: Can't parse SOAP with XPath Pin
Zhornyk5-Nov-05 4:00
Zhornyk5-Nov-05 4:00 
GeneralRe: Can't parse SOAP with XPath Pin
leppie5-Nov-05 4:14
leppie5-Nov-05 4:14 
QuestionNetLocalGroupAddMembers Pin
g00fyman5-Nov-05 0:14
g00fyman5-Nov-05 0:14 
AnswerRe: NetLocalGroupAddMembers Pin
S. Senthil Kumar5-Nov-05 2:02
S. Senthil Kumar5-Nov-05 2:02 
GeneralRe: NetLocalGroupAddMembers Pin
g00fyman5-Nov-05 2:12
g00fyman5-Nov-05 2:12 
yes i have.

the MS API says that the buf is '... The buf parameter points to an array of LOCALGROUP_MEMBERS_INFO_3 structures. ...'

thats why i tried the LOCALGROUP_MEMBERS_INFO_3[] in the signature

i think the problem is that the buf should be an IntPtr and not what is in that signature, but i need someone to clarify this. if it is suppose to be an IntPtr then how do i allocate the size of the LOCALGROUP_MEMBERS_INFO_3 as byte[] in mem ?

this is what i have now
<br />
[DllImport("Netapi32.dll")]<br />
    extern static int NetLocalGroupAddMembers(<br />
      [MarshalAs(UnmanagedType.LPWStr)] string servername,<br />
      [MarshalAs(UnmanagedType.LPWStr)] string groupname,<br />
      int level,<br />
      ref /*IntPtr*/ LOCALGROUP_MEMBERS_INFO_3 buf,<br />
      int totalentries<br />
    );<br />
<br />
public bool NetLocalGroupAddMember(string groupname, string username)<br />
    {      <br />
      LOCALGROUP_MEMBERS_INFO_3 member = new LOCALGROUP_MEMBERS_INFO_3();<br />
      member.domainandname = Environment.UserDomainName + @"\" + username;<br />
<br />
      //LOCALGROUP_MEMBERS_INFO_3[] members = new LOCALGROUP_MEMBERS_INFO_3[] { member };<br />
<br />
      //IntPtr bufPtr = Marshal.AllocHGlobal(2048); // how do i do this ???<br />
      //Marshal.StructureToPtr(members, bufPtr, true); // how do i do this line also ???<br />
<br />
      int retVal = NetLocalGroupAddMembers(SERVER_NAME, LocalUserManager.DEFAULT_GROUPNAME, 3, ref /*bufPtr*/ member, 1);<br />
<br />
      if (retVal != (int)NERR_GROUP_MEMBER_ADD.NERR_Success)<br />
      {<br />
        MessageBox.Show("Error Adding Member to Group",<br />
         "Error",<br />
         MessageBoxButtons.OK,<br />
         MessageBoxIcon.Error);<br />
         return false;<br />
      }<br />
      return true;<br />
    }<br />


kind regards,
g00fy
GeneralRe: NetLocalGroupAddMembers Pin
S. Senthil Kumar5-Nov-05 3:26
S. Senthil Kumar5-Nov-05 3:26 
GeneralRe: NetLocalGroupAddMembers Pin
g00fyman5-Nov-05 11:33
g00fyman5-Nov-05 11:33 
GeneralRe: NetLocalGroupAddMembers Pin
g00fyman5-Nov-05 12:05
g00fyman5-Nov-05 12:05 
GeneralRe: NetLocalGroupAddMembers Pin
S. Senthil Kumar6-Nov-05 19:02
S. Senthil Kumar6-Nov-05 19:02 
QuestionTrain free @Microsoft Pin
vikas amin4-Nov-05 22:50
vikas amin4-Nov-05 22:50 
AnswerRe: Train free @Microsoft Pin
Glaxalg7-Nov-05 6:19
Glaxalg7-Nov-05 6:19 
QuestionTrain free @Microsoft Pin
vikas amin4-Nov-05 22:50
vikas amin4-Nov-05 22:50 
QuestionCreate Array In Method Paremeters Pin
budidharma4-Nov-05 19:54
budidharma4-Nov-05 19:54 
AnswerRe: Create Array In Method Paremeters Pin
leppie4-Nov-05 20:52
leppie4-Nov-05 20:52 
AnswerRe: Create Array In Method Paremeters Pin
Jon Rista8-Nov-05 7:06
Jon Rista8-Nov-05 7:06 
QuestionReading XML attribute and write into datagrid Pin
dunbshy4-Nov-05 14:47
dunbshy4-Nov-05 14:47 
AnswerRe: Reading XML attribute and write into datagrid Pin
Jon Rista4-Nov-05 16:04
Jon Rista4-Nov-05 16:04 
GeneralRe: Reading XML attribute and write into datagrid Pin
dunbshy5-Nov-05 3:32
dunbshy5-Nov-05 3:32 
GeneralRe: Reading XML attribute and write into datagrid Pin
Jon Rista5-Nov-05 9:55
Jon Rista5-Nov-05 9:55 
GeneralRe: Reading XML attribute and write into datagrid Pin
dunbshy5-Nov-05 11:46
dunbshy5-Nov-05 11:46 
GeneralRe: Reading XML attribute and write into datagrid Pin
Jon Rista8-Nov-05 6:58
Jon Rista8-Nov-05 6:58 
Questioncalling a C# dll from an unmanaged C++ dll Pin
tmp04-Nov-05 13:56
tmp04-Nov-05 13:56 

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.