Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Work around to C5 for ocx ToolBar releasing form - but why?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Work around to C5 for ocx ToolBar releasing form - but why?
Divers
Thread ID:
00863580
Message ID:
00863580
Vues:
66
Since late last night and through noon today, I have been trying to figure out why the oxcToolBar called form.release generated a C5, but the form [X] close did not, and the form's menu close bar option to select did not.

The activated menu close bar and the oxc ToolBar Button close called this method:
PROCEDURE mnuFileExit(oform)
IF OkayToExitMyProgran(oform)
   xitMyProgram(oform)
ELSE
   * ignore
ENDIF
endproc
The forms queryunload had a similar method:
IF OkayToExitMyProgram(this)
   xitMyProgram(this)
ELSE
   NODEFAULT 
ENDIF
The routine to assure the user really wants to close, looked like this:
PROCEDURE OkayToExitMyProgram(oform)
IF VARTYPE(SomeOtherModelessForm)==[O]
   SomeOtherModelessForm.Activate       && Place it on top of any other
   SomeOtherModelessForm.txtFB.SetFocus && forms so the msgbox be on top
ELSE
ENDIF
IF MESSAGEBOX([Exit MyProgram?],[Exit],4+32+256)=6
   llReturnFlag=.t.
ELSE
   llReturnFlag=.f.
ENDIF
RETURN llReturnFlag
ENDPROC
This method closed it:
PROCEDURE xitMyProgram(oform)
IF VARTYPE(SomeOtherModelessForm)==[O]
   SomeOtherModelessForm.QueryUnload
   SomeOtherModelessForm.Release 
ELSE
ENDIF
oform.release
CLEAR EVENTS
ENDPROC
Both the menu bar and the ocxToolBar button called "mnuFileExit" (above). The menu bar worked and the form [X]close (QueryUnload) worked. However, when the ToolBar button was used to call "mnuFileExit", the messagebox in "OkayToExitMyProgram" was called (recycled?) again. Debug did not trace the routing back to the method, the messagebox just appeard when debug arrived at form.release.

When clicking yes again (to the "okay to exit" messagebox, VFP messaged an exception Error and offered to send a report to Microsoft. That was followed by a Windows Exception C5, and foxpro was "shutodown". I tried to trick it with no avail, UNTIL I remebered that the menu "Exit" BAR also had a HOT KEY. "ALT+X".

So, in the ocxToolBar exit button method, I substituted:
KEYBOARD '{ALT+X}' for "mnuFileExit(oform)", and it worked.

I hope anyone looking at this does not have burn as many hours as I did. I was about to give up, and pull the ocxToolBar "Exit" button from service, when I tried this one last thing. It worked! Hallaluja - I'm saved and I still have my ocxToolBar button exit feature!!!!
Imagination is more important than knowledge
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform