1. Michael Quintus
  2. PowerBuilder
  3. Friday, 11 February 2022 15:13 PM UTC

I'm tasked with maintaining/updating a legacy app that was written in an early version of Powerbuilder. We've upgraded to 2021 and are trying to make some menu modifications with 'Print' and 'Print Preview'.

Currently when hitting 'Print' it fails with "Error opening DLL library pfccom32.dll for external function..." . Tring "Print Preview" does nothing. 'Print Immediate' works fine.

Any workarounds or is it a fools errand?

The scripts are handled through pfc_m_master

m_print

SetPointer (hourglass!)
of_SendMessage ("pfc_print")

m_printpreview

of_SendMessage ("pfc_printpreview")

 

m_printimmediate

of_SendMessage ("pfc_printimmediate")

of_SendMessage

n_cst_menu		lnv_menu

return lnv_menu.of_sendMessage (this, as_message)

 

Olan Knight Accepted Answer Pending Moderation
  1. Monday, 14 February 2022 23:47 PM UTC
  2. PowerBuilder
  3. # 1

Michael -

   Please ensure that the following code in the PFC_PRINTDLG() event of U_DW in your PFE or corp library. The colored text below is the code that needs to be changed.

   Note that we have a CORP library so our inheritance path is PFC --> CORP --> PFE, which means our code changes are in the CORP library.


//********************************************************************
// Object       :  corp_u_dw
// Event        :  pfc_PrintDlg()
//
// Ancestor     :  OVERRIDDEN
// Access       :  Public
// Arguments    :  value   s_printdlgattrib   astr_printdlg   structure by ref
//
// Returns      :  Integer
// Throws       :  None
//
// Description  :  Opens the print dialog for this DataWindow,
//                 and sets the print values the user selected for the DW.
//
//********************************************************************
// Revision History
//
// Developer    Date         Version     Description
// ---------   -----------   ---------   -------------------------------
// O Knight    28-NOV-2017   6.0.4.33    #2026345:  Implement new copyright.
//                           9.0         Fix CR156666 to enable print orientation setting.
//                           8.0         Return code of of_printdlg has changed for Cancel Action.
//                                       Changed code to test on success code.
//                           5.0         Initial version.
//
//********************************************************************
// COPYRIGHT © 2022 CSG SYSTEMS INTERNATIONAL, INC. AND/OR ITS
// AFFILIATES (“CSG”). ALL RIGHTS RESERVED.
//********************************************************************
boolean               lb_collate
integer               li_copies
long                  ll_rc
long                  ll_pagecount
string                ls_pagecount
string                ls_pathname = "Output"
string                ls_filename
string                ls_copies
string                ls_collate
string                ls_orientation

n_cst_platform        lnv_platform
n_cst_conversion      lnv_conversion
window                lw_parent



// Initialize printdlg structure with current print values of DW
astr_printdlg.b_allpages = true

ls_orientation = this.object.datawindow.print.orientation
astr_printdlg.i_orientation  = integer(ls_orientation)

ls_copies = this.Object.DataWindow.Print.Copies
if not IsNumber (ls_copies) then ls_copies = "1"

li_copies = Integer (ls_copies)
astr_printdlg.l_copies = li_copies

ls_collate = this.Object.DataWindow.Print.Collate
lb_collate = lnv_conversion.of_Boolean (ls_collate)

astr_printdlg.b_collate  = lb_collate
astr_printdlg.l_frompage = 1
astr_printdlg.l_minpage  = 1

ls_pagecount = this.Describe ("Evaluate ('PageCount()', 1)")
if IsNumber (ls_pagecount) then
    ll_pagecount            = Long (ls_pagecount)
    astr_printdlg.l_maxpage = ll_pagecount
    astr_printdlg.l_topage  = ll_pagecount
end if

if this.GetSelectedRow (0) = 0 then  astr_printdlg.b_disableselection = true

// Allow printdlg structure to have additional values
// set before opening print dialog
this.event pfc_preprintdlg (astr_printdlg)

// Open print dialog
//f_setplatform (lnv_platform, true)
//this.of_GetParentWindow (lw_parent)
//ll_rc = lnv_platform.of_PrintDlg (astr_printdlg, lw_parent)
//f_setplatform (lnv_platform, false)

ll_rc = this.Print (TRUE, TRUE)

// Set print values of DW based on users selection
if ll_rc = 1 then
    // Page Range
    if astr_printdlg.b_allpages then
        this.Object.DataWindow.Print.Page.Range = ""
    elseif astr_printdlg.b_pagenums then
        this.Object.DataWindow.Print.Page.Range = &
            String (astr_printdlg.l_frompage) + "-" + String (astr_printdlg.l_topage)
    elseif astr_printdlg.b_selection then
        this.Object.DataWindow.Print.Page.Range = "selection"
    end if

    // Collate copies
    this.Object.DataWindow.Print.Collate = astr_printdlg.b_collate

    // Number of copies
    this.Object.DataWindow.Print.Copies = astr_printdlg.l_copies

    // Fix CR156666
    // Print orientation
    this.Object.DataWindow.Print.Orientation = astr_printdlg.i_orientation

    // Print to file (must prompt user for filename first)
    if astr_printdlg.b_printtofile then
        if GetFileSaveName ("Print to File", ls_pathname, ls_filename, "prn", &
            "Printer Files,*.prn,All Files,*.*") <= 0 then
            return -1
        else
            this.Object.DataWindow.Print.Filename = ls_pathname
        end if        
    end if
