Bom é util para mim, quando estou no windows

1. Bom é util para mim, quando estou no windows

Augusto César da Costa Marques
gtcesar

(usa Ubuntu)

Enviado em 08/05/2008 - 20:49h

//crie um arquivo e salve como .php
<?php

if (!class_exists('gtk'))
{
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
dl('php_gtk.dll');
else
dl('php_gtk.so');
}

function deletarEvento()
{
return false;
}

function finalizar()
{
gtk::main_quit();
}

function Button1Clicked()
{
$capturar=("notepad");
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'){
pclose(popen("start ".$capturar, "r"));
} else {
exec($capturar." > /dev/null &");
}
}

function Button2Clicked()
{
$capturar=("cmd");
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'){
pclose(popen("start ".$capturar, "r"));
} else {
exec($capturar." > /dev/null &");
}
}

function Button3Clicked()
{
$capturar=("calc");
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'){
pclose(popen("start ".$capturar, "r"));
} else {
exec($capturar." > /dev/null &");
}
}

function Button4Clicked()
{
$capturar=("winword");
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'){
pclose(popen("start ".$capturar, "r"));
} else {
exec($capturar." > /dev/null &");
}
}

class NoName extends GtkWindow
{

public function __construct()
{
// instancia janela
parent::__construct();

// define titulo, borda e redimensionamento
parent::set_title('Util');
parent::set_border_width(1);
parent::set_resizable(false);

// define tamanho
parent::set_size_request(115,215);

// quando for fechada
parent::connect_simple('destroy', 'finalizar');
parent::connect_simple('delete-event', 'deletarEvento');

// cria GtkLayout, para posicionar widgets
$LayoutForm1 = new GtkLayout;
parent::add($LayoutForm1);


//cria e posiciona GtkButton
$Button1 = new GtkButton('Bloco de Notas');
$Button1->set_image(GtkImage::new_from_stock(Gtk::STOCK_EDIT, Gtk::ICON_SIZE_SMALL_TOOLBAR));
$Button1->set_size_request(101,47);
$LayoutForm1->put($Button1, 7,7);
$Button1->connect('clicked', 'Button1Clicked');


//cria e posiciona GtkButton
$Button2 = new GtkButton('Command');
$Button2->set_image(GtkImage::new_from_stock(Gtk::STOCK_EXECUTE, Gtk::ICON_SIZE_SMALL_TOOLBAR));
$Button2->set_size_request(101,47);
$LayoutForm1->put($Button2, 7,59);
$Button2->connect('clicked', 'Button2Clicked');


//cria e posiciona GtkButton
$Button3 = new GtkButton('Calculadora');
$Button3->set_image(GtkImage::new_from_stock(Gtk::STOCK_PREFERENCES, Gtk::ICON_SIZE_SMALL_TOOLBAR));
$Button3->set_size_request(101,47);
$LayoutForm1->put($Button3, 7,110);
$Button3->connect('clicked', 'Button3Clicked');


//cria e posiciona GtkButton
$Button4 = new GtkButton('Word');
$Button4->set_image(GtkImage::new_from_stock(Gtk::STOCK_JUSTIFY_CENTER, Gtk::ICON_SIZE_SMALL_TOOLBAR));
$Button4->set_size_request(101,47);
$LayoutForm1->put($Button4, 7,162);
$Button4->connect('clicked', 'Button4Clicked');

}

}

$app = new NoName;
$app->show_all();
gtk::main();

?>


  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts