Here it is, save it as sample.prg, compiling is with these lines (the first one doesn't compile...) Comments and error messages in the code...
hbmk2 sample.prg xhb.lib hbwin.lib -ofirst1 -dFIRST1 hbmk2 sample.prg xhb.lib hbwin.lib -ofirst2 -dFIRST2 hbmk2 sample.prg xhb.lib hbwin.lib -osecond -dSECOND Thank you Francesco ---------------- sample.prg PRIVATE oPdfApp PRIVATE oPdfOptions // CREATE THE MAIN OBJECT IF ( oPdfApp := win_oleGetActiveObject( "PDFCreator.clsPDFCreator" ) ) == NIL IF ( oPdfApp := win_oleCreateObject( "PDFCreator.clsPDFCreator" ) ) == NIL Alert( "ERROR! PDFCreator.clsPDFCreator not available. [" + Ole2TxtError()+ "]" ) quit ENDIF ENDIF // CREATE AN HELPER OBJECT IF ( oPdfOptions := win_oleGetActiveObject( "PDFCreator.clsPDFCreatorOptions" ) ) == NIL IF ( oPdfOptions := win_oleCreateObject( "PDFCreator.clsPDFCreatorOptions" ) ) == NIL Alert( "ERROR! PDFCreator.clsPDFCreatorOptions not available. [" + Ole2TxtError()+ "]" ) RETURN NIL ENDIF END // SET SOME PARAMETERS FOR THE MAIN OBJECT oPdfApp:cVisible := .T. oPdfApp:cStart("/NoProcessingAtStartup" , .T. ) oPdfApp:cPrinterStop := .T. // HERE STARTS THE PROBLEM ! // // FIRST SOLUTION: // Public Property Get cOption(ByVal PropertyName As String) As Variant // Public Property Let cOption(ByVal PropertyName As String, ByVal Value As Variant) #ifdef FIRST1 oPdfApp:cOption( "UseAutoSave" ) := 1 // Compiler error #endif #ifdef FIRST2 oPdfApp:cOption( "UseAutoSave" , 1 ) // runtime error #endif // // Error BASE/3012 Argument error: COPTION // Called from WIN_OLEAUTO:COPTION(0) // Called from SAMPLE(42) // // SECOND SOLUTION: // use the helper object to set the value, then assign the helper object // to a member of the main class // Public Property Set cOptions(ByVal Options1 As clsPDFCreatorOptions) // #ifdef SECOND oPdfOptions:UseAutoSave := 1 // it's ok // BUT THEN I NEED TO ASSIGN oPdfApp:cOptions := oPdfOptions // runtime error // Error BASE/3012 Argument error: _COPTIONS // Called from WIN_OLEAUTO:_COPTIONS(0) // Called from SAMPLE(60) #endif oPdfApp:cClearCache() oPdfApp:cDefaultPrinter := "PDFCreator" oPdfApp:cPrinterStop := .T. oPdfApp:cClose() _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour