Autor Beitrag
Roy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 23.10.06 20:40 
Hallo alle Miteinander!

Meine Frage: ist es möglich bedingt einer Versionsüberprüfung ein Bild anzeigen zu lassen? Das heißt wenn es eine Win 2000 Version ist soll ein Bild von Win 2000 angezeigt werden oder nach prüfung ein XP oder, oder, oder!

Danke im voraus
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 23.10.06 20:43 
Hi,

das sollte dir weiterhelfen:
ausblenden Delphi-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:
function GetWinVersion: string;

begin
  result:='Unbekannte Version';
  case Win32Platform of
    1:
      If Win32MajorVersion=4 Then Begin
        Case Win32MajorVersion of
            0: result:='Windows 95';
            10: result:='Windows 98';
            90: result:='Windows Me';
        end;
      end;
  2:
     Case Win32MajorVersion of
         3:IF Win32MinorVersion=51 then
              result:='Windows NT 3.51';
         4:If Win32MinorVersion=0 then
             result:='Windows NT 4';
         5:Case Win32MinorVersion of
              0: result:='Windows 2000';
              1: result:='Windows XP';
              2: result:='Windows .NET Server';
           end;
     End;
  end;

  if Win32CSDVersion<>'' then
    result:=result+' '+Win32CSDVersion;
end;



greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 23.10.06 20:44 
Vllt hilft dir das weiter ;)
Bsp.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Case GetWinVersion do
 begin
  'Windows 95': Picture.loadfromfile(..)
...

Oder wie auch immer du es machen willst ;)
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 23.10.06 20:47 
user profile iconMarc. hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Case GetWinVersion do
 begin
  'Windows 95': Picture.loadfromfile(..)
...

Wie soll das denn Funktionieren :D ?
Also dann doch lieber das Result in Interger oder so ändern ;)

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.


Zuletzt bearbeitet von Born-to-Frag am Mo 23.10.06 20:48, insgesamt 1-mal bearbeitet
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 23.10.06 20:48 
Mein Gott wird hier einem schnell geholfen.
Danke
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 23.10.06 21:03 
Zitat:
function GetWinVersion: string;

GetWinVersion gibt einen String zurück, warum sollte es also nicht funktionieren? ;)
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 23.10.06 21:05 
1.: case xxx do begin..?
2.: Ich hab da an die Fehlermeldung "Ordinaltyp erforderlich" gedacht ;)

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 23.10.06 21:11 
stimmt, hast recht ja, ich blick vor lauter noten (morgen musik hü inder 7ten >.<) schon gar nicht mehr durch. =(
Dann soller die Bilder direkt in der Function GetWinVersion laden.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 23.10.06 21:15 
user profile iconMarc. hat folgendes geschrieben:
Dann soller die Bilder direkt in der Function GetWinVersion laden.

Rischtisch :zustimm:

PS: Viel Glück

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 23.10.06 21:16 
Ich merke schon es ist auch für Profis nich so einfach. An welcher Stelle sa ich es ihm?
Kommt das bei Result rein und wenn ja wie?

ausblenden volle Höhe Delphi-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:
function GetWinVersion: string;  

 
begin  
  result:='Unbekannte Version';  
  case Win32Platform of  
    1:  
      If Win32MajorVersion=4 Then Begin  
        Case Win32MajorVersion of  
            0: result:='Windows 95';  
            10: result:='Windows 98';  
            90: result:='Windows Me';  
        end;  
      end;  
  2:  
     Case Win32MajorVersion of  
         3:IF Win32MinorVersion=51 then  
              result:='Windows NT 3.51';  
         4:If Win32MinorVersion=0 then  
             result:='Windows NT 4';  
         5:Case Win32MinorVersion of  
              0: result:='Windows 2000';  
              1: result:='Windows XP';  
              2: result:='Windows .NET Server';  
           end;  
     End;  
  end;  

 
  if Win32CSDVersion<>'' then  
    result:=result+' '+Win32CSDVersion;  
end;


Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 23.10.06 22:03 
Hallo,

etwa so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
//...
Case Win32MajorVersion of    
  0: result: = 'c:\BildOrdner\Windows95.bmp';
//usw    
//...


Aufrufen:
ausblenden Delphi-Quelltext
1:
Picture.loadfromfile(GetWinVersion);					

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 23.10.06 23:00 
Mir ist völlig unerklärlich wo dieses Case Win32MajorVersion of und Picture.loadfromfile(GetWinVersion); hin soll. Ich möchte es beim Start über eine Timer automatisch starten lassen nicht über einen Button!
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mo 23.10.06 23:44 
Beim Start über einen Timer? :shock:
Nimm lieber FormCreate, meistens ändert der Benutzer sein Betriebssystem nicht im laufendem Betriebssystem ;)

