Lenguaje de programación Borland Delphi
Este truco en Delphi muestra la ventana de "Propiedades de Fecha y Hora" de Windows. Necesitaremos un TButton, un TForm y en el USES del mismo añadiremos "ShellApi". Os mostramos el código fuente completo del formulario:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, shellapi;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function obtenerDirSistema: string;
var
SysDir: PChar;
begin
GetMem(SysDir, MAX_PATH);
GetSystemDirectory(SysDir, MAX_PATH);
Result := StrPas(SysDir);
FreeMem(SysDir, MAX_PATH);
if (Result[Length(Result)] <> '\') then
Result := Result + '\';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(0, nil, PChar(obtenerDirSistema + 'rundll32.exe'),
PChar('shell32.dll,Control_RunDLL Timedate.cpl'), PChar(GetSystemDir), SW_SHOW);
end;
end.
Publicado el: 2005-08-07