Entwickler-Ecke

Sonstiges (Delphi) - Quelltext konvertierung (Elexs Reaktionsmesser)


Hatebreeder - So 16.02.03 15:56
Titel: Quelltext konvertierung (Elexs Reaktionsmesser)
Hi!

Ich möchte folgenden Quelltext in Delphi konvertieren bzw. in mein Programm einbinden.


Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
Declare Function OPENCOM Lib "RSLINE.DLL" (ByVal A As Integer) As Integer
Declare Sub Delay Lib "RSLINE.DLL" (ByVal Zeit As Integer)
Declare Sub DTR Lib "RSLINE.DLL" (ByVal An As Integer)
Declare Sub RTS Lib "RSLINE.DLL" (ByVal An As Integer)
Declare Sub TXD Lib "RSLINE.DLL" (ByVal An As Integer)
Declare Function CTS Lib "RSLINE.DLL" () As Integer
Declare Function DCD Lib "RSLINE.DLL" () As Integer
Declare Function DSR Lib "RSLINE.DLL" () As Integer
Declare Function RI Lib "RSLINE.DLL" () As Integer
Declare Sub TimeInit Lib "RSLINE.DLL" ()
Declare Function TIMEREAD Lib "RSLINE.DLL" () As Integer

Dim Zaehler
Dim Zaehler_alt
Dim Zustand

Sub Command1_Click ()
  Timer1.Enabled = True
End Sub

Sub Command2_Click ()
  Timer1.Enabled = False
End Sub

Sub Command3_Click ()
  Zaehler = 0: Zaehler_alt = 0
  TimeInit
  Text1.Text = Str$(Zaehler)
End Sub

Sub Form_Load ()
 If App.PrevInstance Then
    msg$ = App.EXEName & " wurde bereits gestartet "
    MsgBox msg$, 48
    End
 End If
 i = OPENCOM(2)
 If i = 0 Then
    i = OPENCOM(1)
    Option1.Value = True
 End If
 If i = 0 Then MsgBox ("Schnittstelle nicht verfügbar")
         
 TimeInit
 Zaehler = 0: Zaehler_alt = 0
 Zustand = 0
 RTS 1
 DTR 1
 TXD 1
End Sub


Sub Form_Unload (Cancel As Integer)
  Timer1.Enabled = False
  End
End Sub

Sub Option1_Click ()
 i = OPENCOM(1)
 If i = 0 Then MsgBox ("COM1 nicht verfügbar")
 RTS 1
 DTR 1
 TXD 1
End Sub

Sub Option2_Click ()
 i = OPENCOM(2)
 If i = 0 Then MsgBox ("COM2 nicht verfügbar")
 RTS 1
 DTR 1
 TXD 1
End Sub

Sub Timer1_Timer ()
  While DSR() = 1
    DoEvents
  Wend
  RTS 1
  TimeInit
  While (DSR() = 0) And (TIMEREAD() < 2001)
    Text1.Text = Str$(TIMEREAD()) + " ms"
    DoEvents
  Wend
  RTS 0
  Timer1.Interval = 1500 + Rnd * 2000
End Sub


Kann mir irgendwer helfen? Thx!


bis11 - So 16.02.03 17:54

Das ist doch Visual Basic oder irre ich mich da ?


Hatebreeder - So 16.02.03 18:38

jo glaub schon...
habe aber leider keine ahnung wie ich anfangen soll =/


bis11 - So 16.02.03 18:48

Also ich versuche es mal :


Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Declare Function OPENCOM Lib "RSLINE.DLL" (ByVal A As Integer) As Integer 
Declare Sub Delay Lib "RSLINE.DLL" (ByVal Zeit As Integer) 
Declare Sub DTR Lib "RSLINE.DLL" (ByVal An As Integer) 
Declare Sub RTS Lib "RSLINE.DLL" (ByVal An As Integer) 
Declare Sub TXD Lib "RSLINE.DLL" (ByVal An As Integer) 
Declare Function CTS Lib "RSLINE.DLL" () As Integer 
Declare Function DCD Lib "RSLINE.DLL" () As Integer 
Declare Function DSR Lib "RSLINE.DLL" () As Integer 
Declare Function RI Lib "RSLINE.DLL" () As Integer 
Declare Sub TimeInit Lib "RSLINE.DLL" () 
Declare Function TIMEREAD Lib "RSLINE.DLL" () As Integer


In diesem Teil werden die Funktionen der RSLINE.DLL deklariert.


Quelltext
1:
2:
3:
Dim Zaehler 
Dim Zaehler_alt 
Dim Zustand


Dieser Teil legt Variablen fest.


Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Sub Command1_Click () 
  Timer1.Enabled = True 
End Sub 

Sub Command2_Click () 
  Timer1.Enabled = False 
End Sub 

Sub Command3_Click () 
  Zaehler = 0: Zaehler_alt = 0 
  TimeInit 
  Text1.Text = Str$(Zaehler) 
End Sub


Hier wird auf die Butonclicks reagiert. Der letzte Teil behandelt nur noch, was passieren soll, wenn dir Form angezeigt wird und wenn Sie geschlossen wird.

Wie gesagt, alle Angaben ohne Gewähr.


Hatebreeder - So 16.02.03 21:02

schonma thx aber wie muss ich das in delphi schreiben?


Physikerpepe - Di 07.12.04 23:16

Nun das posting ist zwar über 1.5 Jahre alt, aber hier die Antwort :-)

http://www.delphi-forum.de/viewtopic.php?t=29123&highlight=