Methoden vom Object finden?

Irgendwas mach ich noch falsch.
Der Anruf wird zwar gestartet, aber ich kann ihn nicht mehr beenden.
HTML:
<html>

<head>
<meta http-equiv="Content-Language" content="de">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>

<body bgcolor="#880029">

<object classid="clsid:98898145-96E2-11D3-A1D0-444553540000" id="CPhoner" width="0" height="0" codebase=""></object>

<p>
Status: <input type="button" value="Anrufen" name="Call">&nbsp;<input type="button" value="Auflegen" name="Cancel">
<input type="hidden" value="" name="CallerIDText">
<input type="hidden" value="" name="CalledIDText">
<input type="hidden" value="" name="StatusText">
<input type="hidden" value="<?=$id?>" name="Number">
</p>

<script language="vbscript">
<!--
public sub Call_onClick  
    CPhoner.MakeCall Number.value
end sub

public sub Cancel_onClick
    CPhoner.GetState CallID, CID
    CPhoner.DisconnectCall CallID 
end sub

public sub CPhoner_OnChangeState(CallID)
    dim StatusString
    dim CallerIDString
    dim CalledIDString

    StateString = ""
    CallerIDString = ""
    CalledIDString = ""

    CPhoner.GetState CallID, StateString
    StatusText.value = StateString

    CPhoner.GetCallerID CallID, CallerIDString
    CallerIDText.value = CallerIDString

    CPhoner.GetCalledID CallID, CalledIDString
    CalledIDText.value = CalledIDString
end sub
-->
</script>

</body>

</html>
 
Kann mir jemand sagen von wo der Wert lvCalls.SelectedItem geholt wird.
Ich bin nicht so fit in VB. Genau gesagt gar nicht :)
Visual Basic:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form MainForm 
   Caption         =   "PhonerCOM - VB-Sample"
   ClientHeight    =   2565
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5895
   Icon            =   "MainForm.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   2565
   ScaleWidth      =   5895
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton btDisconnect 
      Caption         =   "Disconnect"
      Height          =   495
      Left            =   3840
      TabIndex        =   4
      Top             =   240
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "destination number"
      Height          =   735
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   2175
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   1935
      End
   End
   Begin MSComctlLib.ListView lvCalls 
      Height          =   1575
      Left            =   0
      TabIndex        =   1
      Top             =   960
      Width           =   5895
      _ExtentX        =   10398
      _ExtentY        =   2778
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      FullRowSelect   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   5
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "ID"
         Object.Width           =   1305
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "State"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "Direction"
         Object.Width           =   1305
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Text            =   "CallerID"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   4
         Text            =   "CalledID"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.CommandButton btDial 
      Caption         =   "Dial"
      Height          =   495
      Left            =   2400
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public WithEvents myPhoner As CPhoner
Attribute myPhoner.VB_VarHelpID = -1

Private Sub btDial_Click()
    Dim number As String
    number = Text1.Text
    If number = "" Then
        myPhoner.MakeCall ("")
    Else
        myPhoner.MakeCall (number)
    End If
End Sub

Private Sub btDisconnect_Click()
    Dim Item As ListItem
    Dim CallID As Long
    
    Set Item = lvCalls.SelectedItem
    If Not (Item Is Nothing) Then
        CallID = Val(Item.Text)
        myPhoner.DisconnectCall (CallID)
    End If
End Sub

Private Sub Form_Load()
    Set myPhoner = New CPhoner
End Sub

Private Sub myPhoner_OnChangeState(ByVal CallID As Long)
    Dim Item As ListItem
    Dim Status As TCallState
    Dim Direction As TDirection
    Dim CallerID As String
    Dim CalledID As String
    
    Set Item = lvCalls.FindItem(Str(CallID))
    If myPhoner.GetCallInfo(CallID, Status, Direction, CallerID, CalledID) <> 0 Then
    
        ' create new item if new call (item not found)
        If (Item Is Nothing) Then
            Set Item = lvCalls.ListItems.Add
            Item.Text = Str(CallID)
        End If
        
        ' update state of call
        Select Case Status
             Case Idle: Item.SubItems(1) = "idle"
             Case Offering: Item.SubItems(1) = "offering"
             Case Connecting: Item.SubItems(1) = "connecting"
             Case Connected: Item.SubItems(1) = "connected"
             Case Disconnecting: Item.SubItems(1) = "disconnecting"
        End Select
        
        ' update direction of call
        Select Case Direction
            Case Incoming: Item.SubItems(2) = "in"
            Case Outgoing: Item.SubItems(2) = "out"
        End Select
        
        ' update CallerID
        Item.SubItems(3) = CallerID
        
        ' update CalledID
        Item.SubItems(4) = CalledID
        
        If (Status = Idle) Then
          lvCalls.ListItems.Remove (Item.Index)
        End If
    Else
        If Not (Item Is Nothing) Then
            lvCalls.ListItems.Remove (Item.Index)
        End If
    End If
End Sub
 
Geholt wird er hier
Code:
          Set Item = lvCalls.SelectedItem
 112.
          If Not (Item Is Nothing) Then
 113.
              CallID = Val(Item.Text)

Gesetzt wird er hier :

Code:
 129. 
       Set Item = lvCalls.FindItem(Str(CallID))
 130.
          If myPhoner.GetCallInfo(CallID, Status, Direction, CallerID, CalledID) <> 0 Then
 131.
         
 132.
              ' create new item if new call (item not found)
 133.
              If (Item Is Nothing) Then
 134.
                  Set Item = lvCalls.ListItems.Add
 135.
                  Item.Text = Str(CallID)

zur Information es handelt sich um Werte die in eine Listbox geschrieben und wieder ausgelesen werden

Grüsse bb


PS: Etwas weniger ist oft mehr ;-)
 
Es geht mir nur darum, die CallID zu ermitteln. Ich komme einfach nicht weiter :(
Visual Basic:
public sub Cancel_onClick
    CPhoner.DisconnectCall ? 
end sub
 
es gibt eigentlich nur zwei Möglichkeiten (zumindest für mich da ich das nicht testen kann :D)

die Methode GetState die es wohl nicht ist denn das hattest du schon versucht ;-)

oder wie eben oben gepostet die Methode GetCallInfo aus Zeile 130 deines Beispiels

Code:
 If myPhoner.GetCallInfo(CallID, Status, Direction, CallerID, CalledID) <> 0 Then
wenn das auch nicht funktioniert dann weiß ich leider auch nicht weiter

Grüsse bb

PS: ich bin sicher das das funktioniert :D
 
Also praktisch so:
Visual Basic:
public sub Cancel_OnClick
	CPhoner.GetCallInfo CallID
	CPhoner.DisconnectCall CallID
end sub
 
Ja genau so. Da dies wohl nicht funktioniert lass dir doch mal die CallId ausgeben einmal in der Funktion onChangeState direkt nachdem die Verbindung aufgebaut wurde und einmal im button Click
 
Zurück