por welltom » 09 Mar 2008 08:09
Obrigado leando,
Sou iniciando no VB, talves vs possa darme mais uma ajuda:
estou tentando fazer rodar (run), um aplicativo que faz acesso
as portas serial do pc, usando a plataforma , junto a pasta de
desenvolmimento tenha um arquivo com extensão.DLL, que
permite o acesso as portas do pc, mas no corpo do meu
programa estas linhas:
Private Sub Form_Load()
i = OPENCOM("COM2,1200,N,8,1")
If i = 0 Then
i = OPENCOM("COM1,1200,N,8,1")
Option1.Value = True
End If
If i = 0 Then MsgBox ("COM Interface Error")
TIMEINIT
End Sub
Private Sub Form_Unload(Cancel As Integer)
CLOSECOM
End Sub
Private Sub Option1_Click()
i = OPENCOM("COM1,1200,N,8,1")
If i = 0 Then MsgBox ("COM1 not available")
End Sub
Private Sub Option2_Click()
i = OPENCOM("COM2,1200,N,8,1")
If i = 0 Then MsgBox ("COM2 not available")
End Sub
Private Sub Command1_Click()
d = HScroll1.Value
SENDBYTE d
End Sub
Private Sub Timer1_Timer()
d = READBYTE
If d > -1 Then Text1.Text = Str$(d)
End Sub
Não estou sabendo o procedimento de como juntar estas
funções (declarations) no caixa de códigos do meu
programa, para que estas funções e sub sejam
chamadas, nas linhas abaixo temos a declaração das
mesmas, mas não sei se são lançadas todas desta
maneira ou cada uma delas individual:
Declare Function OPENCOM Lib "Port" (ByVal A$) As Integer
Declare Sub CLOSECOM Lib "Port" ()
Declare Sub SENDBYTE Lib "Port" (ByVal b%)
Declare Function READBYTE Lib "Port" () As Integer
Declare Sub DTR Lib "Port" (ByVal b%)
Declare Sub RTS Lib "Port" (ByVal b%)
Declare Sub TXD Lib "Port" (ByVal b%)
Declare Function CTS Lib "Port" () As Integer
Declare Function DSR Lib "Port" () As Integer
Declare Function RI Lib "Port" () As Integer
Declare Function DCD Lib "Port" () As Integer
Declare Sub DELAY Lib "Port" (ByVal b%)
Declare Sub TIMEINIT Lib "Port" ()
Declare Sub TIMEINITUS Lib "Port" ()
Declare Function TIMEREAD Lib "Port" () As Long
Declare Function TIMEREADUS Lib "Port" () As Long
Declare Sub DELAYUS Lib "Port" (ByVal l As Long)
Declare Sub REALTIME Lib "Port" (ByVal i As Boolean)
att.
Wellington