Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 09-11-2004
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.070
Poder: 32
jhonny Va camino a la famajhonny Va camino a la fama
Ahhh, se me olvidaba, supongo que lo mismo sucedera con el procedimiento cambiartapiz;
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #2  
Antiguo 09-11-2004
dagsoft dagsoft is offline
Miembro
 
Registrado: nov 2004
Posts: 10
Poder: 0
dagsoft Va por buen camino
Question Sigo con el papel tapiz sory

Holas de new gracias por segir respondiendo el problema es que recien me inicio en delphi 6 no se casi nada mira este es el codigo de todo el programa y ahora me marca este error
[Error] Unit1.pas(175): Undeclared identifier: 'Convertir'
[Error] Unit1.pas(177): Undeclared identifier: 'TJPEGImage'

espero que me puedas ayudar si encontras algun error al codigo o algo que se puede hacer de otra forma que sea mejor porfavor ayudame y decime

Saludos Daniel. Desde ya mucha gracias
si queres agregame a tu msn mi dire es: [email protected]



---------------------Codigo del programa completo-------------------------

unit Unit1;
interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,
IniFiles, ThemeMgr, ComCtrls, ExtCtrls, DateUtils, JvSearchFiles,
JvComponent, JvBaseDlg, JvBrowseFolder;

type
TForm1 = class(TForm)
JvBrowseForFolderDialog1: TJvBrowseForFolderDialog;
JvSearchFiles1: TJvSearchFiles;
ThemeManager1: TThemeManager;
GroupBox1: TGroupBox;
Edit1: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
ListBox1: TListBox;
GroupBox3: TGroupBox;
Edit2: TEdit;
UpDown1: TUpDown;
ComboBox1: TComboBox;
CheckBox1: TCheckBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure CheckBox1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure JvSearchFiles1FindFile(Sender: TObject; const AName: String);
private
{ Private declarations }
procedure CambiarFondo;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
inifile: TIniFile;
stemp: string;
begin
inifile := TIniFile.Create( ChangeFileExt(Application.ExeName,'.ini') );
try
stemp := inifile.ReadString('preferences','dir','');

if (stemp <> '') then
begin
Edit1.Text := stemp;
JvBrowseForFolderDialog1.Directory := stemp;
end;

ListBox1.ItemIndex := inifile.ReadInteger('preferences','idx',-1);

finally
inifile.Free;
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
inifile: TIniFile;
begin
inifile := TIniFile.Create( ChangeFileExt(Application.ExeName,'.ini') );
try
inifile.WriteString('preferences','dir',Edit1.Text);



if (ListBox1.ItemIndex <> -1) then
begin
inifile.WriteInteger('preferences','idx',ListBox1.ItemIndex);
end;
finally
inifile.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if (JvBrowseForFolderDialog1.Execute) then
begin
Edit1.Text := JvBrowseForFolderDialog1.Directory;
end;
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
if (DirectoryExists(Edit1.Text)) then
begin
ListBox1.Items.BeginUpdate;

ListBox1.Items.Clear;

JvSearchFiles1.RootDirectory := Edit1.Text;

JvSearchFiles1.Search;

ListBox1.Items.EndUpdate;
end
else
ListBox1.Items.Clear;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Edit2.Enabled := CheckBox1.Checked;
UpDown1.Enabled := CheckBox1.Checked;
ComboBox1.Enabled := CheckBox1.Checked;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
dt1, dt2: TDateTime;
begin

dt1 := StrToDateTime('25/10/2004 03:30:00 p.m.'); //buscar última fecha de cambio
dt2 := Now;

