webForumDet fria alternativet

Finns det inget sätt?

.NET

9 svar · 357 visningar · startad av roja

Medlem sedan feb. 200418 inlägg
Frågan#1

Finns det inget sätt att göra en applikation som använder sig av fax programet i XP och faxar.. Men gör det så man slipper att fylla i wizarden?

Medlem sedan feb. 200418 inlägg
#2

Hittade detta men det funkar inte.. Det är iof en bit som jag inte fattar..!

Sending a Fax
To send a fax, we have to create an instance of fax server object by using the Visual Basic “Create Object” function. After that, we have to establish a connection with the Active fax server. Here ‘Active fax server’ means the system with which the fax modem is connected.

After establishing the connection with the active fax server, we need to create FaxDoc object. Next, we have to specify the name of the file to be transmitted, as an argument to the CreateDoc method of FaxServer object.

The FaxDoc object is used to transmit fax documents and cover pages and to retrieve and set information about fax transmission. In this FaxDoc object, there is a method called Send that is used to transmit the document specified by FaxDoc object to the FaxNumber specified by the object. This example should give you an idea how to send the fax.

Dim FS As New FaxServer 'The FaxServer object to connect to
‘And disconnect from an active fax server
Dim FD As New FaxDoc
Dim  FileName  As String
FileName = “c:\test.doc”
'To transmit fax documents and cover pages, and
'To retrieve and set information about fax transmissions.
Set FD = FS.CreateDocument(FileName)
'Connecting to the server
FS.Connect ("\\ServerName")
MsgBox "Connection Established.........."
FS.Retries = 5
FS.RetryDelay = 3
'To display in the fax queue
FD.DisplayName = "TestFax"
FD.Send 'Transmits the document specified by the FaxDoc
'object to the fax number specified by the object.

Vad menas med detta?

Here ‘Active fax server’ means the system with which the fax modem is connected.

Medlem sedan juni 20022 599 inlägg
#3

men det funkar inte

Då kommer den eviga frågan: På vilket sätt funkar det inte? Vad händer?

- Har du lagt till referensen till Faxcom Type Library?
- Har du bytt ut ServerName mot ett giltigt namn?
- Borde du inte ange numret nånstans: FD.FaxNumber = "xxxxxx"?

Medlem sedan feb. 200418 inlägg
#4

Ja referensen finns där.
Hur vet jag vilket ServerName jag ska ha?
Jag förstår liksom inte vad dom avser med detta.
Testat att lägga till nummer med.

Den stannar på FD.Send och jag får ett runtime error 5

Medlem sedan juni 20022 599 inlägg
#5

Hur vet jag vilket ServerName jag ska ha?

Nu har jag aldrig skickat ett fax (i kod), men det måste väl rimligtvis vara namnet på maskinen som Fax Servicen kör på?

Håller med om att det verkar svårt att hitta bra exempel, men om du vågar så kan du kanske ge dig in i den gigantiska MSDN-labyrinten:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxlegacyvb_836n.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxlegacy_6g4z.asp

Det brukar ge fler uppslag och nya söktermer, om inte annat.

Medlem sedan feb. 200418 inlägg
#6

Jag har fortfarande inte fått till det trots grävande i MSDN.

Har sett lite andra inlägg på andra forum om folk som har lyckats.
Den mest beskrivande lägger jag här ifall ngn skulle vilja pröva.
Skriv gärna svar om hur ni gjorde ifall ni lyckas.!

Hi All... this is my first post here... hope it helps!

I've been reading posts and looking up articles on this subject...
Here's the procedure I've created to handle sending Fax's
This procedure has been tested on XP Home (server/client same pc), using VB6
I will test it in the production environment for the project I'm working on later today (NT Server/Win 98 client)
I will update here with the results of my testing...

Some of the code I've seen around has been written by people who seem to have been confused by the Client/Server nature of this method.

I'm assuming here that the intention is to allow a client app to send faxes via a server... of course you can also use this to send a fax on a standalone pc by connecting to yourself!

The basic technique is this:

You need a pc running NT/2000/XP that has the standard Fax service installed.
This will probably be the server on your network
The client pc will make use of this by creating an instance of the FaxServer object that is on the server

Here's the procedure:

Public Sub Fax(ByVal FileName As String, ByVal FaxNumber As String, ByVal FaxServerName As String) 
    ' Fax a file to a fax number 
    ' Uses the standard Windows NT/2000/XP FaxServer on the named Server 
    ' David McReynolds, Aug 2003 
    ' [email]d.mcreynolds@btinternet.com[/email] 
     
    Dim FaxServer As Object 
    Dim FaxDoc As Object 
    Dim retCode As Long 
     
    Set FaxServer = CreateObject("FaxServer.FaxServer", FaxServerName) 
    FaxServer.Connect FaxServerName 
    Set FaxDoc = FaxServer.CreateDocument(FileName) 

    With FaxDoc 
        .FaxNumber = FaxNumber 
        retCode = .Send 
    End With 
    MsgBox "Result of FaxDoc Send: " & retCode 
     
    Set FaxDoc = Nothing 
    FaxServer.Disconnect 
    Set FaxServer = Nothing 
End Sub

------------------------
To use this:

Fax "c:\some file i want faxing.txt", "12345 678901", "NameOfComputerWithFaxServerOnIt"

Hope this helps...it works on my standalone system...

David

Medlem sedan juni 20022 599 inlägg
#7

Är klient och server samma maskin i ditt fall? Annars lär du behöva tänka på att FileName är en giltig UNC-sökväg relativt servern och att det inte finns några rättighetsproblem.

Medlem sedan feb. 200418 inlägg
#8

Nu har jag fått det att funka. Fungerar iof bara att skicka tif-filer.
Men annars ganska smidigt.

Någon som vet hur man kan skapa tif-filer smidigt.
Om någon kommer på ett sätt att faxa annat än tif-filer blir jag glad om ni skriver hur.

Public Sub Fax(ByVal FileName As String, ByVal FaxNumber As String, ByVal FaxServerName As String)
    ' Fax a file to a fax number
    ' Uses the standard Windows NT/2000/XP FaxServer on the named Server
    ' David McReynolds, Aug 2003
    ' [email]d.mcreynolds@btinternet.com[/email]
     
    Dim FaxServer As Object
    Dim FaxDoc As Object
    Dim retCode As Long
    FileName = FileName
    Set FaxServer = CreateObject("FaxServer.FaxServer", FaxServerName)
    FaxServer.Connect FaxServerName
    Set FaxDoc = FaxServer.CreateDocument(FileName)

    With FaxDoc
        .FaxNumber = FaxNumber
        retCode = .Send
    End With
    MsgBox "Result of FaxDoc Send: " & retCode
     
    Set FaxDoc = Nothing
    FaxServer.Disconnect
    Set FaxServer = Nothing
End Sub

Private Sub Command1_Click()
Call Fax("c:\test.tif", "00708200105", "pontus")
End Sub
Medlem sedan juni 20022 599 inlägg
#9

Om någon kommer på ett sätt att faxa annat än tif-filer blir jag glad om ni skriver hur.

Inte för att det egentligen angår mig men: Vad händer när du försöker skicka en *.txt eller *.doc? Om det funkar när du droppar samma dokument på fax-skrivaren så borde det väl funka i kod också, tycker man? Du har Word installerat?

Medlem sedan feb. 200418 inlägg
#10

Asså ibland vill man ta livet av sig själv.. Jag har haft en korrupt test fil.. Jaja nu e jag överlycklig över att det funkar.. Tack för all hjälp..

268 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
139 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)