WndMain() unexpected nil

WndMain() unexpected nil

Postby Franklin Demont » Sat Mar 02, 2013 8: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: Select all  Expand view

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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: WndMain() unexpected nil

Postby Antonio Linares » Sat Mar 02, 2013 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: WndMain() unexpected nil

Postby Franklin Demont » 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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: WndMain() unexpected nil

Postby nageswaragunupudi » Sat Mar 02, 2013 3:30 pm

Suggestion
Code: Select all  Expand view
StopUntil( { || ::lExit .or. WndMain() == nil .or. !IsWindow( WndMain():hWnd ) } )

Does this help?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 77 guests