Einzelnen Beitrag anzeigen

msickel

Registriert seit: 14. Mai 2005
108 Beiträge
 
Delphi 2005 Professional
 
#1

VB to Delphi bräuchte Unterstützung

  Alt 13. Mär 2011, 14:10
Hallo ihr lieben Spezialisten

Ich versuche diesen VB Quelltext nach Delphi zu Übersetzen.

Delphi-Quellcode:
’ This sample code changes Personal Status to "In a Meeting"
Private WithEvents oSession As Session
Private Sub Command1_Click()
’ Session and User object variables
Dim oSession As New Session
Dim oUser As User
’ Variables to hold the collection of Personal Status objects for user
Dim oPersonalStatusFolder As Folder
Dim oPersonalStatus As TeleVantage.PersonalStatus
’ Log on to the TeleVantage Server.
’ “32402” is a unique number used to identify the application using this Session object.
    oSession.Logon "Server_Name", "Joe Smith", "****", 2, tvApplicationTypeClient, "32402", , False
’ Get the User object
Set oUser = oSession.User
    
’ Get the Personal Status Folder
Set oPersonalStatusFolder = oSession.GetDefaultFolder(tvFolderPersonalStatus)
    
’ Look at each Personal status object in the folder until we find "*In A Meeting"
’ Note that the Name field of statuses are prefixed with "*"
For Each oPersonalStatus In oPersonalStatusFolder.Items
        If oPersonalStatus.Name = "*In A Meeting" Then
            ’ Use the ApplyStatus method with our "*In A Meeting" Personal status object
            oUser.ApplyStatus oPersonalStatus
        End If
    Next
    
’ Destroy objects and log off Server
    Set oUser = Nothing
    Set oPersonalStatusFolder = Nothing
    Set oPersonalStatus = Nothing
    oSession.LogOff
End SubCHAPTER 2. THE CLIENT API 2-33
TELEVANTAGE DEVELO

das habe ich schon und das funktioniert bis dahin auch.


Delphi-Quellcode:

  oCallFolder, oCallFolderHistory, oPersonalStatusFolder : Televantage_TLB.Folder;
  oCallItems, oCallItemsHistory : Televantage_TLB.Items;
  oPersonalStatus : Televantage_TLB.PersonalStatus;
  oUser : Televantage_TLB.User;



try
      oSession.Logon(AdvEdit6.Text,AdvEdit7.Text,AdvEdit8.Text,StrToInt(AdvEdit9.Text),tvApplicationTypeClient,34512,0,false,eStationUsage);
      if oSession.Status = tvSessionStatusLoggedOn then
      begin
// tchkLogon.Enabled := True;
// CoolTrayIcon1.IconIndex := 8;
// CoolTrayicon1.Hint := Application.Exename + #13#10 + 'logon ok - ready for input';
// CoolTrayIcon1.IconVisible := True;


        // Register for Call Events
        oCallFolder := oSession.GetDefaultFolder(tvFolderCalls);
        oCallItems := oCallFolder.Items;
        // Register for HistoryCall Events
        //oCallFolderHistory := oSession.GetDefaultFolder(tvFolderCallHistory);
        //oCallItemsHistory := oCallFolderHistory.Items;

        oUser := oSession.User;
        oPersonalStatusFolder := oSession.GetDefaultFolder(tvFolderPersonalStatus);

        



       // oSystemTargetFolder1 := v7Session1.GetDefaultFolder(tvFolderSystemTarget);
       // oTarget1 := _SystemTarget(oSystemTargetFolder1.Items.Item(AdvEdit7.Text,tvSearchkey));


      end;
    except
      AdvSmartMessageBox1.Messages.Items[2].Show;
      lblStatus.Caption := 'Error logon to Televantage Server';
      JFCLogFile1.LogText := 'btnLogOnLogOff -> Error logon to Televantage Server';

      Application.Terminate;
    end;
    btnLogOnLogOff.Caption := 'logoff';
    btnLogOnLogOff.Refresh;
    AdvSmartMessageBox1.Hide(0);
  end
  else
  begin
    oSession.LogOff;
    btnLogOnLogOff.Caption := 'logd off';
    AdvSmartMessageBox1.Messages.Items[0].Hide;
  end;

bin für jede Hilfe dankbar

Martin
ich weiss, das ich nichts weiss!

Geändert von msickel (13. Mär 2011 um 14:22 Uhr)
  Mit Zitat antworten Zitat