vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Top-Preis! AP-Access-Tools-CD Volume 1  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Lösung - Teil 2 
Autor: Blacky
Datum: 08.08.08 13:01

Public Sub Connect(ByVal Number As String)
 
        Dim Index, RegCookie, MediaTypes, T As Integer
        Dim Found As Boolean
        Dim hcomm As Microsoft.Win32.SafeHandles.SafeFileHandle
        Dim Mediasupport As ITMediaSupport
 
        If IsNothing(_myAddress) And _useDevice = "" Then Throw New _
          ApplicationException("Device wurde noch nicht zugewiesen!")
        If IsNothing(_myAddress) And _useDevice <> "" Then
            For Index = 1 To _myAddresses.Count
                Dim Def As ITAddress
                Def = CType(_myAddresses.Item(Index), ITAddress)
                If Def.AddressName = _useDevice Then Found = True : _myAddress _
                  = Def : Exit For
            Next
        End If
 
        'Eventhandler aktivieren
        Mediasupport = CType(_myAddress, ITMediaSupport)
        MediaTypes = Mediasupport.MediaTypes
        Mediasupport = Nothing
        RegCookie = _myTapi.RegisterCallNotifications(_myAddress, True, False, _
          MediaTypes, 1)
        _myTapi.EventFilter = (TAPI_EVENT.TE_CALLNOTIFICATION Or _
        TAPI_EVENT.TE_CALLSTATE Or TAPI_EVENT.TE_CALLINFOCHANGE)
 
        'Verbindung herstellen
        _myCall = _myAddress.CreateCall(Number, _
          TapiConstants.LINEADDRESSTYPE_PHONENUMBER, _
          TapiConstants.TAPIMEDIATYPE_DATAMODEM)
        _myCall.Connect(True)
        For t = 0 To 2000 : Application.DoEvents() : Next
        If _ConnState = False Then Throw New ApplicationException("Verbindung" & _
          "konnte nicht hergestellt werden!")
 
        'Verbindungshandle an den Filestream binden
        hcomm = New Microsoft.Win32.SafeHandles.SafeFileHandle( _
          Marshal.ReadIntPtr(CType(_myCall, _
          ITLegacyCallMediaControl2).GetIDAsVariant("comm/datamodem"), 0), True)
        fs = New System.IO.FileStream(hcomm, IO.FileAccess.ReadWrite, 256, True)
 
    End Sub
 
    Public Function Read() As String
        Dim inStream(256) As Byte, ClearText As String
        Dim ascBuffer As New System.Text.ASCIIEncoding
        If _ConnState = False Then Throw New ApplicationException("Device hat" & _
          "keine Verbindung!")
        fs.Read(inStream, 0, inStream.Length - 1)
        ClearText = ascBuffer.GetString(inStream).Replace(Chr(0), "")
        Debug.WriteLine("Reading :" & ClearText)
        Return ClearText
    End Function
 
    Public Sub Write(ByVal Text As String)
        Dim ascBuffer As New System.Text.ASCIIEncoding
        Dim outStream() As Byte = ascBuffer.GetBytes(Text)
        If _ConnState = False Then Throw New ApplicationException("Device hat" & _
          "keine Verbindung!")
        Debug.WriteLine("Writing: " & Text)
        fs.Write(outStream, 0, outStream.Length - 1)
        fs.Flush()
    End Sub
 
    Private Sub _myTapi_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal _
      pEvent As Object) Handles _myTapi.Event
        If TapiEvent = TAPI_EVENT.TE_CALLSTATE Then
            CallStateObject = CType(pEvent, ITCallStateEvent)
            CallStateEvent()
        End If
    End Sub
 
    Private Sub CallStateEvent()
 
        Select Case CallStateObject.State
 
            Case CALL_STATE.CS_IDLE
            Case CALL_STATE.CS_INPROGRESS
            Case CALL_STATE.CS_OFFERING
            Case CALL_STATE.CS_CONNECTED
                _ConnState = True
            Case CALL_STATE.CS_QUEUED
            Case CALL_STATE.CS_HOLD
            Case CALL_STATE.CS_DISCONNECTED
                _ConnState = False
 
        End Select
    End Sub
 
End Class

VB RULEZ !

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Suche Übersetzungshilfe für C-Code Snippet2.904Blacky16.07.08 19:55
Re: Suche Übersetzungshilfe für C-Code Snippet2.355Melkor16.07.08 20:35
Re: Suche Übersetzungshilfe für C-Code Snippet2.264Blacky16.07.08 20:48
Re: Suche Übersetzungshilfe für C-Code Snippet2.292Blacky16.07.08 21:48
Re: Suche Übersetzungshilfe für C-Code Snippet2.292Moderatorralf_oop16.07.08 22:12
Re: Suche Übersetzungshilfe für C-Code Snippet2.316Blacky16.07.08 22:32
Re: Suche Übersetzungshilfe für C-Code Snippet2.265Moderatorralf_oop16.07.08 23:38
Re: Suche Übersetzungshilfe für C-Code Snippet2.307Melkor17.07.08 08:14
Re: Suche Übersetzungshilfe für C-Code Snippet2.303Blacky16.07.08 23:58
Re: Suche Übersetzungshilfe für C-Code Snippet2.442Moderatorralf_oop17.07.08 10:43
Re: Suche Übersetzungshilfe für C-Code Snippet2.325Blacky16.07.08 23:58
Re: Suche Übersetzungshilfe für C-Code Snippet2.353Blacky17.07.08 13:30
Re: Suche Übersetzungshilfe für C-Code Snippet2.389Blacky05.08.08 18:49
Re: Suche Übersetzungshilfe für C-Code Snippet2.313ModeratorFZelle05.08.08 20:25
Re: Suche Übersetzungshilfe für C-Code Snippet2.232Blacky05.08.08 21:51
Lösung - Teil 12.230Blacky08.08.08 12:58
Lösung - Teil 22.593Blacky08.08.08 13:01
Re: Suche Übersetzungshilfe für C-Code Snippet2.228Blacky08.08.08 13:05

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel