ShowDialog(Me) does not function with AnimateWindow API


T

Tim

Dear All,

I have discovered, to my dismay, that the ShowDialog function will not
function correctly when used with the AnimateWindow API. The owned
form is opened behind the owning form on the second consecutive call,
which goes against the principles of the ShowDialog function. Does
anyone know a work around that still allow the for the use of the
AnimateWindoe API ? Or should I just forget about this API ?

Does anyone else use this API?

Regards,

Tim

CODE:
'USED TO OPEN WINDOWS IN ANIMATION STYLE
Private Declare Auto Function AnimateWindow Lib "user32.dll"
(ByVal hWnd As Integer, _
ByVal
dwTime As Integer, _
ByVal
dwFlags As Integer _
) As
Boolean
'HOLDS DIFFERENT ANIMATION STYLES
Public Enum AnimateStyles
Slide = 262144
Activate = 131072
Blend = 524288
Hide = 65536
Center = 16
HOR_Positive = 1
HOR_Negative = 2
VER_Positive = 4
VER_Negative = 8
End Enum


Private Sub GetContact()
Try
'CREATE A NEW INSTANCE OF THE ORGANISATIONS FORM FOR
SELECTION OF A PERSON
Dim ofrmOrganisations As New
frmOrganisations(contacts.frmOrganisations.FormOperation.PersonSelection)

'SET BASIC SETTINGS
With ofrmOrganisations
.ShowInTaskbar = False
.StartPosition =
Windows.Forms.FormStartPosition.Manual
End With

'ADD REFERENCE FOR EVENT HANDLER FOR WHEN USER HAS
SELECTED A PERSON
AddHandler ofrmOrganisations.PersonSelected, AddressOf
OnPersonSelected

'API RETURNS WHEN THE BLEND IS COMPLETED
AnimateWindow(ofrmOrganisations.Handle.ToInt32, 100,
AnimateStyles.Blend)
'DISPLAY FORM
ofrmOrganisations.ShowDialog(Me)

Catch excep As System.Exception
'CATCHES ALL ERRORS
MessageBox.Show("Message: " & excep.Message)

End Try

End Sub
 
Ad

Advertisements

T

Tom Shelton

Dear All,

I have discovered, to my dismay, that the ShowDialog function will not
function correctly when used with the AnimateWindow API. The owned
form is opened behind the owning form on the second consecutive call,
which goes against the principles of the ShowDialog function. Does
anyone know a work around that still allow the for the use of the
AnimateWindoe API ? Or should I just forget about this API ?

Does anyone else use this API?

Regards,

Tim

Tim,

I have never used this API call, so I can't really answer your question
- but I think you might have better luck with it over on the framework
interop group:

microsoft.public.dotnet.framework.interop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top