Well I don't know if this helps or not but you don't need form4 (at least in the sample project). Change your project's properties so that the Startup Object is Sub Main and then put this in Module1.
Are you saying that you want to set Form1 to vbModal and yet be able to enter data into Form2 and/or Form3? If so then that's not possible but you could fake it by setting the Enabled property to False temporarily on all the forms you don't want people to be able to access.
The program was using a Sheridan control to do this (SSSplitter), but I wanted to get rid of the SSSplitter since it was causing some other issues.
One thing the SSSplitter did was allowed the form to be modal with forms in each of its panes...
Microsoft mentions that you should do something with WM_CHANGEUISTATE/WM_UPDATEUISTATE when you use SetParent, so I was going to look into that as well....
Just didn't know if anyone else had found a way around this other than disabling/enabling the other forms....
I haven't tried your new sample project but before I do let me ask why do you use forms in frames? Why not put whatever controls you need in the frames themselves?
Wasn't exactly my choice on how to do it, but it is a very large VB 6.0 project.
What they did was create some common forms that other forms need to use regularly.
Then on the forms that need the common forms, they used Sheridans SSSplitter Control to bring the Common forms in.
I found the problem with the datagrids, and it seemed to be the Splitters fault, so I changed from the Splitter to Frames and the SetParent API.
This fixed the datagrid problem until I did the SetWindowLong API call, then it breaks just like the Splitter (which must be doing the same thing).... The SetWindowLong needs to be done, otherwise the Parent Form loses focus when the child form is entered.... (also major problems if the form is displayed modally.....)
Don't know if anyone cares, but it also happens with the FlexGrid, but I did find a workaround for it, I added a text box to the screen with the DataGrid and simply put it behind the DataGrid, then do the following:
VB Code:
Private Sub DataGrid1_Click()
me.txtDataGridFocusOnly.SetFocus
Me.DataGrid1.SetFocus
End Sub
Seems like I'm the only one that ran into the problem, since no one else seemed to know about it! But now it is really resolved..............