Excel97 Userform to be system modal/equivalent

  • Thread starter Thread starter George J
  • Start date Start date
G

George J

I have done a bit of research online, but it seems that
setsysmodalwindow is not supported in 32bit systems, only
16bit so i can't use that.

I am ok with basic coding, but after that i don't have
much of a clue so if you could tell me what the code is
trying to do rather than what i think it is doing will be
a big help.

I want to watch the userform's LostFocus event and use a
timer to continually check the form and restore if
required. The timer i can probably manage, but the
LostFocus has me, well - lost.

Very rough coding of what i have so far. (Not sure if
hWnd is available in excel97 so i have been struggling
with that also)


Private Declare Function SetActiveWindow Lib "user32.dll"
(ByVal gj As Long) As Long

Private Declare Function FindWindow Lib "user32"
Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As
String) As Long

Private Declare Function GetActiveWindow Lib "user32" ()
As Long

Private Sub Userform_LostFocus()
Dim gj As Long
Dim WinSelected as long
gj = FindWindow("ThunderXFrame", UserForm1.Caption)
WinSelected = GetActiveWindow()
On Error Resume Next
If Not WinSelected = gj Then
SetActiveWindow gj

End If
End Sub

As you can see, i need some serious help.
All comments welcome.

George
 
Userforms are shown as modal in xl97.

Are you trying to prevent users from swapping to another application? I don't
know how to do this--but even if I did, I don't think I'd want to use a program
that did this.

If I need to swap between programs to get information, this would just irritate
the heck out of me.

Good luck in your quest.
 
Thanks for the reply Dave.

I am trying to make this "irritate the heck" out of the
user so that if they do change application, then they need
to close down the userform first.

Still not got any further on this. Perhaps posting in the
programming section will help.

thanks again
George
 
If you get no help in .programmning, you may want to try one of the .VB groups.

Maybe:
news://msnews.microsoft.com/microsoft.public.vb.winapi
 
Back
Top