Windows transitions
Windows transitions
Any one know how to use or code windows transitions for like a slide show.
Thanks
Thanks
Do a search for AnimateWindow and you'll find a few examples. Here's a quick snippet to get you started.
*** Edit to update code to PB4.x

Code: Select all
If OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE)
AnimateWindow_(WindowID(0), 1000, #AW_BLEND)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
AnimateWindow_(WindowID(0), 1000, #AW_CENTER)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE)
quit = 1
Repeat
event = WaitWindowEvent()
If event = #PB_Event_CloseWindow
quit = 1
EndIf
Until quit
EndIf
Last edited by Sparkie on Sat Apr 12, 2008 3:59 pm, edited 2 times in total.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Change this:
The example is for PB3.xx not for PB4.xx
Code: Select all
OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
I ran it fine in 4.2b2 as well.
The close window event will only owrk if the window is open... I reccomend killing it in the compiler. 
Code: Select all
#AW_ACTIVATE = $20000
#AW_BLEND = $80000
#AW_CENTER = $10
#AW_HIDE = $10000
#AW_HOR_NEGATIVE = 2
#AW_HOR_POSITIVE = 1
#AW_SLIDE = $40000
#AW_VER_NEGATIVE = 8
#AW_VER_POSITIVE = 4
OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Repeat
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE)
SendMessage_(WindowID(0), #WM_PAINT, 0, 0)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_BLEND)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_CENTER)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE)
Delay(1000)
Until Event = #PB_Event_CloseWindow
End

@UserOfPure
It works on PB4.20 beta 4
Minimize the PB-Ide after start to see the result!
It works on PB4.20 beta 4
Minimize the PB-Ide after start to see the result!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Test this please:
Code: Select all
Procedure CreateShellObject()
Protected obj.l, hResult.l
CoInitialize_(#Null)
hResult = CoCreateInstance_(?CLSID_Shell_Application, 0, 1, ?IID_IShellDispatch, @obj)
If Not hResult
ProcedureReturn obj
Else
ProcedureReturn #False
EndIf
DataSection
CLSID_Shell_Application: ; {13709620-C279-11CE-A49E-444553540000}
Data.l $13709620
Data.w $C279,$11CE
Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
IID_IShellDispatch: ; {D8F015C0-C278-11CE-A49E-444553540000}
Data.l $D8F015C0
Data.w $C278,$11CE
Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
EndDataSection
EndProcedure
Procedure ReleaseShellObject(obj.l)
Protected object.IUnknown = obj
object\Release()
EndProcedure
Define.IShellDispatch shell
shell = CreateShellObject()
If shell
shell\MinimizeAll() ; alle Fenster minimieren
#AW_ACTIVATE = $20000
#AW_BLEND = $80000
#AW_CENTER = $10
#AW_HIDE = $10000
#AW_HOR_NEGATIVE = 2
#AW_HOR_POSITIVE = 1
#AW_SLIDE = $40000
#AW_VER_NEGATIVE = 8
#AW_VER_POSITIVE = 4
OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE)
SendMessage_(WindowID(0), #WM_PAINT, 0, 0)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_BLEND)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_CENTER)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER)
Delay(1000)
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE)
Delay(1000)
shell\UndoMinimizeALL() ; minimieren rückgängig machen
ReleaseShellObject(shell)
EndIf
Last edited by ts-soft on Sat Apr 12, 2008 6:54 am, edited 1 time in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Yes, that works perfectly now (except for the #AW_BLEND animation, which still fails). I get a window in the center of the screen doing all the animations. But it's still a bug if v3.94 did it but v4.20 doesn't (on all PCs, that is). And who wants to minimize all windows to do it, when v3.94 didn't have to?
What would the bug be? All the code posted use mainly API functions.UserOfPure wrote:Yes, that works perfectly now (except for the #AW_BLEND animation, which still fails). I get a window in the center of the screen doing all the animations. But it's still a bug if v3.94 did it but v4.20 doesn't (on all PCs, that is). And who wants to minimize all windows to do it, when v3.94 didn't have to?
I ran the example ts-soft posted and it worked with v4.1 and I didn't have to manually minimize any windows (using jaPBe).
Since you're a user of PureBasic, write the code so it does things the way you want it to be done. It's not a bug because an example written for someone else doesn't satisfy your needs.
