We are running into an interesting problem in an Entierprise application.
Architecturally, we are using a lot of interfaces in VB, and the Main
Application is an MDI Form. With some functionality, a Dll is loaded that
spawns a modal window that is not a child of the MDI.
In trying to implement an Autologoff feature, we are getting into a state
where we cannot quite cleanup the spawned modal window. We have looked at
this for a while and the WinApi skills are a bit rusty, but here are some of
the things that we have found.
Although the window is not in the window hierarchy (parent-child) it is in
the same process, so using some APIs we can go through and grab all windows
that are in the same process, and shut them down as need be. However, when
we do this we are getting a [Can't show non-modal form when modal form is
displayed (Error 401)].
Where is this modal state being stored? Does anyone know of a way to grab
the windows and call their VB function on them, or have any idea how we can
untangle this situation? [ We are really hoping to avoid a structural change
that requires new methods on all of the objects that create windows as it
would end up being a lot of work.]
Thanks,
BB
alpine - 18 Feb 2005 16:57 GMT
>We are running into an interesting problem in an Entierprise application.
>
[quoted text clipped - 21 lines]
>Thanks,
>BB
How are you "shutting down" the window in the situation where you get
the error?
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
bobbyballgame - 18 Feb 2005 16:57 GMT
Something along the lines of:
Set windowHandles = GetWindowByProcessID(ProcessID)
foreach windowHandle in windowHandles
DestroyWindow(windowHandle)
next
> >We are running into an interesting problem in an Entierprise application.
> >
[quoted text clipped - 31 lines]
> alpine_don'tsendspam@mvps.org Hunter S. Thompson -
> Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
alpine - 18 Feb 2005 18:31 GMT
Don't do that! ;-)
Try sending the window a WM_CLOSE message or click one of the buttons
in the dialog via API code. That way, VB will handle the messages and
sync up it's internal flags correctly.
HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
>Something along the lines of:
>
[quoted text clipped - 44 lines]
>> alpine_don'tsendspam@mvps.org Hunter S. Thompson -
>> Microsoft MVP-Visual Basic Fear and Loathing in LasVegas