case ComboBox1.ItemIndex of
0: //si está puesto por horas...
begin
if (DateUtils.HoursBetween(dt2,dt1) >= StrToInt(Edit2.Text)) then //comparar horas
begin
CambiarFondo;
end;
end;
1: //si está puesto por días...
begin
if (DateUtils.DaysBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
2: //si está puesto por semanas...
begin
if (DateUtils.WeeksBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
3: //si está puesto por meses...
begin
if (DateUtils.MonthsBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
end;

end;

procedure TForm1.CambiarFondo;
begin

SystemParametersInfo(SPI_SETDESKWALLPAPER,0,PChar('C:\logo.bmp'),SPIF_UPDATEINIFILE);

end;

procedure TForm1.JvSearchFiles1FindFile(Sender: TObject;
const AName: String);
begin
ListBox1.Items.Add( ExtractFileName(AName) );
end;

procedure TForm1.Convertir;//Form1 es el nombre del formulario
var
MyJPEG : TJPEGImage;
MyBMP : TBitmap;
begin
MyJPEG := TJPEGImage.Create;
with MyJPEG do
begin
LoadFromFile( edit1.text + ListBox1.items.strings[ListBox1.Itemindex]);//logo es la imagen JPG
MyBMP := TBitmap.Create;
with MyBMP do
begin
Width := MyJPEG.Width;
Height := MyJPEG.Height;
Canvas.Draw(0,0,MyJPEG);
SaveToFile('C:\logo.bmp');//La imagen a guardar.
Free;
end;
Free;
end;
end;

end.
Responder Con Cita
  #3  
Antiguo 09-11-2004
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.070
Poder: 32
jhonny Va camino a la famajhonny Va camino a la fama
Desafortunamdamente no tengo mucho tiempo ahora para analizar el codigo y menos si no se ve muy claro... te recomiendo usar las etiquetas nuevas [delphi] para que se vea todo mejor...


Por el momento solo decirte que el error esta en que no haz puesto el encabezado del procedure, debes hacerlo en el private o el public, o alguno de esos, segun te convenga.

Bye.
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #4  
Antiguo 09-11-2004
dagsoft dagsoft is offline
Miembro
 
Registrado: nov 2004
Posts: 10
Poder: 0
dagsoft Va por buen camino
Question Ok Te Renvio El Codigo

Che te reenvio el codigo con la etiqueta DELPHI, por favor visame el codigo y mandame los errores que puedas corregir

Código Delphi [-]
unit Unit1;
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,
IniFiles, ThemeMgr, ComCtrls, ExtCtrls, DateUtils, JvSearchFiles,
JvComponent, JvBaseDlg, JvBrowseFolder;
 
type
TForm1 = class(TForm)
JvBrowseForFolderDialog1: TJvBrowseForFolderDialog;
JvSearchFiles1: TJvSearchFiles;
ThemeManager1: TThemeManager;
GroupBox1: TGroupBox;
Edit1: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
ListBox1: TListBox;
GroupBox3: TGroupBox;
Edit2: TEdit;
UpDown1: TUpDown;
ComboBox1: TComboBox;
CheckBox1: TCheckBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure CheckBox1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure JvSearchFiles1FindFile(Sender: TObject; const AName: String);
private
{ Private declarations }
procedure CambiarFondo;
public
{ Public declarations }
end;
 
var
Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
var
inifile: TIniFile;
stemp: string;
begin
inifile := TIniFile.Create( ChangeFileExt(Application.ExeName,'.ini') );
try
stemp := inifile.ReadString('preferences','dir','');
 
if (stemp <> '') then
begin
Edit1.Text := stemp;
JvBrowseForFolderDialog1.Directory := stemp;
end;
 
ListBox1.ItemIndex := inifile.ReadInteger('preferences','idx',-1);
 
finally
inifile.Free;
end;
end;
 
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
inifile: TIniFile;
begin
inifile := TIniFile.Create( ChangeFileExt(Application.ExeName,'.ini') );
try
inifile.WriteString('preferences','dir',Edit1.Text);
 
 
 
if (ListBox1.ItemIndex <> -1) then
begin
inifile.WriteInteger('preferences','idx',ListBox1.ItemIndex);
end;
finally
inifile.Free;
end;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
if (JvBrowseForFolderDialog1.Execute) then
begin
Edit1.Text := JvBrowseForFolderDialog1.Directory;
end;
end;
 
procedure TForm1.Edit1Change(Sender: TObject);
begin
if (DirectoryExists(Edit1.Text)) then
begin
ListBox1.Items.BeginUpdate;
 
ListBox1.Items.Clear;
 
JvSearchFiles1.RootDirectory := Edit1.Text;
 
JvSearchFiles1.Search;
 
ListBox1.Items.EndUpdate;
end
else
ListBox1.Items.Clear;
end;
 
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Edit2.Enabled := CheckBox1.Checked;
UpDown1.Enabled := CheckBox1.Checked;
ComboBox1.Enabled := CheckBox1.Checked;
end;
 
procedure TForm1.Button2Click(Sender: TObject);
var
dt1, dt2: TDateTime;
begin
 
dt1 := StrToDateTime('25/10/2004 03:30:00 p.m.'); //buscar última fecha de cambio
dt2 := Now;
 
case ComboBox1.ItemIndex of
0: //si está puesto por horas...
begin
if (DateUtils.HoursBetween(dt2,dt1) >= StrToInt(Edit2.Text)) then //comparar horas
begin
CambiarFondo;
end;
end;
1: //si está puesto por días...
begin
if (DateUtils.DaysBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
2: //si está puesto por semanas...
begin
if (DateUtils.WeeksBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
3: //si está puesto por meses...
begin
if (DateUtils.MonthsBetween(dt1,dt2) >= StrToInt(Edit2.Text)) then
begin
CambiarFondo;
end;
end;
end;
 
end;
 
procedure TForm1.CambiarFondo;
begin
 
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,PChar('C:\logo.bmp'),SPIF_UPDATEINIFILE);
 
end;
 
procedure TForm1.JvSearchFiles1FindFile(Sender: TObject;
const AName: String);
begin
ListBox1.Items.Add( ExtractFileName(AName) );
end;
 
procedure TForm1.Convertir;//Form1 es el nombre del formulario
var
MyJPEG : TJPEGImage;
MyBMP : TBitmap;
begin
MyJPEG := TJPEGImage.Create;
with MyJPEG do
begin
LoadFromFile( edit1.text + ListBox1.items.strings[ListBox1.Itemindex]);//logo es la imagen JPG
MyBMP := TBitmap.Create;
with MyBMP do
begin
Width := MyJPEG.Width;
Height := MyJPEG.Height;
Canvas.Draw(0,0,MyJPEG);
SaveToFile('C:\logo.bmp');//La imagen a guardar.
Free;
end;
Free;
end;
end;
 
end

Saludos Daniel
nos vemos muchas gracias desde ya

Última edición por jhonny fecha: 10-11-2004 a las 19:41:28.
Responder Con Cita
  #5  
Antiguo 10-11-2004
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.070
Poder: 32
jhonny Va camino a la famajhonny Va camino a la fama
Bueno, me he tomado el atrevimiento de editar el POST porque la etiqueta delphi estaba mal puesta y el post seguia viendose mal. (aunque aun sigue viendose algo mal).

Una recomendacion compañero: No escribas en mayusculas, la verdad esque hace que el texto sea dificil de leer, y tampoco utilices eso de "gRaCiaS" y esas cosas...(eso fue otra cosa que edite en tu POST).

En resumen por favor leete la Guia de estilo http://www.clubdelphi.com/foros/guiaestilo.php

Otra recomendación, aca en el foro hacemos todo lo posible por ayudar a las personas y de hecho ya te he dado la solución.

Lee bien, y haz el esfuercito

Espero me entiendas y no me mal interpretes.
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #6  
Antiguo 11-11-2004
dagsoft dagsoft is offline
Miembro
 
Registrado: nov 2004
Posts: 10
Poder: 0
dagsoft Va por buen camino
Thumbs up Gracias

MUchas gracias amigo

Saludos Daniel
te entinedo bien
ByE
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 00:09:30.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi