Solved

Is There any fax program?

Posted on 1998-06-14
6
219 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

910 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

19 Experts available now in Live!

Get 1:1 Help Now