Help - Search - Members - Calendar
Full Version: help in adding users in C# app
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
d.vish
for (int i = 0; i < dataGridView2.Rows.Count; i++)
{
if ((Boolean)dataGridView2.Rows[i].Cells[0].Value == true)
{
try
{
// c.Command = "SET USER " + dataGridView2.Rows[i].Cells[1].Value.ToString() + " BUDDYSTATUS 2 " + txtMessage.Text + "ISAUTHORIZED TRUE";
c.Command = "SET USER " + dataGridView2.Rows[i].Cells[1].Value.ToString() + " BUDDYSTATUS 2 " + txtMessage.Text;
c.Id = 1000;
c.Blocking = true;
s.SendCommand©;

// User u = s.get_User(dataGridView2.Rows[i].Cells[1].Value.ToString());
// u.BuddyStatus = TBuddyStatus.budPendingAuthorization;

lbLog.Items.Add(dataGridView2.Rows[i].Cells[1].Value.ToString() + " is Added as Contact");
}
catch (Exception ex)
{
lbLog.Items.Add("Could not add "+dataGridView2.Rows[i].Cells[1].Value.ToString()+" due to some unavodable error ! please retry ");
}

}
}

this code is generating stackooverflow exception in C# windows application
i m using skype4com.dll ver 1.0.29 and skype 3.8 but it works well with skype 2.5 can anybody explain this ?
help needed
vish
TheUberOverlord
Why is c.Id = 1000 each time?

What is the value of dataGridView2.Rows.Count?

Where are you getting the Users to Approve from?

What is the value of i when the program abends?

Are you monitoring the Reply and Error event Handlers, if not why not?

Why not use Skype4COM methods to do this vs API commands?

Like this: http://forum.skype.com/index.php?showtopic=77768

Not sure what you are trying to do because there are 2 authorizations of Skype users.

1. Users Waiting My Authorization. ("They Asked you to Authorize them")
2. Pending Authorization. ("You asked them to Authorize you").
d.vish
thanks for reply

c.id = 1000 is a mistake ok
next i m searching for users from skype using pattern
and placing them in datagrid and then trying to add them to contacts also for small number such as 10/20 this works fine for larger it crashes
also actually the whole loop is completed successfully when it returns from the function in whihc this code is the program crashes
also to add users the API didnt work so i used commands actually i refered to another article on this forum which suggested to do this

help appreciated
thanks
d.vish
also its a pending authorization
TheUberOverlord
Set c.Blocking = true; to c.Blocking = false; and MONITOR your Reply and Error event handlers so you can see if the command request has been processed properly.

Setting c.Blocking = true; does not mean you can have hundreds/thousands of ouststanding requests pending. It is meant to be able to send a few command requests, but.....at some point you want to wait.

Setting c.Blocking = false; will pause and wait for the request to be processed, it is still your responsibility to check the Reply and Error event handlers to see if the request completed properly.
d.vish
can u plz give me some idea which event i should handle ?
thanks
TheUberOverlord
QUOTE (d.vish @ Sun Jun 22 2008, 16:17)
Go to the original post
can u plz give me some idea which event i should handle ?
thanks


Reply and Error Event Handler

You can also review and use this: http://forum.skype.com/index.php?showtopic=142821
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.