Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Is There any fax program?

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
hanbi
Asked:
hanbi
1 Solution
 
MAVERICKCommented:
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
 
hanbiAuthor Commented:
Edited text of question
0
 
khaledcCommented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
hanbiAuthor Commented:
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
 
khaledcCommented:
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
 
MirkwoodCommented:
Bought This Question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now