Link to home
Start Free TrialLog in
Avatar of gmarston
gmarston

asked on

OWL/DLL/COM printing problem

I have developed an ActiveX, COM based DLL as a component to medical billing systems.  The component includes interface functions which get and send back information and functions which display dialogs for information and selection.  Everything works fine except printing.  In some of the dialogs I allow the user to choose 'Print' to print certain list box information.  However, when I choose Print the "Print Setup" dialog appears and works with no problem.  The TPrintout seems to be built with no problems.  But, when the DLL actually attempts to print the dialog closes down and I am brought directly back to the calling program.

Some Facts:
1. Using Borland C++ 5.2
2. I am able to print from the EXE program.
3. I am positive TPrintout is not the problem since I have tried simplifying it to just 1 or two lines of text but get the same print problem.

Thanks for any help,
Greg Marston, Unicor Medical
Avatar of Tommy Hui
Tommy Hui

Is this 16bit or 32bit?

Avatar of gmarston

ASKER

32bit.
Did you load in your DLL the (Print) Windows Common Controls (in your exe they may be linked automatically)?
I'm guessing you mean the file owl/printer.h?  If so, the answer is no and I'm feeling pretty stupid. I'll try this out asap and let you know. Thanks
Ignore the previous comment from me.  I'm not sure if I loaded the Print common controls in the DLL.  How do I determine this?
Did you remember to include the printer.rc file? This is a bit important in OWL.
Here's a snippet of the relevant code.  The fact that
"Printer->Setup(this)" works should mean the window's print controls are all there for owl.  Correct?


TPrinter *Printer;

Printer = new TPrinter;


....called from a dialog (from DLL) when user selects print:

  if (Printer) {
    DListPrintout po((char *)m_lbdata[m_current].notes1.c_str(),
          m_listbox, Printer);
    // TPrintout derived class, same class works,
    // with EXE but not in DLL.

    message((char *)po.GetTitle());
    // this works fine, po is okay

    Printer->Setup(this);
    // a test to see if Printer is brings up
    // dialog and correct default
    // printer (should mean everything okay)

    Printer->Print(this, po, TRUE);
    // 1. brings up Print dialog to select
    //    different printer.
    // 2. SetPrintParams is called because
    //    message is displayed
    // 3. nothing prints and component dialog
    //    closes, returns to calling .exe

Thanks for any help,
Greg
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial