با سلام: بهزاد جان مقاله ای که معرفی کرده بودید درست مثل مقاله ای بود که شما در بخش آموزشها ومقالات گذاشته بودید فقط با این تفاوت که درمقاله ای که معرفی کرده بودید دربخش فرستنه به 1و3 تغییر یابدRTHERSHOLDو STHERSHOL گفته شده بود که خاصیت دربخش گیرنده به 1 تغییر یابد STHERSHOLولي بااين كد را paste كردم
کد بخش گیرنده Dim Offset As Long Dim FileData As Byte Dim FileName As String ' Load event of Form ' 28800 baud, no parity, 8 data, and 1 stop bit. ' In RS-232, maximum speed of 28800 baud can be used Private Sub Form_Load() MSComm1.Settings = "28800,N,8,1" MSComm1.InputLen = 1 MSComm1.CommPort = 2 MSComm1.PortOpen = True ' Change the file path to point to the file you want to transfer FileName = "d:\sample.hlp" Offset = 1 Open FileName For Binary Access Read As #1 End Sub ' ONCOMM event of Comm OLE Control ' The following code is needed to make sure that next set of ' characters can be transmitted (CommEvent = 2 is triggered from the ' receiver side) Private Sub MSComm1_OnComm() If MSComm1.CommEvent = 2 Then temp = MSComm1.Input If Offset <= FileLen(FileName) Then Get #1, Offset, FileData q = FileData MSComm1.Output = Format(q, "000") Offset = Offset + 1 End If End If End Sub ' UnLoad event of Form Private Sub Form_Unload(Cancel As Integer) Close #1 End Sub RThreshold = 1 ' triggers when at least one char is on the buffer SThreshold = 3
بخش گیرنده Dim ByteCount As Long Dim FileData As Byte ' Load event of Form ' 28800 baud, no parity, 8 data, and 1 stop bit.
Private Sub Form_Load() MSComm1.Settings = "28800,N,8,1" MSComm1.InputLen = 3 MSComm1.CommPort = 1 MSComm1.PortOpen = True ' Change the file path to point to the file you want to store Open "c:\sample.txt" For Binary Access Write As #1 End Sub ' OnComm event Private Sub MSComm1_OnComm() If MSComm1.CommEvent = 2 And MSComm1.InBufferCount > 0 Then FileData = CInt(MSComm1.Input) ByteCount = ByteCount + 1 Put #1, ByteCount, FileData MSComm1.Output = Chr$(26) End If End Sub ' CLICK event of button Private Sub Command1_Click() MSComm1.Output = Chr$(26) End Sub ' UnLoad even of Form Private Sub Form_Unload(Cancel As Integer) Close #1 End Sub RThreshold = 3
یا علی _______________________________________________________________________ M.zare
|