Animation in Userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

is it Possibel to get a Animation Picture in a Userform

Animation like a Printer Working or som thing like that
 
Hi Henrik,
Wy not an animated cursor...
In the UserForm module:

Private Declare Function FindWindow& Lib "USER32" Alias _
"FindWindowA" (ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function CreateWindowEx& Lib "USER32" _
Alias "CreateWindowExA" (ByVal dwExStyle& _
, ByVal lpClassName$, ByVal lpWindowName$ _
, ByVal dwStyle&, ByVal x&, ByVal y&, ByVal nWidth& _
, ByVal nHeight&, ByVal hwndParent&, ByVal hMenu& _
, ByVal hInstance&, lpParam As Any)
Private Declare Function LoadCursorFromFile& Lib "USER32" _
Alias "LoadCursorFromFileA" (ByVal lpFileName As Any)
Private Declare Function SendMessage& Lib "USER32" _
Alias "SendMessageA" (ByVal hWnd&, ByVal wMsg& _
, ByVal wParam&, lParam As Any)
Private Declare Function DestroyWindow& Lib "USER32" (ByVal hWnd&)
Private hWnd&

Private Sub UserForm_Activate()
Dim Icon$, hIcon&, hMe&
Icon = ThisWorkbook.Path & "\Globe.ani"
If Dir(Icon) = "" Then Exit Sub
hIcon = LoadCursorFromFile(Icon)
hMe = FindWindow(vbNullString, Me.Caption)
' &H50000003 = WS_CHILD Or WS_VISIBLE Or SS_ICON
hWnd = CreateWindowEx(0, "Static", "", &H50000003 _
, ByVal 10, ByVal 10, 0, 0, hMe, 0, 0, ByVal 0)
' &H172 = STM_SETIMAGE / &H2 = IMAGE_CURSOR
SendMessage hWnd, &H172, &H2, ByVal hIcon
End Sub

Private Sub UserForm_QueryClose(Cancel%, CloseMode%)
If hWnd Then DestroyWindow hWnd
End Sub

Regards,
MP
 

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

Similar Threads


Back
Top