Autor Beitrag
Namenlosnameless
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 259
Erhaltene Danke: 6

Windows XP Home Edition, Windos Vista
C#
BeitragVerfasst: Sa 24.07.10 20:12 
Hallo!

Ich habe mir einen Bildschirmschoner gebastelt die den iTunes-Visualizer nutzt!

Nun zu meinem Problem:

Wenn ich das Programm teste funktioniert es, wenn ich die .exe dann auf .scr umbenenne und den Bildschirmschoner einstellen will funktioniert auch die Vorschau noch, das wesentliche (der Aufruf um den Bildschirm zu schonen) erzeugt eine fehlermeldung und ruft den JIT-Debugger auf!

Wenn ich in der Programm.cs nur die Form1 laufen lasse, dann läuft ebenfalls alles einwandfrei!

Mein Code:


Programm.cs

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using iTunes_ScreenSaver;

namespace MeinBildschirmschoner
{
    static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]

        static void Main(string[] args)
        {

            if (args.Length > 0)
            {
                string arg = args[0].ToLower().Trim().Substring(02);

                switch (arg)
                {
                    case "/c"break;

                    case "/p"break;

                    case "/s":
                        Form1 frm1 = new Form1();
                        Application.Run(frm1);
                        break;
                }
            }
        }
    }
}


Die ScreenSaver-Klasse:

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
using iTunesLib;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;

namespace iTunes_ScreenSaver
{
  public partial class Form1 : System.Windows.Forms.Form
  {
        iTunesApp itunes = new iTunesApp();
        IITPlaylist pl;

        Timer th=new Timer();

    public Form1()
    {
            
            
      InitializeComponent();
            
    }

    private void Form1_Load(object sender, EventArgs e)
    {
            th.Interval = 100;
            th.Tick += new EventHandler(th_Tick);
            

            IITLibraryPlaylist mainLibrary = itunes.LibraryPlaylist;
            pl = itunes.LibrarySource.Playlists.ItemByName["Mediathek"];
            pl.PlayFirstTrack();
            itunes.FullScreenVisuals = true;
            
            
            itunes.VisualsEnabled = true;
            th.Start();
         
    }

        void th_Tick(object sender, EventArgs e)
        {
            
            if (itunes.VisualsEnabled == false)
            {
                itunes.Quit();
                this.Close();
            }
        }

  }
}


Stimmt der Code nicht oder lässt sich das nicht als ScreenSaver realisieren?

mfg Christoph
Einloggen, um Attachments anzusehen!
_________________
1:<<Life sucks!!>> 2:<< Well okay>> 1: <<Just Yours>> 2:<<Ohmph>>


Zuletzt bearbeitet von Namenlosnameless am Sa 24.07.10 23:22, insgesamt 1-mal bearbeitet
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Sa 24.07.10 20:38 
Besitzt die Fehlermeldung auch einen Inhalt?

Und dass heutzutage Bildschirmschoner Bildschirme schonen, halte ich für ein Gerücht :mrgreen: .

_________________
>λ=
Namenlosnameless Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 259
Erhaltene Danke: 6

Windows XP Home Edition, Windos Vista
C#
BeitragVerfasst: Sa 24.07.10 23:23 
ja sie besitzt einen Ihnhat, oder sollte ich sagen viele, es ist ständig eine andere Exception die ausgelöst wird ;) ich hab mal eine als Bild reingeladen!

_________________
1:<<Life sucks!!>> 2:<< Well okay>> 1: <<Just Yours>> 2:<<Ohmph>>
Namenlosnameless Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 259
Erhaltene Danke: 6

Windows XP Home Edition, Windos Vista
C#
BeitragVerfasst: So 25.07.10 09:47 
Mittlerweile weiß ich auch bei welcher Codezeile er das Problem feststellt...

gleich bei: iTunesApp itunes=new iTunesApp(); lustigerweise hat der JIT-Debugger kein Problem damit wenn iTunes vor dem start bereits läuft..

Darum hab ich verucht itunes vor der Zeile: iTunesApp itunes=new iTunesApp(); zu starten, indem ich den Prozess manuell starten wollte, das hat aber wieder eine andere Fehlermeldung ausgelöst!

schon langsam verzweifle ich :(
Einloggen, um Attachments anzusehen!
_________________
1:<<Life sucks!!>> 2:<< Well okay>> 1: <<Just Yours>> 2:<<Ohmph>>
Namenlosnameless Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 259
Erhaltene Danke: 6

Windows XP Home Edition, Windos Vista
C#
BeitragVerfasst: Mo 26.07.10 14:56 
kann es vielleicht sein das sich das mit dem ScreenSaver nicht verträgt?

_________________
1:<<Life sucks!!>> 2:<< Well okay>> 1: <<Just Yours>> 2:<<Ohmph>>