PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Recurring error on exit  (Read 854 times)

Ivan Iraola

  • Junior Member
  • **
  • Posts: 97
  • Windows 7 Pro
    • UncleDroid Apps
Recurring error on exit
« on: November 03, 2009, 11:03:21 PM »

The program compiles without a glitch, works fine but everytime I close it I get the error on the attached picture.

The amount of code is minimun since the program is still in development.
Logged
Android App Developer
http://www.uncledroid.com

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9203
  • Windows 10
    • PlanetSquires Software
Re: Recurring error on exit
« Reply #1 on: November 04, 2009, 06:17:32 AM »

Hi Ivan,

Are you able to send me the project? If you can then it may be easier for me to see why the GPF occurs and find a solution for you. If you can, then please email it to support@planetsquires.com and I will take a look at it today.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Ivan Iraola

  • Junior Member
  • **
  • Posts: 97
  • Windows 7 Pro
    • UncleDroid Apps
Re: Recurring error on exit
« Reply #2 on: November 04, 2009, 09:02:49 AM »

It's on its way.

Thank you.
Logged
Android App Developer
http://www.uncledroid.com

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9203
  • Windows 10
    • PlanetSquires Software
Re: Recurring error on exit
« Reply #3 on: November 04, 2009, 01:35:03 PM »

Thanks Ivan, I got it. Will work on it tonight. I'll report back to you via email.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9203
  • Windows 10
    • PlanetSquires Software
Re: Recurring error on exit
« Reply #4 on: November 06, 2009, 08:28:14 AM »

For those interested, myself and Ivan have solved this problem. Ivan was uding FF_FormClose statements in the WM_DESTROY and WM_CLOSE message handlers for the Form. The form is already closing at those points so asking it to close again must have triggered some invalid pointers. The GPF would show in WinXP but would not be reported in Win7.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Ivan Iraola

  • Junior Member
  • **
  • Posts: 97
  • Windows 7 Pro
    • UncleDroid Apps
Re: Recurring error on exit
« Reply #5 on: November 06, 2009, 10:04:39 AM »

One more thing, if you have a multi-form app (like in my case) you should make sure the child form (I guess that would be the term) do not have a CLOSE option on the SysMenu but a button to Exit the app, my problem was that since due to designing and functionality, I had to be able to close the application from either the main page or the child page, so I added the FF_FormClose to the WM_DESTROY and WM_CLOSE message handlers.

I appreciate Paul's help in this matter.

FF3 rules by the way.
Logged
Android App Developer
http://www.uncledroid.com

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9203
  • Windows 10
    • PlanetSquires Software
Re: Recurring error on exit
« Reply #6 on: November 06, 2009, 11:27:12 AM »

Hi Ivan,

I think that in your case where you needed to close the main form (and therefore the entire application) from a different form (not a child form but rather an "owned" form), the best approach would be as follows:

Close the popup/owned/child form as normal but in the WM_DESTROY handler do a PostMessage to the main form asking it to close.

PostMessage HWND_FRMMAIN, %WM_CLOSE, 0, 0

The PostMessage ensures that the current form completely closes prior to the message hitting the message queue for the main form to close. A SendMessage would not work in this case.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Mark Strickland

  • Senior Member
  • ***
  • Posts: 308
Re: Recurring error on exit
« Reply #7 on: November 06, 2009, 12:13:00 PM »

If I want to close a form from the CREATE_FORM event () will this PostMessage technique be the best solution?  In the past I have sometimes created a timer and set a flag.
Logged
Mark Strickland, CISSP, CEH
www.SimplyBASICsoftware.com

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9203
  • Windows 10
    • PlanetSquires Software
Re: Recurring error on exit
« Reply #8 on: November 06, 2009, 12:45:55 PM »

The best solution in FF3 is this:

Code: [Select]
Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long

   Function = -1
   
End Function


Pretty simple now, right!  :D

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer