First commit 01/10/1999
BIN
017OCT.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
018OCT.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
144
CTapiz.bpr
Normal file
@ -0,0 +1,144 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
VERSION = BCB.03
|
||||
# ---------------------------------------------------------------------------
|
||||
!ifndef BCB
|
||||
BCB = $(MAKEDIR)\..
|
||||
!endif
|
||||
# ---------------------------------------------------------------------------
|
||||
PROJECT = CTapiz.exe
|
||||
OBJFILES = CTapiz.obj CTapiz_mm.obj
|
||||
RESFILES = CTapiz.res
|
||||
RESDEPEN = $(RESFILES) CTapiz_mm.dfm
|
||||
LIBFILES =
|
||||
LIBRARIES = JD_soft.lib CDopping.lib INET35.lib QRPT35.lib vcldbx35.lib vcldb35.lib \
|
||||
vclx35.lib vcl35.lib
|
||||
SPARELIBS = vcl35.lib vclx35.lib vcldb35.lib vcldbx35.lib QRPT35.lib INET35.lib \
|
||||
CDopping.lib JD_soft.lib
|
||||
PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi QRPT35.bpi
|
||||
PATHASM = .;
|
||||
PATHCPP = .;
|
||||
PATHPAS = .;
|
||||
PATHRC = .;
|
||||
DEBUGLIBPATH = $(BCB)\lib\debug
|
||||
RELEASELIBPATH = $(BCB)\lib\release
|
||||
DEFFILE =
|
||||
# ---------------------------------------------------------------------------
|
||||
CFLAG1 = -Od -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx
|
||||
CFLAG2 = -I..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;"..\jd soft\jd";$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft" \
|
||||
-H=$(BCB)\lib\vcld.csm
|
||||
CFLAG3 = -5
|
||||
PFLAGS = -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE \
|
||||
-U..\componentes;..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;"..\jd soft\jd";$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;"L:\Programación (-CBuilder-)\Jd Soft";$(RELEASELIBPATH) \
|
||||
-I..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;"..\jd soft\jd";$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft" \
|
||||
-H -$Y -$W -$O- -v -JPHNV -M
|
||||
RFLAGS = -i..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;"..\jd soft\jd";$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft"
|
||||
AFLAGS = /i..\componentes\cdopping\jpg3s /ij:\cbuilder3\projects /i"..\jd soft\jd" \
|
||||
/i$(BCB)\bin /i$(BCB)\objrepos /i$(BCB)\projects /i$(BCB)\include \
|
||||
/i$(BCB)\include\vcl /i"L:\Programación (-CBuilder-)\Jd Soft" /mx /w2 /zi
|
||||
LFLAGS = -L..\componentes;..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;"..\jd soft\jd";$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;"L:\Programación (-CBuilder-)\Jd Soft";$(RELEASELIBPATH) \
|
||||
-aa -Tpe -x -v
|
||||
IFLAGS = -g
|
||||
LINKER = ilink32
|
||||
# ---------------------------------------------------------------------------
|
||||
ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES)
|
||||
ALLRES = $(RESFILES)
|
||||
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib
|
||||
# ---------------------------------------------------------------------------
|
||||
.autodepend
|
||||
|
||||
!ifdef IDEOPTIONS
|
||||
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=1
|
||||
MajorVer=2
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=54
|
||||
Debug=0
|
||||
PreRelease=1
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=JD soft.
|
||||
FileDescription=Selector aleatorio de tapiz
|
||||
FileVersion=2.0.0.54
|
||||
InternalName=CTapiz
|
||||
LegalCopyright=Copyright (C) JD soft. 1990-1998
|
||||
LegalTrademarks=JD soft.
|
||||
OriginalFilename=CTapiz
|
||||
ProductName=Cambiador de Tapiz
|
||||
ProductVersion=2.0.0.0
|
||||
Comments=e-mail: Jose-David.Guillen@cs.us.es
|
||||
|
||||
[Excluded Packages]
|
||||
j:\CBuilder3\Bin\dcldb35.bpl=Borland Database Components
|
||||
j:\CBuilder3\Bin\dcl31w35.bpl=Borland 1.0 Compatibility Components
|
||||
C:\WIN98\SYSTEM\bcbsmp35.bpl=Borland C++ Sample Components
|
||||
C:\WIN98\SYSTEM\dclocx35.bpl=Borland Sample Imported ActiveX Controls
|
||||
j:\CBuilder3\Bin\dclqrt35.bpl=Borland QuickReport Components
|
||||
j:\CBuilder3\Bin\rcexpert.bpl=Borland Resource Expert
|
||||
j:\CBuilder3\Bin\dcltee35.bpl=Borland TeeChart Components
|
||||
C:\WIN98\SYSTEM\ibsmp35.bpl=Borland C++ InterBase Alerter Component
|
||||
j:\CBuilder3\Bin\dclint35.bpl=Borland International Tools
|
||||
j:\CBuilder3\Bin\dclnet35.bpl=Borland Internet Components
|
||||
C:\WIN98\SYSTEM\NMFAST35.BPL=NetMasters Fastnet Tools
|
||||
L:\Programación (-CBuilder-)\Componentes\CDopping.bpl=L:\Programación (-CBuilder-)\Componentes\CDopping
|
||||
L:\Programación (-CBuilder-)\Componentes\CDopping\QSElFrm.bpl=D:\CompsCPP 3\QSElFrm
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=4
|
||||
Item0=..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Jd Soft
|
||||
Item1=..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item2=j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item3=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=4
|
||||
Item0=..\componentes;..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;L:\Programación (-CBuilder-)\Jd Soft
|
||||
Item1=..\componentes\cdopping\jpg3s;j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item2=j:\cbuilder3\projects;..\jd soft\jd;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item3=..\jd soft\jd;l:\programación (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlUnitAliases]
|
||||
Count=1
|
||||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
|
||||
!endif
|
||||
|
||||
$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
|
||||
$(BCB)\BIN\$(LINKER) @&&!
|
||||
$(LFLAGS) +
|
||||
$(ALLOBJ), +
|
||||
$(PROJECT),, +
|
||||
$(ALLLIB), +
|
||||
$(DEFFILE), +
|
||||
$(ALLRES)
|
||||
!
|
||||
|
||||
.pas.hpp:
|
||||
$(BCB)\BIN\dcc32 $(PFLAGS) { $** }
|
||||
|
||||
.pas.obj:
|
||||
$(BCB)\BIN\dcc32 $(PFLAGS) { $** }
|
||||
|
||||
.cpp.obj:
|
||||
$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $*
|
||||
|
||||
.c.obj:
|
||||
$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $**
|
||||
|
||||
.rc.res:
|
||||
$(BCB)\BIN\brcc32 $(RFLAGS) $<
|
||||
#-----------------------------------------------------------------------------
|
29
CTapiz.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <registry.hpp>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
USERES("CTapiz.res");
|
||||
USEFORM("CTapiz_mm.cpp", CTapiz);
|
||||
HINSTANCE g_hinst;
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
g_hinst = hInstance;
|
||||
Application->Title = "CambiarTapiz!";
|
||||
Application->CreateForm(__classid(TCTapiz), &CTapiz);
|
||||
Application->ShowMainForm = false;
|
||||
|
||||
if ( AnsiString( lpCmdLine ).IsEmpty() )
|
||||
Application->Run();
|
||||
}
|
||||
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
CTapiz.exe
Normal file
BIN
CTapiz.res
Normal file
464
CTapiz_mm.cpp
Normal file
@ -0,0 +1,464 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <registry.hpp>
|
||||
#include <winuser.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CTapiz_mm.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "mwajpeg"
|
||||
#pragma resource "*.dfm"
|
||||
TCTapiz *CTapiz;
|
||||
//---------------------------------------------------------------------------
|
||||
#define GetCurrentDir ExtractFileDir(Application->ExeName)
|
||||
|
||||
|
||||
__fastcall TCTapiz::TCTapiz(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
WallPaper_Toolbar = true;
|
||||
|
||||
TrayMessage(NIM_ADD);
|
||||
TrayMessage(NIM_MODIFY);
|
||||
|
||||
AllowExit = false;
|
||||
|
||||
RefreshYescoge(0);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
AnsiString TCTapiz::EligeBitmap( AnsiString iPath )
|
||||
{
|
||||
AnsiString NombreImagen, Path;
|
||||
|
||||
|
||||
if ( WallPaper_Toolbar )
|
||||
Path = iPath;
|
||||
else
|
||||
Path = iPath + "\\Toolbar";
|
||||
|
||||
|
||||
EligeBitmapR( Path + "\\*.jpg" );
|
||||
EligeBitmapR( Path + "\\*.bmp" );
|
||||
// EligeBitmapR( Path + "\\*.gif" );
|
||||
|
||||
randomize();
|
||||
if( ListBox1 -> Items -> Count > 0 )
|
||||
{
|
||||
ListBox1->ItemIndex = rand() % ( ListBox1->Items->Count );
|
||||
NombreImagen = ListBox1->Items->Strings[ListBox1->ItemIndex];
|
||||
return (Path + "\\" + NombreImagen);
|
||||
} else
|
||||
return AnsiString("");
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void TCTapiz::EligeBitmapR( AnsiString PathC )
|
||||
{
|
||||
TSearchRec sr;
|
||||
int iAttributes = 0xFF;
|
||||
|
||||
if (FindFirst( PathC, iAttributes, sr) == 0)
|
||||
{
|
||||
if (sr.Attr & iAttributes)
|
||||
ListBox1 -> Items ->Add( sr.Name );
|
||||
|
||||
while (FindNext(sr) == 0)
|
||||
if (sr.Attr & iAttributes)
|
||||
ListBox1 -> Items ->Add( sr.Name );
|
||||
}
|
||||
|
||||
FindClose(sr);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void TCTapiz::PonTapiz( AnsiString Tapiz )
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
AnsiString bStyle;
|
||||
|
||||
bStyle = EligeStylo( Tapiz );
|
||||
|
||||
try {
|
||||
Registro -> OpenKey( "\\Control Panel\\Desktop", false );
|
||||
Registro -> WriteString( "Wallpaper", Tapiz );
|
||||
Registro -> WriteString( "TileWallpaper", (bStyle == "2") ? "0" : "1" );
|
||||
Registro -> WriteString( "WallpaperStyle", bStyle );
|
||||
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, Tapiz.c_str(), SPIF_UPDATEINIFILE );
|
||||
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, Tapiz.c_str(), 0 );
|
||||
}catch(...){
|
||||
//do nothing
|
||||
}
|
||||
delete Registro;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
AnsiString TCTapiz::EligeStylo( AnsiString IMG )
|
||||
{
|
||||
AnsiString dev;
|
||||
dev = "0";
|
||||
|
||||
if ( Image1->Picture->Width >= 600 && Image1->Picture->Height >= 400 ) dev = "2";
|
||||
|
||||
return dev;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::ListBox1DblClick(TObject *Sender)
|
||||
{
|
||||
if ( !WallPaper_Toolbar && !SwapActive->Checked ) return;
|
||||
|
||||
AnsiString Tapiz, Where;
|
||||
Tapiz = GetCurrentDir + "\\";
|
||||
|
||||
AnsiString NImage;
|
||||
|
||||
if ( WallPaper_Toolbar )
|
||||
{
|
||||
Where = "";
|
||||
NImage = "ctapiz_JPG2BMP.bmp";
|
||||
} else {
|
||||
char name[13];
|
||||
tmpnam(name);
|
||||
|
||||
Where = "ToolBar\\";
|
||||
NImage = AnsiString( name ) + "_ctapiz_JPG2BMP.bmp";
|
||||
}
|
||||
|
||||
// Si es un JPEG lo convertimos a BMP
|
||||
if ( (ListBox1->Items->Strings[ ListBox1 -> ItemIndex ].UpperCase()).AnsiPos( ".BMP" ) == 0 )
|
||||
{
|
||||
Image1->Picture->SaveToFile( Where + NImage );
|
||||
Tapiz += ( Where + NImage );
|
||||
} else
|
||||
Tapiz += (Where + ListBox1 -> Items -> Strings[ ListBox1 -> ItemIndex ]);
|
||||
|
||||
if ( WallPaper_Toolbar )
|
||||
PonTapiz( Tapiz );
|
||||
else
|
||||
PonToolBar( Tapiz );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCTapiz::ListBox1KeyPress(TObject *Sender, char &Key)
|
||||
{
|
||||
if ( Key == VK_RETURN )
|
||||
ListBox1DblClick( 0 );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::ListBox1Click(TObject *Sender)
|
||||
{
|
||||
// Cargamos la imagen
|
||||
if ( WallPaper_Toolbar )
|
||||
Image1->Picture->LoadFromFile( ListBox1 -> Items -> Strings[ ListBox1 -> ItemIndex ] );
|
||||
else
|
||||
Image1->Picture->LoadFromFile( "ToolBar\\"+ListBox1 -> Items -> Strings[ ListBox1 -> ItemIndex ] );
|
||||
|
||||
Image1->Top = 0;
|
||||
Image1->Left = 140;
|
||||
// Vemos si es mayor que el recuadro que la contiene...
|
||||
if ( Image1->Picture->Height > 200 || Image1->Picture->Width > 200 )
|
||||
{
|
||||
// Reescalamos en ese caso
|
||||
if ( Image1->Picture->Height > Image1->Picture->Width )
|
||||
{
|
||||
Image1->Height = 200;
|
||||
Image1->Width = (Image1->Picture->Width * 200 ) / Image1->Picture->Height;
|
||||
Image1->Left += ( 200 - Image1->Width ) / 2;
|
||||
} else {
|
||||
Image1->Width = 200;
|
||||
Image1->Height = (Image1->Picture->Height * 200 ) / Image1->Picture->Width;
|
||||
Image1->Top = ( 200 - Image1->Height ) / 2;
|
||||
}
|
||||
} else {
|
||||
Image1->Height = 200;
|
||||
Image1->Width = 200;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::FormDestroy(TObject *Sender)
|
||||
{
|
||||
TrayMessage(NIM_DELETE);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::DrawItem(TMessage& Msg)
|
||||
{
|
||||
IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
|
||||
TForm::Dispatch(&Msg);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::MyNotify(TMessage& Msg)
|
||||
{
|
||||
POINT MousePos;
|
||||
|
||||
switch(Msg.LParam)
|
||||
{
|
||||
case WM_RBUTTONUP:
|
||||
if ( GetCursorPos(&MousePos) )
|
||||
{
|
||||
PopupMenu1->PopupComponent = CTapiz;
|
||||
SetForegroundWindow(Handle);
|
||||
PopupMenu1->Popup(MousePos.x, MousePos.y);
|
||||
PopupMenu1->PopupComponent = 0;
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
Height = 230;
|
||||
Visible = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TForm::Dispatch(&Msg);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TCTapiz::TrayMessage(DWORD dwMessage)
|
||||
{
|
||||
NOTIFYICONDATA tnd;
|
||||
PSTR pszTip;
|
||||
|
||||
pszTip = TipText();
|
||||
|
||||
tnd.cbSize = sizeof(NOTIFYICONDATA);
|
||||
tnd.hWnd = Handle;
|
||||
tnd.uID = IDC_MYICON;
|
||||
tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||
tnd.uCallbackMessage = MYWM_NOTIFY;
|
||||
|
||||
if (dwMessage == NIM_MODIFY)
|
||||
{
|
||||
tnd.hIcon = IconHandle();
|
||||
if (pszTip)
|
||||
lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
|
||||
else
|
||||
tnd.szTip[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
tnd.hIcon = NULL;
|
||||
tnd.szTip[0] = '\0';
|
||||
}
|
||||
|
||||
return (Shell_NotifyIcon(dwMessage, &tnd));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
HANDLE __fastcall TCTapiz::IconHandle(void)
|
||||
{
|
||||
return Application->Icon->Handle;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
PSTR __fastcall TCTapiz::TipText(void)
|
||||
{
|
||||
return ("CTapiz v2.1");
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
|
||||
{
|
||||
HICON hIcon;
|
||||
|
||||
hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON,
|
||||
16, 16, 0);
|
||||
if (!hIcon)
|
||||
return(FALSE);
|
||||
|
||||
DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon,
|
||||
16, 16, 0, NULL, DI_NORMAL);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
void __fastcall TCTapiz::MostarCTapiz1Click(TObject *Sender)
|
||||
{
|
||||
Height = 230;
|
||||
Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCTapiz::Cerrar1Click(TObject *Sender)
|
||||
{
|
||||
Visible = false;
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCTapiz::Configurar1Click(TObject *Sender)
|
||||
{
|
||||
Height = 290;
|
||||
Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCTapiz::CheckBox2Click(TObject *Sender)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
if ( CheckBox2->Checked )
|
||||
AllowExit = false;
|
||||
|
||||
Registro -> OpenKey( "\\Software\\JDsoft", true );
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CTapiz", true );
|
||||
Registro -> WriteBool( "AutoChange", CheckBox2->Checked );
|
||||
|
||||
Timer1->Interval = UpDown1->Position * 60 * 1000;
|
||||
Timer1->Enabled = true;
|
||||
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::CheckBox1Click(TObject *Sender)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", false );
|
||||
if ( CheckBox1->Checked )
|
||||
Registro -> WriteString( "CTapiz", Application->ExeName );
|
||||
else
|
||||
Registro -> DeleteValue( "CTapiz" );
|
||||
}catch(...){
|
||||
//do nothing
|
||||
}
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TCTapiz::FormCloseQuery(TObject *Sender, bool &CanClose)
|
||||
{
|
||||
if ( Visible )
|
||||
{
|
||||
Visible = false;
|
||||
CanClose = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::UpDown1Changing(TObject *Sender,
|
||||
bool &AllowChange)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
Label1->Caption = UpDown1->Position;
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CTapiz", true );
|
||||
Registro -> WriteInteger( "DelayTime", UpDown1->Position );
|
||||
Timer1->Interval = UpDown1->Position * 60 * 1000;
|
||||
}catch(...){
|
||||
//do nothing
|
||||
}
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::RefreshYescoge(TObject *Sender)
|
||||
{
|
||||
ListBox1->Clear();
|
||||
if ( ! EligeBitmap( GetCurrentDir ).IsEmpty() )
|
||||
{
|
||||
ListBox1Click( 0 );
|
||||
if ( WallPaper_Toolbar )
|
||||
ListBox1DblClick( 0 );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::FormCreate(TObject *Sender)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", false );
|
||||
CheckBox1->Checked = Registro -> ValueExists( "CTapiz" );
|
||||
}catch(...){
|
||||
//do nothing
|
||||
}
|
||||
try {
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CTapiz", true );
|
||||
CheckBox2->Checked = Registro -> ReadBool( "AutoChange" );
|
||||
UpDown1->Position = Registro->ReadInteger( "DelayTime" );
|
||||
}catch(...) {
|
||||
UpDown1->Position = 15;
|
||||
}
|
||||
delete Registro;
|
||||
|
||||
Label1->Caption = UpDown1->Position;
|
||||
Timer1->Interval = UpDown1->Position * 60 * 1000;
|
||||
Timer1->Enabled = CheckBox2->Checked;
|
||||
|
||||
if ( ! CheckBox1->Checked )
|
||||
Visible = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCTapiz::SwapActiveClick(TObject *Sender)
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
Registro -> OpenKey( "\\Software\\Microsoft\\Internet Explorer\\Toolbar", true );
|
||||
|
||||
// Eliminamos la clave
|
||||
if ( ! SwapActive->Checked )
|
||||
{
|
||||
try {
|
||||
Registro -> DeleteValue( "BackBitmap" );
|
||||
} catch(...) {
|
||||
// ------
|
||||
}
|
||||
}
|
||||
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::SwapFunctionClick(TObject *Sender)
|
||||
{
|
||||
WallPaper_Toolbar = !WallPaper_Toolbar;
|
||||
if ( WallPaper_Toolbar )
|
||||
{
|
||||
SwapActive->Enabled = false;
|
||||
SwapFunction->Caption = "Barra de Herramientas";
|
||||
RefreshYescoge(0);
|
||||
} else {
|
||||
SwapActive->Enabled = true;
|
||||
SwapFunction->Caption = "Tapiz del Escritorio";
|
||||
RefreshYescoge(0);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void TCTapiz::PonToolBar( AnsiString Tapiz )
|
||||
{
|
||||
TRegistry *Registro;
|
||||
Registro = new TRegistry;
|
||||
|
||||
// Borramos la entrada antigua...
|
||||
|
||||
Registro -> OpenKey( "\\Software\\JDsoft\\CTapiz", true );
|
||||
try {
|
||||
remove( (Registro -> ReadString( "ToolBarBitmap" )).c_str() );
|
||||
} catch(...) {
|
||||
/// nothing
|
||||
}
|
||||
if ( Tapiz.Pos( "_ctapiz_JPG2BMP.bmp" ) != 0 )
|
||||
Registro -> WriteString( "ToolBarBitmap", Tapiz );
|
||||
|
||||
Registro -> OpenKey( "\\Software\\Microsoft\\Internet Explorer\\Toolbar", true );
|
||||
Registro -> WriteString( "BackBitmap", Tapiz );
|
||||
/*
|
||||
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, Tapiz.c_str(), SPIF_UPDATEINIFILE );
|
||||
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, Tapiz.c_str(), 0 );
|
||||
*/
|
||||
delete Registro;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCTapiz::Timer1Timer(TObject *Sender)
|
||||
{
|
||||
if ( ! WallPaper_Toolbar )
|
||||
{
|
||||
SwapFunctionClick(0);
|
||||
SwapFunctionClick(0);
|
||||
} else
|
||||
RefreshYescoge(0);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
CTapiz_mm.dfm
Normal file
89
CTapiz_mm.h
Normal file
@ -0,0 +1,89 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CTapiz_mmH
|
||||
#define CTapiz_mmH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "Mwajpeg.hpp"
|
||||
#include <ExtCtrls.hpp>
|
||||
#include "mwajpeg.hpp"
|
||||
#include <Menus.hpp>
|
||||
#include <ComCtrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define MYWM_NOTIFY (WM_APP+100)
|
||||
#define IDC_MYICON 1006
|
||||
extern HINSTANCE g_hinst;
|
||||
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
|
||||
//---------------------------------------------------------------------------
|
||||
class TCTapiz : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TListBox *ListBox1;
|
||||
TJPEGFileDecompressor *JPEGFileDecompressor1;
|
||||
TImage *Image1;
|
||||
TTimer *Timer1;
|
||||
TPopupMenu *PopupMenu1;
|
||||
TMenuItem *MostarCTapiz1;
|
||||
TMenuItem *Configurar1;
|
||||
TMenuItem *Cerrar1;
|
||||
TMenuItem *N1;
|
||||
TBevel *Bevel1;
|
||||
TCheckBox *CheckBox1;
|
||||
TCheckBox *CheckBox2;
|
||||
TLabel *Label1;
|
||||
TUpDown *UpDown1;
|
||||
TLabel *Label2;
|
||||
TButton *SwapFunction;
|
||||
TCheckBox *SwapActive;
|
||||
void __fastcall ListBox1DblClick(TObject *Sender);
|
||||
void __fastcall ListBox1KeyPress(TObject *Sender, char &Key);
|
||||
void __fastcall ListBox1Click(TObject *Sender);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
void __fastcall MostarCTapiz1Click(TObject *Sender);
|
||||
void __fastcall Cerrar1Click(TObject *Sender);
|
||||
void __fastcall Configurar1Click(TObject *Sender);
|
||||
void __fastcall CheckBox2Click(TObject *Sender);
|
||||
void __fastcall CheckBox1Click(TObject *Sender);
|
||||
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
|
||||
void __fastcall UpDown1Changing(TObject *Sender, bool &AllowChange);
|
||||
void __fastcall RefreshYescoge(TObject *Sender);
|
||||
|
||||
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall SwapActiveClick(TObject *Sender);
|
||||
void __fastcall SwapFunctionClick(TObject *Sender);
|
||||
void __fastcall Timer1Timer(TObject *Sender);
|
||||
private: // User declarations
|
||||
bool WallPaper_Toolbar;
|
||||
int nArchivos;
|
||||
public: // User declarations
|
||||
void PonTapiz ( AnsiString Tapiz );
|
||||
void PonToolBar ( AnsiString Tapiz );
|
||||
AnsiString EligeStylo( AnsiString IMG );
|
||||
AnsiString EligeBitmap( AnsiString iPath );
|
||||
void EligeBitmapR( AnsiString PathC );
|
||||
|
||||
__fastcall TCTapiz(TComponent* Owner);
|
||||
|
||||
|
||||
bool AllowExit;
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall DrawItem(TMessage& Msg);
|
||||
void __fastcall MyNotify(TMessage& Msg);
|
||||
bool __fastcall TrayMessage(DWORD dwMessage);
|
||||
HANDLE __fastcall IconHandle(void);
|
||||
PSTR __fastcall TipText(void);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
|
||||
MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TCTapiz *CTapiz;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
#CTapiz
|
||||
|
||||
|
||||
*01/10/1999*
|
||||
|
||||
ToDo: wwtcf?
|
||||
|
||||
|
||||

|
BIN
ToolBar/0103emodel.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
ToolBar/0103invasion.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
ToolBar/0118surf1.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
ToolBar/0119Outer.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
ctapiz_JPG2BMP.bmp
Normal file
After Width: | Height: | Size: 1.0 MiB |