end if


RETURN ll_rc

Comment
  1. Olan Knight
  2. Tuesday, 15 February 2022 14:52 PM UTC
Miguel -

This is a case of "I inherited the project set up this way". Back in the day when there were presentations and classes everywhere for PB, this was the accepted technique for setting up your inheritance path. This allowed the PFC and PFE to be as untouched as possible. Remember that Sybase had control of the Class Libraries back then so this minimized the possibility that a new class library would require you re-code your changes into the PFE.



Michael -

The code above IS the complete code from my corp_u_dw.pfc_printdlg() event! :) Just copy and paste! Assuming the remainder of the PFC/PFE is relatively untouched, you should be good to run after the paste - and now you will get the Print Dialog boxex you expect.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Tuesday, 15 February 2022 15:17 PM UTC
yes I remember kind of, but ... the PFE already and only exists with the intention of being modified without modifying the PFC classes.

Our pfe classes are simply renamed pfe classes to include the company name :)
  1. Helpful
  1. Michael Quintus
  2. Tuesday, 15 February 2022 15:53 PM UTC
Excellent, thanks Olan!
  1. Helpful
There are no comments made yet.
Michael Quintus Accepted Answer Pending Moderation
  1. Monday, 14 February 2022 16:40 PM UTC
  2. PowerBuilder
  3. # 2

Okay, tried the few suggestions of troubleshooting differences and it seems to create more issues than fixes issues. At this point we're ready to chalk it up as a fools errand and figure out a workaround with the business if needed.

 

Big thanks to everyone that responded. The suggestions were and will be helpful in the future as well!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 14 February 2022 01:48 AM UTC
  2. PowerBuilder
  3. # 3

PFCCOM32.DLL is no longer working since Powerbuilder 8: https://answers.sap.com/questions/10521605/newer-version-of-pfccom32dll.html

You said you have an unsuccessful build. Most likely the error messages will point out which objects have to be modified. Probably some Print functionality.

My recommendation is to:

- make a copy of your complete application, including the old PFC and PFE libraries and

- hookup the application with the newest version of PFC 2021.

- compile and copy the error messages.

- one by one, edit the source code of an object with error and comment out the lines of code that cause the error. Use some special comment, so later you can find what you have commented out. You probably have to follow some order in doing this, starting with PFE classes, if any errors, and then the 'normal' objects of your application (if they show any errors).

Whatever print functionality no longer works because you don't have an updated pfccom32.dll, should be perfectly available in the modern PFC classes.

regards.

 

Comment
  1. Miguel Leeuwe
  2. Monday, 14 February 2022 01:49 AM UTC
It shouldn't be that dificult.
  1. Helpful
  1. Michael Quintus
  2. Monday, 14 February 2022 13:47 PM UTC
Thanks Miguel. I will give this a shot as well as trying to compare old/new libraries.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Sunday, 13 February 2022 18:42 PM UTC
  2. PowerBuilder
  3. # 4

Hi Michael, In case through this Q&A you can’t resolve your problem, I would recommend engaging one of our consulting partners to perform the upgrade.  I have seen PB 3.0 apps upgraded to Appeon versions of PowerBuilder, so certainly your app is doable.  By upgrading you will get tons of new features, tech support that includes bug and security fixes, and option to deploy to the cloud with PowerServer.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 11 February 2022 16:26 PM UTC
  2. PowerBuilder
  3. # 5

Hi, Michael - 

Are the PFCxxxxx/PFExxxxx libraries used by this application the original ones or have they been recently refreshed with newer versions?

If they have not been refreshed in a long time you should consider downloading the latest version (for PB 2021) from the GitHub web site:

https://github.com/OpenSourcePFCLibraries

Best regards, John

Comment
  1. René Ullrich
  2. Monday, 14 February 2022 14:09 PM UTC
Seems that your extension PBLs have different names (e.g cs21apsrv.pbl instead of pfeapsrv.pbl). This is ok.

But it seems that some extension objects are missing. You have to add it to your extension PBLs. You can copy it from PFC extension you've got from GitHub or you inherit a new object from PFC and save it.

Some of the objects from platform and file service are not valid anymore (because of unsupported OS). You only need the master object and the *unicode. (all others like hpux, mac, ... are not valid anymore).

I think you should start to compare your extension PBLs with the PFC extension PBLs to see what object you are missing and what you don't need anymore.
  1. Helpful 2
  1. Michael Quintus
  2. Monday, 14 February 2022 14:45 PM UTC
Okay, I will give that a shot as well. Thanks!
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 14 February 2022 17:04 PM UTC
Make sure you do a FULL rebuild and not an incremental.

You might also have to update any PBDOM extension or PBL / PBD file if you have upgraded.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.