From: Sarah M. Weinberger on
Hi,

Thanks to a certain someone named "Gary"

http://www.codenewsgroups.net/group/microsoft.public.vb.general.discussion/topic16868.aspx

when doing a Google search (Google, if you are reading this message, bring
back the old Google News!) solved the problem. I tried Gary's suggestion in
my Project1 and it worked. Here is what Gary said on the topic:

-------------------------------------------------------------------------------------
Paul,

I finally discovered the problem. An OCX had a form that didn't have Unload
Me in the QueryUnload event. Apparently every QueryUnload in every form of
both the EXE and any OCXs or DLLs called by the EXE must have:

If UnloadMode =2 then Unload Me

Gary
-------------------------------------------------------------------------------------

I did a Google search on UnloadMode constants, since I agree that "2" is
annoying to look at and came up with:

QueryUnload:
vbFormControlMenu = 0
vbFormCode = 1
vbAppWindows = 2
vbAppTaskManager = 3
vbFormMDIForm = 4
vbFormOwner = 5

That makes Gary's added line:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then
Unload Me
End If
End Sub

There is no subclassing necessary, but every form and every OCX apparently
must process this request.

Thanks,

Sarah

From: Tony Toews on
On Sun, 4 Jul 2010 19:36:40 -0700, "Sarah M. Weinberger"
<nospam_mweinberger(a)hotmail.com> wrote:

>(Google, if you are reading this message, bring
>back the old Google News!)

Google >> More >> Groups >> Advanced Groups Search (upper right hand
side) >> Group (down a ways on the page) >> key in
microsoft.public.vb.* or other newsgroup name as appropriate.

(You used to be able to put multiple newsgroup names to include
comp.???.* as well in there but Google dropped that capability years
ago.)

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
From: Karl E. Peterson on
on 7/4/2010, Sarah M. Weinberger supposed :
> Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
> If UnloadMode = vbAppWindows Then
> Unload Me
> End If
> End Sub
>
> There is no subclassing necessary, but every form and every OCX apparently
> must process this request.

Pardon me for saying this, but that just sounds incredibly
superstitious.

Yes, if Windows is shutting down, logo requirements aside, it makes
sense you'd want your application to end gracefully.

That means what it means, and is entirely independent of your
application architecture.

Implication? The code above may indeed help you pass some test or
another, but it doesn't address the goal.

Programming is *not* a mindless pursuit...

--
..NET: It's About Trust!
http://vfred.mvps.org