Solved

Is There any fax program?

Posted on 1998-06-14
6
230 Views
Last Modified: 2010-05-03
Thanks for your replay.

But what I want is the VB SAMPLE SOURCE, not the application program.

I am making Fax Server with VB.  So, I need the Sample code about this for reference.
 
0
Comment
Question by:hanbi
6 Comments
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1463301
The simple solution to send FAXs is to use a print function but change the default printer.
There is a fax tool in www.componentsource.com 'faxman'

0
 

Author Comment

by:hanbi
ID: 1463302
Edited text of question
0
 
LVL 1

Accepted Solution

by:
khaledc earned 120 total points
ID: 1463303
If you need a Fax program you can always use Microsoft Inbox (with a Fax Modem) to send and receive faxes. On the other hand, if you are trying to write a program that send and receive fax then you have to go over Microsoft Comm Control and you have to know what sort of Fax Modem you have (in terms of communicating with it by an RS232).
hope that could help.

0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:hanbi
ID: 1463304
khaledc,

Thanks your kind reply.

I have CLASS2 fax modem,
and I am trying to program with MScomm control as follow.

but, this doesn't  work well.

Text command is well sent to modem.  so, Phase 1 and Phase 2 is OK.

From Phase 3  program is stopped. xon isn't received. so xon loop isn't
exited.
and then  I try to skip the xon loop. But the g3 binary file isn't sent to Modem.
I think the g3binary file isn't written on  comport.
why isn't the binary data sent to modem?
Is it relative to setting Mscomm property?

   
================================================================
Option Explicit
 Dim InString As String

Private Sub cmdSend_Click()
   
    'Initialize Modem & Open Port
    If Not MSComm1.PortOpen Then OpenCom
   
    'Set Fax Modem(CLASS2)
    SetupModem
   
    'open g3file
    Open "g3.fax" For Binary As #1
   
    ''''''''''''''''''''''''''''''''
    'Phase A: Call establishment
    ''''''''''''''''''''''''''''''''
    MSComm1.Output = "ATD" & "5557655" & vbCrLf
    'wait OK from Modem
    ReadModem
   

    '''''''''''''''''''''''''''''''''''''
    'Phase B: Pre=message negotiations
    '''''''''''''''''''''''''''''''''''''''
    MSComm1.Output = "AT+FDT" & vbCrLf
   
    'Wait CONNECT from Modem
    Do
        If MSComm1.InBufferCount Then
            InString = MSComm1.Input
            If InStr(InString, "CONNECT") Then
                InString = ""
                Exit Do
            End If
            DoEvents
        End If
    Loop
   

    ''''''''''''''''''''''''''''''''''''''''''''
    'Phase C: Message Transmission
    '''''''''''''''''''''''''''''''''''''''''''''
    'Wait XON from Modem
    Do
        If MSComm1.InBufferCount Then
                InString = MSComm1.Input
                If InStr(InString, Chr(17)) Then
                    InString = ""
                    Exit Do
                End If
        End If
    Loop
   
    'transfer fax file
   
    'real fax data is begun at 153byte. G3 header is skipped
    Seek 1, &H153
   
    Dim i As Long
    Dim Temp As String
   

    For i = 1 To LOF(1)
        Temp = Space$(1)
        Get #1, , Temp
       
        'if a DLE is found, Then Add a DLE
        If Temp = Chr(16) Then
            MSComm1.Output = Chr(16)
            MSComm1.Output = Chr(16)
        Else
            MSComm1.Output = Temp
        End If
    Next i
   
    'Send <DLE> , <ETX> to Modem
    MSComm1.Output = Chr(16)
    MSComm1.Output = Chr(3)
    'Wait OK from Modem
    ReadModem
   
   
    '''''''''''''''''''''''''''''''''
    ' Phase D: Post-pase 2 exchanges
    '''''''''''''''''''''''''''''''''''''
    MSComm1.Output = "AT+FET=2" & vbCrLf 'no more page
    ReadModem
   
    MSComm1.Output = "ATH0" & vbCrLf 'Call hangup
    ReadModem
   
    Close #1
   
End Sub

Public Sub OpenCom()
   
    MSComm1.CommPort = 2
    MSComm1.Settings = "14400,N,8,1"
    MSComm1.InputLen = 0
    MSComm1.PortOpen = True
    MSComm1.Output = "ATE1Q0V1X3&C1&D3S7=120" & vbCrLf
    'MSComm1.Output = "AT&K5" & vbCrLf
End Sub

Public Sub SetupModem()

    Dim id As String
   
    MSComm1.Output = "AT+FCLASS=2" & vbCrLf
    ReadModem
    MSComm1.Output = "AT+FLId=" & """" & "bit" & """" & vbCrLf
    ReadModem
    MSComm1.Output = "AF+FdCC=0,1,0,2,0,0,0,7" & vbCrLf
    'ReadModem
   
End Sub

Public Sub ReadModem()
    Dim InString As String
    Do
        If MSComm1.InBufferCount Then
            InString = InString & MSComm1.Input
            If InStr(InString, vbCrLf) Then
                txtInData = txtInData & InString
                txtInData.SelStart = Len(txtInData)
                If InStr(InString, "OK") Then Exit Do
                InString = ""
                DoEvents
            End If
        End If
        DoEvents
    Loop
End Sub


0
 
LVL 1

Expert Comment

by:khaledc
ID: 1463305
You can always catch what is happening with the communication port by interupting the OnComm events (at design time double click the MSComm Icon), try to interrupt all the error generations.
The following is straight form the VB help on Output property in MSComm:
( The Output property can transmit text data or binary data. To send text data using the Output property, you must specify a Variant that contains a string. To send binary data, you must pass a Variant which contains a byte array to the Output property.)

and the example:

Dim Buffer as Variant
      
      ' Set and open port
      MSComm1.CommPort = 1
      MSComm1.PortOpen = True

      Buffer = Chr$(KeyAscii)
      MSComm1.Output = Buffer

Write if you still have a problem.
Regards
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1463306
Bought This Question.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal reports - Formula Field code need assistance with code 17 73
Add and format columns in vb6 7 57
Recommendation vb6 to vb.net or others 14 150
TT Auto Dashboard 13 92
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 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