Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Source Code for Hyper-terminal.

Posted on 1998-02-02
7
Medium Priority
?
2,074 Views
Last Modified: 2008-02-01
**Source Code Needed!!**
I'm wanting to write a very simple communication similar to the Hyperterminal in Win95.
The main function I need is the text file transfer through Direct Com-Port communication.
eg. Under Hyperterminal -> Tranfer ->Send Text File
0
Comment
Question by:dhuang
  • 4
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 220 total points
ID: 1455146
There are two ways to transfer files.  One would be to use the MSComm control, and use the Output method of that control.  You would have to open the file for binary read, then send the bytes as they are read.

Dim InBuff As String

Open "MyFile.txt" For Binary Input As #1

Do While Not EOF(1)
    Input #1, InBuff
    MSComm1.Output InBuff
Loop

You can also use the CreateFile, ReadFile, and WriteFile to communicate with a comm port.  This is somewhat more complicated because you are dealing directly with a comm port, and you would have to figure out your modem commands to dial, hang up and other such.

Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long

Declare Function ReadFile Lib "kernel32" Alias "ReadFile" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped As OVERLAPPED) As Long

Declare Function WriteFile Lib "kernel32" Alias "WriteFile" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As OVERLAPPED) As Long

Instead of using a file name for lpFileName in CreateFile, you would use "COM1" (or 2 or 3 depending on which comm port you are opening.  This will open the comm port and return a handle which can be used for reading and writing by the ReadFile and WriteFile functions.  You can then read or write the comm port exactly as you would a file.
0
 
LVL 1

Author Comment

by:dhuang
ID: 1455147
How about some source code?
working one.
0
 
LVL 1

Author Comment

by:dhuang
ID: 1455148
How about some source code?
working one.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:dirtdart
ID: 1455149
Unfortunatly, the only source code I have is in C.  I can provide you with examples of how to use the functions if that would suffice.
0
 
LVL 1

Author Comment

by:dhuang
ID: 1455150
Dirtdart: It would be nice if you can show me how to use the function. And if you don't mind, I would like a copy of the C source code... THANKS...

E-Mail: dhuang@upnaway.com, dhuang@dma.net.au
0
 
LVL 1

Author Comment

by:dhuang
ID: 1455151
Dirtart: Could you please send me a copy again, I've lost the file you've sent me. (I accidently Format the HDD under NT)
Thanks A Lot!!
0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1455152
OOOPS!  Sure.  No Problem.  It's on its way.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question