mutexはアンコちゃんが起動していることをチェックするために使っています。
無いと、tryでエラー処理する間の時間がちょっとかかるかもしれないです。
c#
nicoviewLink.RemoteObject remo = new nicoviewLink.RemoteObject();
try
{
using (var mutex = new System.Threading.Mutex(false, ankoname))
{
if (!mutex.WaitOne(0, false))
{
remo.RemotePostOwnerComment("なまえ", "ここに文章", "コマンド");
}
}
}
catch { }
vb
Sub PostComment(msg As String, cmd As String)
Dim remo As nicoviewLink.RemoteObject = New nicoviewLink.RemoteObject()
Try
Using mutex = New System.Threading.Mutex(False, ankoname)
If (Not mutex.WaitOne(0, False)) Then
remo.RemotePostComment(msg, cmd)
End If
End Using
Catch ex As Exception
End Try
End Sub