CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Fax Programming

  1. #1
    Guest

    Fax Programming

    Hello,

    How to write a fax program to send a fax page?


  2. #2
    Join Date
    May 1999
    Posts
    25

    Re: Fax Programming

    You can write a fax program that requires MS Exchange to be running in the background...you need to do something like this.

    In you .h file
    #include <mapi.h>

    typedef ULONG (CALLBACK* LPFNMAPISENDMAIL) (ULONG,ULONG,MapiMessage*,FLAGS,ULONG);

    in your public definitions

    //faxing
    LPFNMAPISENDMAIL m_lpfnMAPISendMail;
    HINSTANCE m_hlibMAPI;
    MapiRecipDesc mrd[1];

    in your .cpp file
    in your OnInit
    m_hlibMAPI = AfxLoadLibrary("mapi32.dll");
    m_lpfnMAPISendMail = (LPFNMAPISENDMAIL) GetProcAddress(m_hlibMAPI,"MAPISendMail");


    when you want to send fax

    if (GetModuleHandle("exchng32.exe"))
    {
    MapiRecipDesc mrd[1];
    mrd[0].ulReserved = 0;
    mrd[0].ulRecipClass = MAPI_TO;
    mrd[0].lpszName="Recipient Name";
    mrd[0].lpszAddress="FAX:249-8045";//phone#
    mrd[0].ulEIDSize=0;
    mrd[0].lpEntryID = NULL;
    MapiMessage note= { 0,
    "Message to be displayed in note sec",
    NULL,
    NULL,
    NULL,
    NULL,
    0L,
    NULL,
    1,
    mrd,
    0L,
    NULL};

    ULONG err = m_lpfnMAPISendMail(0L,0L, &note, MAPI_LOGON_UI, 0L);


    }
    else
    {
    MessageBox("Error while attempting to fax ... Microsoft Exchange is not running","Error");
    }

    you can look up the parameters of the call to see what the are all for

    in you destructor
    AfxFreeLibrary(m_hlibMAPI);


  3. #3
    Guest

    Re: Fax Programming

    Hello czieler,

    Thanx for ur code to send a fax. But if I don't have MS-Exchange, how can I do just using a modem ? If u can help me with a code, it will be very useful.




  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Fax Programming

    Why reinvent the wheel? I think you would be better off getting a third party library. Unless you are familiar with that type of programming (serial communications), what happens if someone posts you code that works half the time? Who is going to diagnose the problems? Very few if any one here could help out if you have a 3000 line program that sends faxes and you don't know where to start looking if there are problems.

    You can get the BlackIce Fax library. There are others. Shop around.

    Regards,

    Paul McKenzie


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured