Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / February 2005



Tip: Looking for answers? Try searching our database.

NonChild Modal Window will not die

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bobbyballgame - 18 Feb 2005 16:20 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.