FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour WndMain() unexpected nil
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
WndMain() unexpected nil
Posted: Sat Mar 02, 2013 08:06 AM
Hello,

This week i had two errors (code runs mostly without problems) :

Error description: Error BASE/1004 Class: 'NIL' has no exported method: HWND
Called from: => HWND( 0 )
Called from: .\source\classes\RPREVIEW.PRG => (b)TPREVIEW:ACTIVATE( 169 )

Code (fw): Select all Collapse
if ::oWndMain == nil
    StopUntil( { || ::lExit } )
else
    StopUntil( { || ::lExit .or. !IsWindow( WndMain():hWnd ) } )  <== 169 !!!!
endif


WndMain() seems to return nil. The stacklist shows as last line the line where the main window is activated. There is a main window !!
Also is it clear that ::oWndMain <> nil.

FRank
test
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: WndMain() unexpected nil
Posted: Sat Mar 02, 2013 09:42 AM

Frank,

We recently commented about it here. It happens because the main window is closed meanwhile the print preview is shown.

Use the VALID of the main window to control is the preview is opened or not, so the user can't leave, or at least, ask the user to close it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: WndMain() unexpected nil
Posted: Sat Mar 02, 2013 12:25 PM
Antonio Linares wrote:Frank,

We recently commented about it here. It happens because the main window is closed meanwhile the print preview is shown.

Use the VALID of the main window to control is the preview is opened or not, so the user can't leave, or at least, ask the user to close it


How can i know in the mainwindow that a preview is opened ?

Is it possible to change the code in rpreview.prg , avoiding the error ?

Frank
test
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: WndMain() unexpected nil
Posted: Sat Mar 02, 2013 03:30 PM
Suggestion
Code (fw): Select all Collapse
StopUntil( { || ::lExit .or. WndMain() == nil .or. !IsWindow( WndMain():hWnd ) } )

Does this help?
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion