Bildschirmschoner problem

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

Odin

Betreff: Bildschirmschoner problem

BeitragMi, Nov 26, 2008 17:49
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi Smile
Ich habe folgendes Problem:
Ich habe einen Bilschirmschoner gemacht, ihn zu einer *.scr-Datei kompiliert und ihn dann installiert.
Dann kam dieses "Eigenschaften von Anzeige"-Fenster von Windows und als ich auf Vorschau geklickt habe, lief der Bildschirmschoner ganz normal.
Aber als ich ganz normal auf "Eigenschaften von Anzeige" gegangen bin und auf Vorschau geklickt hab, hat der mir "Memory Access Violation" gemeldet und ich weiß nicht, warum Sad
Mein Code sieht so aus:
Code: [AUSKLAPPEN]
a$ = CommandLine ()
If Instr(Upper(a$),"C")  Then SetupOptionen()
If Instr(Upper(a$),"S")  Then Bildschirmschoner()

Function Bildschirmschoner()
file=ReadFile("Data\optionen.txt")
x=ReadLine(file)
y=ReadLine(file)
Graphics x,y,32,1
CloseFile(file)
SetBuffer BackBuffer()

SeedRnd(MilliSecs())

Ankyb=LoadImage("img\B.png")
Ankyg=LoadImage("img\G.png")
Ankyr=LoadImage("img\R.png")

MoveMouse 100,100
While GetKey()=0 And GetMouse()=0 And MouseX()=100 And MouseY()=100
   Cls
pbx=Rand(0,x)
pby=Rand(0,y)
pgx=Rand(0,x)
pgy=Rand(0,y)
prx=Rand(0,x)
pry=Rand(0,y)
DrawImage Ankyb,pbx,pby
DrawImage Ankyg,pgx,pgy
DrawImage Ankyr,prx,pry
Flip
time=MilliSecs()
While MilliSecs()<time+Rand(10000,30000) And GetKey()=0 And GetMouse()=0 And MouseX()=100 And MouseY()=100
Wend
Wend
End
End Function

Function SetupOptionen()
AppTitle "Optionen"
Graphics 250,250,32,2

file=ReadFile("Data\optionen.txt")

Print "Bildschrimgröße:"+ReadLine$(file)+"*"+ReadLine$(file)
CloseFile(file)
Print "Ändern? J/N"
ans$=Input()
If ans$="J" Or ans$="j" Then
file=WriteFile("Data\optionen.txt")
Print "Breite?"
WriteLine(file,Input())
Print "Höhe?"
WriteLine(file,Input())
CloseFile(file)
EndIf
End Function

Ich hoffe, ihr könnt mir helfen.
++~~'#Y#'~~++
Mein Notebook:
1.86 MHz Dual Core
2 GB RAM
256 MB Onboard Grafik Shared Memory
15,4" Glare Type Display
Möhrensaft Windoof XP
 

chi

BeitragFr, Nov 28, 2008 14:00
Antworten mit Zitat
Benutzer-Profile anzeigen
hi odin,

hab ein paar sachen gefunden warum es bei dir nicht funktionieren könnte... aber ohne medien hab ich keine lust herum zu probieren... also die einfache variante:

{
edit:
der grund warum dein screensaver nach der installation nicht funktioniert:

-> ChangeDir SystemProperty$("appdir")
... muss man bei einem screensaver immer verwenden! (zum testen in der ide auskommentieren )

-> mediafiles wahrscheinlich nicht im richtigen folder
... bei installation wird die .scr datei in den system32 folder kopiert. alle medien müssen sich daher auch in diesem folder befinden (falls du deine medien nicht mit deiner .exe bzw .scr verlinkst ( blitzmedialinker))
}

Code: [AUSKLAPPEN]

; --------------------------------------------------------------------------------------------
; |                                                                                          | 
; | Tutorial: How to create a Blitz Screensaver by Grisu                               v1.00 |
; |                                                                                          | 
; | File: "SS_Tutorial2.bb"                                                                  | 
; |                                                                                          | 
; --------------------------------------------------------------------------------------------
; |                                                                                          | 
; | This code serves as Example Screensaver.                                                 | 
; |                                                                                          | 
; | 1. Compile and rename the executable to "*.scr".                                         | 
; |                                                                                          | 
; | 2. Copy the Screensaver to the Windows Rootfolder and test it. :)                        | 
; |                                                                                          | 
; --------------------------------------------------------------------------------------------
; |                                                                                          | 
; | Known Issues when making Blitz Screensavers:                                             |
; |                                                                                          | 
; | - It's impossible to show a preview of your Screensaver inside the Windows Display Box.  | 
; |                                                                                          | 
; | - When starting your Screensaver a small GFX Window might be visible at first.           | 
; |                                                                                          | 
; --------------------------------------------------------------------------------------------
Global hWnd=SystemProperty("ApphWnd")

