Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Preview: oReport has no Window handle

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Preview: oReport has no Window handle

    Hi

    I have converted a bunch of reports from VRW 2.x to DR 8.0 and in addition am using Michael Mullan's sub-class cDRReportMSSQL (DF19.1).

    The reports run correctly, but clicking anywhere on the preview output area (not the scrollbar or the menu bar) gets the error: 'The report COM object for (object="oMain...oReport") does not have a window handle':

    Click image for larger version. 

Name:	Screenshot 2021-05-03 at 16.10.45.jpg 
Views:	118 
Size:	57.8 KB 
ID:	14573

    At which point the Previewer becomes unresponsive (including the scrollbar, but not the menu bar, although not everything on that works properly) until closed.

    Printing to the printer works OK.

    What am I doing wrong?

    Mike

  2. #2
    Join Date
    Feb 2009
    Location
    Hengelo, Netherlands
    Posts
    10,869

    Default Re: Preview: oReport has no Window handle

    Mike,

    You get this error when PreviewClick event gets fired in the cDRReport object and this object does not have a window handle. The report object gets a window handle when it gets paged. So that is where you have to look. If you feel the COM object should not get a window handle at all you need to overwrite the PreviewClick event in the object.
    Regards,
    Data Access Worldwide
    Vincent Oorsprong

  3. #3
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: Preview: oReport has no Window handle

    Vincent - thanks for that.

    This is a system I've inherited, so don't really know it very well.

    Debugging, I can see that Page_Object never gets triggered, while PreviwClick is indeed triggered when I click on the preview "body".

    I'm seeing:


    • RunReport
    • OpenReport
    • OutputReport
    • DisplayReport
    • OnComPreviewShowPage (x3)


    Then the report displays in the previewer. At what point should the Window handle be getting set and how do I do that?

    Mike
    Last edited by Mike Peat; 4-May-2021 at 04:24 AM.

  4. #4
    Join Date
    Feb 2009
    Location
    Maasland, The Netherlands
    Posts
    2,605

    Default Re: Preview: oReport has no Window handle

    AFAIK views have a Window handle and modal dialogs not. I suppose that the report object is a child of a modal dialog.
    Best regards,

    Peter van Mil
    Appvantage b.v.

  5. #5
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: Preview: oReport has no Window handle

    Thanks Peter - I'll try that!

    Mike

  6. #6
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: Preview: oReport has no Window handle

    OK, I don't like it, but lacking another solution, the following code in the DRReport sub-class I'm using, DFReportMSSQL, seems to work:

    Code:
        Function Window_Handle Returns Handle
            Handle hWnd hObj
            
            Forward Get Window_Handle to hWnd
            
            If not hWnd Begin
                Move (Self) to hObj
                
                Repeat
                    Move (Parent(hObj)) to hObj
                    If not hObj ;
                        Break
                    Get Window_Handle of hObj to hWnd
                Until hWnd
                
            End
            
            Function_Return hWnd
        End_Function
    Mike

    PS: the report is - in at least one case and probably many - the child of a BusinessProcess.

  7. #7
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: Preview: oReport has no Window handle

    A thought - though more work. I have a # of DRs that are run from BPs & like most other reports in the system, print them directly to a PDF & then display the PDF. More work, but the users greatly prefer the viewing in a PDF - mostly being able to scroll down to the next page(s) instead of having to go page by page. It also lets you search for a value - handy when the report is several hundred pages.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  8. #8
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: Preview: oReport has no Window handle

    Hi Garret

    Yes, this system can produce PDFs as well, but they want the previewer to work nicely as well.

    Mike

  9. #9
    Join Date
    Feb 2009
    Location
    Queens, NY, NY
    Posts
    7,429

    Default Re: Preview: oReport has no Window handle

    the DF previewer has a search feature that finds in the report data. IIRC it worked quite well.
    Michael Mullan.
    Danes Bridge Enterprises.

    ++++++++++++++++++++++++++++
    There is just today. Tomorrow is a concept
    that is mostly theoretical. -- GM Wylie
    ++++++++++++++++++++++++++++

  10. #10
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: Preview: oReport has no Window handle

    Michael

    Yes, it does... and ou recall correctly: it works quite well.

    Mike

Page 1 of 2 12 LastLast

Posting Permissions

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