ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Animation in Userform (https://www.excelbanter.com/excel-programming/354435-animation-userform.html)

Henrik

Animation in Userform
 
is it Possibel to get a Animation Picture in a Userform

Animation like a Printer Working or som thing like that
--
Henrik Christensen

Michel Pierron

Animation in Userform
 
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

"Henrik" a écrit dans le message de news:
...
is it Possibel to get a Animation Picture in a Userform

Animation like a Printer Working or som thing like that
--
Henrik Christensen





All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com