Miroslav,
On my machine (P4m 2.5ghz) in VFP8 it takes 1.8 seconds to create a form that complex and 3.1 seconds to destroy it. It is just going to take a significant amount of time for that many objects to destruct. If you have code in the Destroy() it'll take even longer so make sure that your code is optimized.
It might be possible that VB appears to do this much faster because the actual destruction occurs on a second lower priority thread, but VFP is only single threaded so VFP can't do anything else while the objects are releasing. If you could actually launch this form as a seperate EXE its destruct would "feel" faster.
This makes it marginally faster for me in the QueryUnload:
_screen.LockScreen = .t.
this.Visible = .f.
And in Unload:
_screen.LockScreen = .f.
The test form is constructed with this code in the Init:
this.Height = 1100
this.Width = 1850
for i = 1 to 2000
lcName = "cmd" + transform( i )
this.AddObject( lcName, "commandbutton" )
with this.&lcName
.Top = rand() * 1000
.Left = rand() * 1800
.Visible = .t.
endwith
endfor
insert into timing values ( "Init done", seconds() )
>Sorry for late response.
>I don't have any code in Destroy event. You can test it easy-just make a form and add programaticly 2000 buttons to it(init). Then run the
>form and release it