Announcement

Collapse
No announcement yet.

XPRINT closing program ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XPRINT closing program ?

    I've got a main module that calls a print program (in a dll) that writes the report to a file. The dll then calls the preview/print dll.
    There it's previewed/and or printed using graphics and xprint.

    The printer is local to my XP and Shared on my local network.

    When i print on the xp after previewing it, it closes the main program.
    This is not supposed to happen.

    When I print on my WinME using the shared printer (same printer), everything
    works fine. It prints and goes back to the main module.

    If I preview the report on the XP machine then cancel (before printing), it goes back to the main program just fine.

    I've looked to see if there's an abort variable that would somehow get back to the main module and close it but i cant find anything. Plus I have put several
    msgbox statements to catch it to see if i can find the problem but none get displayed when i print although the ones that should get displayed if i cancel the print (before actual printing) do get displayed.

    It's strange.
    Now there is a mixture of versions here. The main module is written in pbdll60
    the xprint/graphic preview print is written in pbwin8.04

    But like i said, it works perfectly on the ME. It's like some xprint command is closing my main module dialog (a menu program).

    Sometimes talking about it, makes the difference. Frustrated. I will continue to test.
    Thanks in advance for any suggestions.

    Oh there was one other thing. I had the following
    XPRINT ATTACH PrtNam$
    XPRINT GET CLIENT TO xWidth!,xHeight!
    XPRINT GET MARGIN TO xLeft!, xTop!, xRight!, xBottom!
    XPRINT GET PPI TO x&,y&
    XPRINT CANCEL
    to get my page parameters and it would not cancel the xprint but tried to print (spool it) and had to cancel the print through the printer spooler and force the main module to end because it hung up. So I REMMED those statements out
    and put in values for the variables. This was on the XP again whereas on the ME it worked fine and came back with the
    page values from the above statements. This may be a related problem.

    The printer is an HP Deskjet.
    Last edited by Fred Buffington; 5 Mar 2008, 07:08 AM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    The main module is written in pbdll60 the xprint/graphic preview print is written in pbwin8.04
    If you are passing an array of UDTs between modules and that array is REDIMed, that won't work with multiple versions because of an undocumented change in the array descriptor between 6x and 7x. If you are doing this and not testing for errors, you could be corrupting your memory which could cause all manner of weird things.

    Or, perhaps the XPRINT commands don't work across modules, just like DDT commands don't.

    Or, you could have the 'general' problem of inadequate error testing "somewhere" resulting in the same memory corruption leading to the same weird things.

    That your problem exhibits itself on Win/XP but not Win/ME leads me to believe you have a programming error which is forgiven in ME but not in XP... this is a relatively common occurrence, as each version of Windows has enforced the rules more more strictly than the prior version.

    But other than telling you to find your programming error, there is just not enough info provided here to give you any more detailed direction.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Thanks Michael.

      1) Im not passing any UDT's.
      The arguments passed to the print preview/print routine are:
      prtnam$ (printer name)
      Preview$ (Y or N)
      PTP& (pages to print)
      C$ (company directory path)

      I put in an on error goto with no results and it doesnt happen until the last print line is processed. I will look at it again. I was sure it was working
      earlier last month.
      I'll keep looking
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        >a print program (in a dll) that writes the report to a file.

        Are you executing (ShellExecture[Ex], CreatePrcess, SHELL) a separate program somewhere? That might be resulting in some kind of permissions issue on the report file, which is only caught by the newer O/S... or maybe because of permissions settings on the other box.

        Please show p-code structure, eg
        Code:
           MAIN MODULE  
              DO 
                something 
                CAll CreateReport function in DLL1 
                IF condtion
                   EXIT DO
                ENDIF
              ENDDO 
        
        DLL1
          FUNCTION CreateReport
             get File name 
             Create report  to file 
             CAll PrintPreview function (file, other params)  
           END FUNCTION
        
        DLL2 
           FUNCTION PrintPreview (file, other params) 
               whatever
           END FUNCTION
        It sounds something like this.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Michael, yes that's the idea (your framework depiction), but i fixed it.

          I deleted the printer and reinstalled it and all is fine so apparently the printer driver got messed up some how even though the report always printed fine
          even when it was closing the main program.

          Thanks for the help. I am truly thankful to you and the rest of the experts for your unselfish help.

          To answer your Question about Shellexec,createprocess,shell. I simply write the report to an ascii file with a command script
          of my own that the preview/print reads and interprets. I've mentioned it before. I use a 4 character 'command' within square
          brackets. i.e. [PRIN]THIS is A test
          which preview interprets as GRAPHIC PRINT THIS is A test
          and the print routine interprets as XPRINT THIS is A test
          some others are
          [SPOS]x!,y!
          preview issues GRAPHIC SET POS (x!,y!)
          print issues XPRINT SET POS (x!,y!)
          [FEED]
          XPRINT FORMFEED
          ignored for graphic except to know it's the end of the page
          etc.

          Oh deleting and reinstalling also fixed the problem of not being able to do get the margins and papersize too.
          Last edited by Fred Buffington; 5 Mar 2008, 11:51 AM.
          Client Writeup for the CPA

          buffs.proboards2.com

          Links Page

          Comment

          Working...
          X