Are the offsets necessary?
What is happening with that orientation setting?
Could the combination of those two be causing it?
I don't really see very much else happening, so maybe try changing one of those and see what happens.
As in change...
CreateAdvertEx(0, 0, 0, 0, 2, 2)
...to...
CreateAdvert(0, 0, 0, 0)
or...
SetOrientationAllowed( 1, 1, 1, 1 )
...to...
SetOrientationAllowed( 0, 0, 1, 1 )
Because it looks like you are using landscape mode for the set up.
Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1