OpenWindowedScreen and Vista

Just starting out? Need help? Post your questions and find answers here.
BillNee
User
User
Posts: 93
Joined: Thu Jan 29, 2004 6:01 am
Location: Homosassa, FL

OpenWindowedScreen and Vista

Post by BillNee »

Hi all - my kids want to give me a new computer for my birthday. I'm worried that all the new ones have Vista and I have a problem running some of my programs that us OpenWindowedScreen.
The following program works fine in XP, but using Vista Windows Aero it runs flipbuffers 10 times with a black titlebar, no name, etc. It runs 19 times with the revolving circular curser so you can't stop it before then. When closing, the screen flickers and you can see the desktop for a split second. If the length L is changed to 512 I get a compilation0.exe error. Using directx9 as a compiler option stops the program at a blank screen.
Don't know if this is my programming, Vista or what. Old Amiga programs using bitblit, etc seem to run ok. Any help for a great 70th will be appreciated. Any advice on the program is welcome. If someone has Windows7 I'd like to know how this runs.
When I try to run this code or even copy the original to a new tab I get a red line debug error in the plot(x,y...) line. Don't understand since the original works fine and I'm just copying it. My first attempt at submitting code so maybe I'm doing something wrong.

Code: Select all


;cyclic ca
InitSprite()
Define.w r,t,c,cc,l,lp1,m,n,c1,x,xx,x1,y,yy,y1,s
Define.l sco
l=500:lp1=l+1
Dim n.w(l,l):Dim nn.w(l,l)
r=5:t=10:c=10
m=Int(255/c)

hwnd=OpenWindow(0,0,0,l,l,"CCA",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(hwnd,0,0,l,l,0,0,0):sco=ScreenOutput()
ClearScreen(0):FlipBuffers()
For x=0 To l:For y=0 To l:cc=Random(c):n(x,y)=cc:Next:Next

Repeat:
StartDrawing(sco)

For x=0 To l:For y=0 To l:cc=n(x,y):c1=cc+1:If c1>c:c1=0:EndIf
s=0
  For xx=x-r To x+r:x1=xx
  If x1<0:x1+lp1:EndIf
  If x1>l:x1-lp1:EndIf
  For yy=y-r To y+r:y1=yy
    If y1<0:y1+lp1:EndIf
    If y1>l:y1-lp1:EndIf
    If n(x1,y1)=c1:s+1:EndIf
      If s=>t:cc=c1:Break 2:EndIf
  Next:Next
  nn(x,y)=cc:cc*m
  Plot(x,y,RGB(cc,cc>>1,cc>>2))
Next:Next
StopDrawing()
Swap n(),nn()
FlipBuffers()
Until WindowEvent()=#PB_Event_CloseWindow
End
Thanks
Bill Nee
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

generally:
ScreenOutput often is no static value, better call it every frame, right in the StartDrawing.

for the Vista Problem:
to my knowledge, Aero is not compatible to DX7, so it tries to switch aero off every time you start a DX7 process,
maybe this invokes specific problems here.
on the other hand, DX9 is not capable of Drawing to the Screen.

think about switching off Aero in general, and run it as a DX7 compile,
or think of a solution without Drawing to ScreenOutput and compile DX9.

PS:
this is only information I gathered from the forums. I have no Vista on my machines.
except the DX9/ScreenDrawing problem, this occurs on every Windows.
oh... and have a nice day.
BillNee
User
User
Posts: 93
Joined: Thu Jan 29, 2004 6:01 am
Location: Homosassa, FL

Copy and the Editor

Post by BillNee »

Hi - just figured out that when I copied the program to a new editor tab the compiler options added "enable XP skin support" and the debugger became checked. Didn't realize that just copying a program would also change some settings. Also don't understand why having the debugger checked would give an error and stop the program, while unchecked it runs ok.
But one mystery solved.
Bill
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

the settings for new tabs are those set in the Preferences.

XP-Skin support uses completely different GUI dlls, so with a window surface it can show significantly different results.
... at least speaking for XP, don't recall special reports regarding this on Vista.

having the debugger checked will compile a completely different exe,
better make sure to always have it off unless you really need external debugging.
oh... and have a nice day.
BillNee
User
User
Posts: 93
Joined: Thu Jan 29, 2004 6:01 am
Location: Homosassa, FL

Got It

Post by BillNee »

Thanks for the help Kaeru. Your advice to think of another way to draw worked. I tried containers, images, imagegadgets, etc. Finally settled on using CreateSprite and Startdrawing(Spriteoutput(0)). This method compiles ok on Vista using dx9. It does change some of my pallet colors but that's ok.
Once in a while if I move the curser over the running sprite I get a series of dots above the arror or I-bar cursor. I can see the colored dots move as the program flips buffers. The dots stay until I run another program; one time they stayed even when I quit PB. Has never happened before, but I havn't used sprites in my programs before.
Don't know how but my preferences got changed to include skin support and the debugger. I've never used either. Maybe a Punch program I copied included them.
Thanks again for making me think. Appreciated the advice.
Bill Nee
Digital Wargames
Enthusiast
Enthusiast
Posts: 203
Joined: Sat May 23, 2009 4:39 am

Post by Digital Wargames »

I'm worried that all the new ones have Vista
You might want to check, but Vista might still have downgrade rights so you can downgrade to XP. Windows 7 will have downgrade rights to XP for 18 months (April 2011).
Post Reply