Also nochmal: Du fügst die Funktion (die du selbst noch etwas abändern musst ;)) in deinen SoureCode ein:

ausblenden volle Höhe Delphi-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:
function GetWinVersion: String;  
begin  
  Result := 'Unbekannte Version';  
  case Win32Platform of  
    1:  
      if Win32MajorVersion = 4 then
      begin  
        case Win32MajorVersion of  
          0: 
            Result := 'C:\BildWennWin95.bmp'; //Dieses Bild wird geladen wenn das Betriebssystem Windows 95 ist  
         
          10: 
            Result := 'Windows 98'; //Hier Dateinamen einsetzen für Win98 

          90: 
            Result := 'Windows Me'; //Sollte klar sein was hier jetzt rein muss ;) 
        end;  
      end;  
    2:  
      case Win32MajorVersion of  
        3:
          if Win32MinorVersion = 51 then  
            Result := 'Windows NT 3.51'; //... 
    
        4:
          if Win32MinorVersion = 0 then  
            Result := 'Windows NT 4'; //... 

        5:
          case Win32MinorVersion of  
            0: 
              Result := 'Windows 2000'; //... 

            1: 
              Result := 'Windows XP'; //... 
            
            2: 
              Result := 'Windows .NET Server'; //... 
          end;  
     end;  
  end;  
end;


Und im FormCreate macht du jetzt einfach:
ausblenden Delphi-Quelltext
1:
Image1.Picture.LoadFromFile(GetWinVersion);					


Jetzt klarer? Die funktion GetWinVersion liefert dir den Dateipfad für das Bild das geladen werden soll.. je nach OS ;)

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 24.10.06 07:41 
Ich bin begeistert, es funktioniert. Allen aktiven Mithelfern ein Herzliches Dankeschön! Werde garantiert auf dieses Forum wider zurück greifen, echt super hier.

Danke sagt Roy
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 24.10.06 11:29 
Ich hänge meine nächste Frage mal gleich an. Also das funktioniert prima, dass nach Auslesen der Win Version das passende Bild angezeigt wird!

Meine nächste Frage wäre: ist es jetzt noch möglich noch zusätzlich in einem Label die Version anzeigen zu lassen?
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 24.10.06 11:37 
Jep, z.B. so:

user profile iconBorn-to-Frag hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function GetWinVersion: String;  
begin  
  Result := 'Unbekannte Version';  
  case Win32Platform of  
    1:  
      if Win32MajorVersion = 4 then
      begin  
        case Win32MajorVersion of  
          0: 
            begin
              Form1.Label1.Caption := 'Windows 95';
              Result := 'C:\BildWennWin95.bmp'; //Dieses Bild wird geladen wenn das Betriebssystem Windows 95 ist  
            end;
         
          //...
        end;  
      end;  
    2:  
      case Win32MajorVersion of  
        //...
     end;  
  end;  
end;

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 24.10.06 11:49 
Danke, es funktioniert Prima. Super Forum!
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mi 07.02.07 18:53 
Hallo und Guten Abend.
Noch eine Frage bezüglich ein Bild bedingt anzeigen lassen. Ich lasse mir in einem DBEdit ein Verfallsdatum anzeigen, dieses wird in einer Accessdatenbank gemacht und funktioniert auch. So nun möchte ich Beisp.-weise wenn im DBEdit der Wert unter 10 Tage kommt ein Bild/Text/Ton erzeugen.

Ist das möglich und wenn ja wie?

Danke
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mi 07.02.07 21:37 
ausblenden Delphi-Quelltext
1:
If StrToInt(DbEdit1.Text)<10 then ...					

Ton abspielen mit TMediaPlayer oder - einfacher - mit sndPlaySound. Siehe Delphi-Hilfe.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Do 08.02.07 10:16 
Danke mir ist damit geholfen und es hat funktioniert.

Zitat:
procedure TForm1.Timer2Timer(Sender: TObject);
begin
If StrToInt(DbEdit5.Text)<10
then Animate2.Visible:=true;
If StrToInt(DbEdit5.Text)>10
then Animate2.Visible:=false;
end;


Vielen Dank