Const SCREENX=1024                   ; 2 Const for the set Resolution
Const SCREENY=768

;ChangeDir SystemProperty$("appdir") ; IMPORTANT
                                    ; Needed to run your Screensaver under Windows!!!.
                                    ; It changes the runtime Dir to where the Screensaver is located.
                                    ; Disable it while testing, because "appdir" of Blitz is "\bin".
                                    ; else your program might just crash!!! :)


; Checking Parameters that Windows uses for handling Screensavers

If CommandLine$() <> "" Then                                ; If Parameter is present then
  If Upper(Left$(CommandLine$(),2)) = "/C" Then Configure() ;  check if Screensaver Configuration shall be exectued
  If Upper(Left$(CommandLine$(),2)) = "/S" Then Start()     ;  or Screensaver itself should be started 
EndIf ; <> ""

End   ; End program... bye bye


Function Configure()
; --------------------------------------------------------------------------------------------
; |                                                                                          | 
; | Insert Code for your Configuration Screen.                                               | 
; |                                                                                          | 
; | If needed, execute an external application. Written in VB, Delphi or whatever.           |
; |                                                                                          | 
; --------------------------------------------------------------------------------------------

    ; Simple Output, just to demonstrate a Configuration Screen!

    AppTitle "Screensaver Options"    ; Change Header
    Graphics 640,480,0,2             ; set GFX Mode
    SetBuffer BackBuffer()
      api_ShowWindow hWnd,5
    Repeat
      Text 10,10, "Grisu's Sreensaver Tutorial" 
      Text 10,20, "-----------------------------------------"
      Text 10,40, "This is only a simple Screensaver."
      Text 10,60, "Thus there is nothing to configure!"
      Text 10,450,"Press a key or hit your litte mouse... :)"
      Flip
      Delay 1                         ; secure that the CPU usage is not 100% all time!
    Until GetKey() Or WaitMouse() 

End Function                       ; of Configure()



Function Start()
; --------------------------------------------------------------------------------------------
; |                                                                                          | 
; | Insert Code for your Screensaver program                                                 | 
; |                                                                                          | 
; --------------------------------------------------------------------------------------------

    AppTitle "Screensaver Tutorial1"    ; The Name of your Screensaver
    Graphics SCREENX,SCREENY,0,1       ; set GFX Mode
    SetBuffer BackBuffer()

   FlushKeys()                   ; clean keyboardbuffer
   FlushMouse()                  ; clean mousebuffer 
   MoveMouse 0,0                 ; move mouse to 0,0 for later check

    Textout$="Grisu's Screensaver Tutorial"             ; Simple text to be displayed

   Repeat                                              ; Main loop for your Screensaver Code

          Color Rand(255),Rand(255),Rand(255)           ; display C64 like loading Screen ;)   
          Rect 0,0,SCREENX,SCREENY,1
         
          Color 0,0,0                                   ; add Scanline effect
          For y=0 To SCREENY Step 2                   
             Rect 0,y,SCREENX,1           
          Next           

          Rect 50,50,SCREENX-100,SCREENY-100,1          ; add Black Box in the center

          Color 255,255,255                             ; display some text
          Text (SCREENX-StringWidth(Textout$))/2,SCREENY/2, Textout$ 

          Flip                                          ; do flip
          Delay 4                                       ; secure that the CPU usage is not 100% all time!    
   Until GetMouse() <> 0 Or MouseX() <> 0 Or MouseY() <> 0 Or GetKey() <> 0 ; check if user makes a move :)

End Function                      ; of Start()


Zitat:

Known Issues when making Blitz Screensavers:

- It's impossible to show a preview of your Screensaver inside the Windows Display Box.
- When starting your Screensaver a small GFX Window might be visible at first.


-> auch für diese probleme gibt es eine lösung... nur etwas schwieriger


cheers, chi

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group