VB to Delphi bräuchte Unterstützung
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 |
AW: VB to Delphi bräuchte Unterstützung
Kannst du bitte konkret schreiben, was noch übersetzt werden muss oder was eventuell nicht funktioniert!?
Glaub nicht, dass viele Leute erstmal Zeile für Zeile gucken möchten, was noch fehlt. Grüße, Tony Edit: Und was ist das für ein Code-Stück, gehört das zu einem Chatprogramm? |
AW: VB to Delphi bräuchte Unterstützung
Das alles kannst du vergessen..
Zitat:
Zitat:
welche mit getter und setter und Events gefüllt ist. Ohne die Classe kannst du hier nichts übersetzen. Die Events dieser Classe sind im Kopf (Public) exclusiv eingebunden. gruss |
AW: VB to Delphi bräuchte Unterstützung
Zitat:
Hauptsächlich gehts mir um die For Each Schleife!
Delphi-Quellcode:
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 Martin |
AW: VB to Delphi bräuchte Unterstützung
Delphi-Quellcode:
Die Schleife wird solange durchlaufen bis kein item in oPersonalStatusFolder mehr gefunden wird.
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 Wird der Eintrag "In A Meeting" gefunden wird der ApplyStatus aktualisiert. Normalerweise gehört hier in dem Fall noch ein "Exit For" dazu damit er rausspringen kann wenn das ergebnis true ist. gruss |
AW: VB to Delphi bräuchte Unterstützung
Delphi-Quellcode:
For i := 0 to oPersonalStatusFolder.Items.Count - 1 do
|
AW: VB to Delphi bräuchte Unterstützung
Zitat:
gruss |
AW: VB to Delphi bräuchte Unterstützung
So müsste es wohl prinzipiell aussehen
Delphi-Quellcode:
aber wie Emil schon geschrieben hat, man kann das so nicht übersetzen, da man die komplette verwendete Klasse übersetzen muss. (Siehst du ja bei "AnzahlDerElementeVon_oPersonalStatusFolder.It ems" ... da muss man wissen, was der Typ für Optionen bietet, um die Anzahl der Elemente zu bekommen)
for i:=0 to AnzahlDerElementeVon_oPersonalStatusFolder.Items - 1 do
begin if oPersonalStatusFolder.Items[i].Name = '*In A Meeting' then oUser.ApplyStatus(oPersonalStatusFolder.Items[i]); end; |
AW: VB to Delphi bräuchte Unterstützung
Zitat:
Da er aber nicht über die Klasse verfügt und nicht weiß was dort steht geht es nun mal nicht. Aber das sagtest du schon. ;) Es sei denn er hat sie und macht sich die arbeit diese zu übersetzen. gruss |
AW: VB to Delphi bräuchte Unterstützung
Zitat:
das hatte ich auch schon so war mir aber nicht sicher ob das richtig ist. noch eine Frage, wie würde den das übersetzt?
Delphi-Quellcode:
MartinPrivate WithEvents oSession As Session Dim oSession As New Session |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz