Solved

Is There any fax program?

Posted on 1998-06-14
6
204 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
Comment Utility
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
Comment Utility
Edited text of question
0
 
LVL 1

Accepted Solution

by:
khaledc earned 120 total points
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:hanbi
Comment Utility
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
Comment Utility
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
Comment Utility
Bought This Question.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now