Test

Aus Byte-Welt Wiki
Version vom 27. Februar 2007, 19:21 Uhr von 84.56.146.88 (Diskussion)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springenZur Suche springen

<math>a\sqrt{a}</math>Code funktioniert mit <code=blup></code=blup> :) Und er verzieht nicht das Layout :D

<code=csharp> using System.Runtime.InteropServices; using System;

public class Blupp {

   [DllImport("user32", CharSet = CharSet.Auto)]
   public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, int lParam);
   [DllImport("user32", CharSet = CharSet.Auto)]
   public static extern bool IsWindowVisible(IntPtr hwnd);
   [DllImport("user32", CharSet = CharSet.Auto)]
   public static extern bool SetWindowText(IntPtr hWnd, string lpString);
   public static void Main(string[] args)
   {
       bool b = EnumWindows(new EnumWindowsProc(EnumWindowsImpl), 34);
       System.Console.WriteLine(b);
       Environment.Exit(0);
   }
   public delegate bool EnumWindowsProc (IntPtr hwnd, int lParam);
   public static bool EnumWindowsImpl(IntPtr hwnd, int lParam)
   {
   	if(IsWindowVisible (hwnd)){
   		SetWindowText (hwnd, "Illuvatar hax0rs da w0rld!!!11einself");
   	}
       return true;
   }

} </code=csharp>

Test von <code></code>

import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector;

import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField;


public class InstallView extends JFrame {

  private Vector<String> infos = new WinInstallTime().getInfos();
  private JPanel infoPanel = new JPanel();
  private GridBagLayout gbl = new GridBagLayout();
  private GridBagConstraints gbc = new GridBagConstraints();
  private JLabel osname = new JLabel("OS Name:");
  private JTextField nameTF = new JTextField();
  private JLabel osarch = new JLabel("OS Arch:");
  private JTextField archTF = new JTextField();
  private JLabel osversion = new JLabel("OS Version:");
  private JTextField versionTF = new JTextField();
  private JLabel installDate = new JLabel();
  private JTextField dateTF = new JTextField();
  private JLabel installTime = new JLabel();
  private JTextField timeTF = new JTextField();
  private JButton exit = new JButton("Ok Danke...");
  public InstallView()
  {
     infoPanel.setLayout(gbl);
     gbc.fill = GridBagConstraints.BOTH;
     gbc.insets = new Insets(2, 2, 2, 2);
     
     
     // OS.NAME
     gbc.gridx = 0;
     gbc.gridy = 0;
     gbc.weightx = 0;
     gbl.setConstraints(osname, gbc);
     infoPanel.add(osname);
     
     gbc.gridx = 1;
     gbc.gridy = 0;
     gbc.gridwidth = 2;
     gbc.gridheight = 1;
     gbc.weightx = 1.0;
     gbl.setConstraints(nameTF, gbc);
     infoPanel.add(nameTF);
     
     // OS.ARCH
     gbc.gridx = 2;
     gbc.gridy = 0;
     gbc.weightx = 0;
     gbl.setConstraints(osarch, gbc);
     infoPanel.add(osarch);
     
     gbc.gridx = 3;
     gbc.gridy = 0;
     gbc.gridwidth = 2;
     gbc.gridheight = 1;
     gbc.weightx = 1.0;
     gbl.setConstraints(archTF, gbc);
     infoPanel.add(archTF);
     
     // OS.VRSION
     gbc.gridx = 4;
     gbc.gridy = 0;
     gbc.weightx = 0;
     gbl.setConstraints(osversion, gbc);
     infoPanel.add(osversion);
     
     gbc.gridx = 5;
     gbc.gridy = 0;
     gbc.gridwidth = 2;
     gbc.gridheight = 1;
     gbc.weightx = 1.0;
     gbl.setConstraints(versionTF, gbc);
     infoPanel.add(versionTF);
     
     add(infoPanel, BorderLayout.CENTER);
     exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e)
        {
           InstallView.this.dispose();
        }
     });
     add(exit, BorderLayout.SOUTH);
     
     setTitle("Ein paar Windows Infos");
     setSize(400, 300); setResizable(false);
     setLocationRelativeTo(null);
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     setVisible(true);
  }
  public static void main(String[] args)
  {
     new InstallView();
  }

}