First commit 26/10/1998
This commit is contained in:
commit
54cafff2ff
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#Termometro
|
||||||
|
|
||||||
|
|
||||||
|
*26/10/1998*
|
||||||
|
|
||||||
|
ToDo: wwtcf?
|
||||||
|
|
||||||
|
|
||||||
|

|
138
TPropiedades.cpp
Normal file
138
TPropiedades.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <registry.hpp>
|
||||||
|
#include <vcl.h>
|
||||||
|
#pragma hdrstop
|
||||||
|
|
||||||
|
#include "TPropiedades.h"
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#pragma package(smart_init)
|
||||||
|
#pragma link "DialUp"
|
||||||
|
#pragma link "DigitNum"
|
||||||
|
#pragma resource "*.dfm"
|
||||||
|
TPropiedades *Propiedades;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
__fastcall TPropiedades::TPropiedades(TComponent* Owner)
|
||||||
|
: TForm(Owner)
|
||||||
|
{
|
||||||
|
PosHistorica = 0;
|
||||||
|
Temp = 0;
|
||||||
|
Tmin = 1000; Tmax = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
mHistorial -> Lines -> LoadFromFile("Historial.log");
|
||||||
|
}catch(...){
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
mHistorial -> Lines -> Add( TDateTime::CurrentDateTime().DateTimeString() + " Inicio de sesión ");
|
||||||
|
|
||||||
|
HCalorValues = new int [ HCalor->Width + 2 ];
|
||||||
|
for ( int i=0; i<HCalor->Width; i++ ) HCalorValues[i] = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void __fastcall TPropiedades::BorrarHistorialClick(TObject *Sender)
|
||||||
|
{
|
||||||
|
mHistorial -> Lines -> Clear();
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void __fastcall TPropiedades::FormDestroy(TObject *Sender)
|
||||||
|
{
|
||||||
|
mHistorial -> Lines -> Add( TDateTime::CurrentDateTime().DateTimeString() + " Fin de sesión ");
|
||||||
|
delete [] HCalorValues;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void __fastcall TPropiedades::mHistorialChange(TObject *Sender)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ( Historial -> Checked )
|
||||||
|
mHistorial -> Lines -> SaveToFile("Historial.log");
|
||||||
|
} catch(...) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void __fastcall TPropiedades::FormKeyPress(TObject *Sender, char &Key)
|
||||||
|
{
|
||||||
|
switch( Key )
|
||||||
|
{
|
||||||
|
case 'a':
|
||||||
|
Temp++;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
Temp--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void __fastcall TPropiedades::ProcesarCuanto(TObject *Sender)
|
||||||
|
{
|
||||||
|
int shTemp;
|
||||||
|
|
||||||
|
shTemp = Temp >= HCalor->Height ? HCalor->Height : Temp;
|
||||||
|
shTemp = shTemp <= 0 ? 0 : shTemp;
|
||||||
|
shTemp *= 2;
|
||||||
|
|
||||||
|
// Borrado de la linea a imprimir
|
||||||
|
HCalor -> Canvas -> MoveTo ( PosHistorica, 0 );
|
||||||
|
HCalor -> Canvas -> LineTo ( PosHistorica, HCalor->Height);
|
||||||
|
|
||||||
|
PosHistorica++;
|
||||||
|
if ( PosHistorica > HCalor->Width ) PosHistorica = 0;
|
||||||
|
|
||||||
|
// Linea de calor
|
||||||
|
HCalorValues[PosHistorica] = shTemp;
|
||||||
|
PintaLinea( PosHistorica, shTemp );
|
||||||
|
|
||||||
|
// Linea indicación de estado
|
||||||
|
HCalor -> Canvas -> Pen -> Mode = pmXor;
|
||||||
|
HCalor -> Canvas -> Pen -> Color = clGreen;
|
||||||
|
HCalor -> Canvas -> MoveTo ( PosHistorica, 0 );
|
||||||
|
HCalor -> Canvas -> LineTo ( PosHistorica, HCalor->Height );
|
||||||
|
|
||||||
|
|
||||||
|
// Calculo de minimos y maximos
|
||||||
|
Tmin = Temp < Tmin ? Temp : Tmin;
|
||||||
|
Tmax = Temp > Tmax ? Temp : Tmax;
|
||||||
|
StatusBar1->Panels->Items[0]->Text = Format( "Min. %02d --- Max. %02d", ARRAYOFCONST(((int)Tmin, (int)Tmax)));
|
||||||
|
DigitNum1 -> Value = Temp;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TPropiedades::HCalorPaint(TObject *Sender)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
// Redibujamos el contenido del histograma...
|
||||||
|
for ( i=0; i<HCalor->Width; i++ )
|
||||||
|
PintaLinea( i, HCalorValues[i] );
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TPropiedades::PintaLinea(int x, int y)
|
||||||
|
{
|
||||||
|
int i, maxi;
|
||||||
|
HCalor -> Canvas -> Pen -> Mode = pmCopy;
|
||||||
|
/*
|
||||||
|
maxi = max( (HCalor->Height-(HCalor->Height/3)), (HCalor->Height-y) );
|
||||||
|
for ( i=HCalor->Height; i>maxi && i != 0; i-- )
|
||||||
|
{
|
||||||
|
HCalor -> Canvas -> Pixels[x][i] = (Graphics::TColor)( ( ( i * 0xFF ) / HCalor->Height )<<16);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
for ( i=HCalor->Height; i>(HCalor->Height-y) && i != 0; i-- )
|
||||||
|
{
|
||||||
|
HCalor -> Canvas -> Pixels[x][i] = (Graphics::TColor)(0xFF - (( i * 0xFF ) / HCalor->Height ));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
HCalor -> Canvas -> Pen -> Color = clRed;
|
||||||
|
HCalor -> Canvas -> MoveTo ( x, HCalor->Height );
|
||||||
|
HCalor -> Canvas -> LineTo ( x, HCalor->Height - y );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
BIN
TPropiedades.dfm
Normal file
BIN
TPropiedades.dfm
Normal file
Binary file not shown.
52
TPropiedades.h
Normal file
52
TPropiedades.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#ifndef TPropiedadesH
|
||||||
|
#define TPropiedadesH
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <Classes.hpp>
|
||||||
|
#include <Controls.hpp>
|
||||||
|
#include <StdCtrls.hpp>
|
||||||
|
#include <Forms.hpp>
|
||||||
|
#include <ComCtrls.hpp>
|
||||||
|
#include <ExtCtrls.hpp>
|
||||||
|
#include <Buttons.hpp>
|
||||||
|
#include "DigitNum.h"
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
class TPropiedades : public TForm
|
||||||
|
{
|
||||||
|
__published: // IDE-managed Components
|
||||||
|
TSpeedButton *BorrarHistorial;
|
||||||
|
TPageControl *PageControl1;
|
||||||
|
TTabSheet *TabSheet1;
|
||||||
|
TTabSheet *TabSheet2;
|
||||||
|
TTabSheet *TabSheet3;
|
||||||
|
TStatusBar *StatusBar1;
|
||||||
|
TBevel *Bevel4;
|
||||||
|
TDigitNum *DigitNum1;
|
||||||
|
TPaintBox *HCalor;
|
||||||
|
TTimer *Cuanto;
|
||||||
|
TMemo *mHistorial;
|
||||||
|
TCheckBox *Historial;
|
||||||
|
TButton *bAceptar;
|
||||||
|
TButton *bCancelar;
|
||||||
|
TButton *bAplicar;
|
||||||
|
|
||||||
|
void __fastcall BorrarHistorialClick(TObject *Sender);
|
||||||
|
void __fastcall FormDestroy(TObject *Sender);
|
||||||
|
void __fastcall mHistorialChange(TObject *Sender);
|
||||||
|
|
||||||
|
void __fastcall FormKeyPress(TObject *Sender, char &Key);
|
||||||
|
void __fastcall ProcesarCuanto(TObject *Sender);
|
||||||
|
void __fastcall HCalorPaint(TObject *Sender);
|
||||||
|
private: // User declarations
|
||||||
|
int PosHistorica;
|
||||||
|
int Temp, Tmin, Tmax;
|
||||||
|
int *HCalorValues;
|
||||||
|
public: // User declarations
|
||||||
|
__fastcall TPropiedades(TComponent* Owner);
|
||||||
|
void __fastcall PintaLinea(int x, int y);
|
||||||
|
|
||||||
|
};
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
extern PACKAGE TPropiedades *Propiedades;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#endif
|
130
trayicon.bpr
Normal file
130
trayicon.bpr
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
VERSION = BCB.03
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
!ifndef BCB
|
||||||
|
BCB = $(MAKEDIR)\..
|
||||||
|
!endif
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
PROJECT = trayicon.exe
|
||||||
|
OBJFILES = trayicon.obj traymain.obj TPropiedades.obj
|
||||||
|
RESFILES = trayicon.res
|
||||||
|
RESDEPEN = $(RESFILES) traymain.dfm TPropiedades.dfm
|
||||||
|
LIBFILES =
|
||||||
|
LIBRARIES = JDsoft.lib CDopping.lib DCLUSR35.lib vclx35.lib VCLSMP35.lib VCL35.lib
|
||||||
|
SPARELIBS = VCL35.lib VCLSMP35.lib vclx35.lib DCLUSR35.lib CDopping.lib JDsoft.lib
|
||||||
|
DEFFILE =
|
||||||
|
PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi bcbsmp35.bpi dclocx35.bpi \
|
||||||
|
QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi ibsmp35.bpi NMFAST35.bpi \
|
||||||
|
INETDB35.bpi INET35.bpi JDsoft.bpi
|
||||||
|
PATHASM = .;
|
||||||
|
PATHCPP = .;
|
||||||
|
PATHPAS = .;
|
||||||
|
PATHRC = .;
|
||||||
|
DEBUGLIBPATH = $(BCB)\lib\debug
|
||||||
|
RELEASELIBPATH = $(BCB)\lib\release
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
CFLAG1 = -Od -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx
|
||||||
|
CFLAG2 = -I"..\jd soft\jd";$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft\" \
|
||||||
|
-H=$(BCB)\lib\vcld.csm
|
||||||
|
CFLAG3 =
|
||||||
|
PFLAGS = -U"..\jd soft\jd";..\componentes;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) \
|
||||||
|
-I"..\jd soft\jd";$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft\" \
|
||||||
|
-v -JPHNV -M
|
||||||
|
RFLAGS = -i"..\jd soft\jd";$(BCB)\include;$(BCB)\include\vcl;"L:\Programación (-CBuilder-)\Jd Soft\"
|
||||||
|
AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /i"L:\Programación (-CBuilder-)\Jd Soft\" \
|
||||||
|
/mx /w0 /zd
|
||||||
|
LFLAGS = -L"..\jd soft\jd";..\componentes;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) -aa \
|
||||||
|
-Tpe -x -v
|
||||||
|
IFLAGS =
|
||||||
|
|
||||||
|
!if !$d(BCC32)
|
||||||
|
BCC32 = bcc32
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if !$d(DCC32)
|
||||||
|
DCC32 = dcc32
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if !$d(LINKER)
|
||||||
|
LINKER = ilink32
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if !$d(BRCC32)
|
||||||
|
BRCC32 = brcc32
|
||||||
|
!endif
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES)
|
||||||
|
ALLRES = $(RESFILES)
|
||||||
|
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
.autodepend
|
||||||
|
|
||||||
|
!if $d(IDEOPTIONS)
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifdef IDEOPTIONS
|
||||||
|
|
||||||
|
[Version Info]
|
||||||
|
IncludeVerInfo=1
|
||||||
|
AutoIncBuild=1
|
||||||
|
MajorVer=1
|
||||||
|
MinorVer=0
|
||||||
|
Release=0
|
||||||
|
Build=50
|
||||||
|
Debug=0
|
||||||
|
PreRelease=0
|
||||||
|
Special=0
|
||||||
|
Private=0
|
||||||
|
DLL=0
|
||||||
|
Locale=3082
|
||||||
|
CodePage=1252
|
||||||
|
|
||||||
|
[Version Info Keys]
|
||||||
|
FileVersion=1.0.0.50
|
||||||
|
|
||||||
|
[HistoryLists\hlIncludePath]
|
||||||
|
Count=4
|
||||||
|
Item0=$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Jd Soft\
|
||||||
|
Item1=$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Jd SoftItem1=$(BCB)\include;$(BCB)\include\vcl;L:\Programación (-CBuilder-)\Jd SoftItem1=$(BCB)\include;$(BCB)\include\vcl
|
||||||
|
Item2=
|
||||||
|
Item3=
|
||||||
|
|
||||||
|
[HistoryLists\hlLibraryPath]
|
||||||
|
Count=1
|
||||||
|
Item0=$(BCB)\lib\obj;$(BCB)\lib
|
||||||
|
|
||||||
|
[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) $<
|
||||||
|
# ---------------------------------------------------------------------------
|
25
trayicon.cpp
Normal file
25
trayicon.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//Borland C++Builder
|
||||||
|
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <vcl.h>
|
||||||
|
#pragma hdrstop
|
||||||
|
HINSTANCE g_hinst;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
USEFORM("traymain.cpp", TrayMainForm);
|
||||||
|
USERES("trayicon.res");
|
||||||
|
USEFORM("TPropiedades.cpp", Propiedades);
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
WINAPI WinMain(HINSTANCE, HINSTANCE hInstance, LPSTR, int)
|
||||||
|
{
|
||||||
|
Application->Initialize();
|
||||||
|
g_hinst = hInstance;
|
||||||
|
Application->CreateForm(__classid(TTrayMainForm), &TrayMainForm);
|
||||||
|
Application->CreateForm(__classid(TPropiedades), &Propiedades);
|
||||||
|
Application->ShowMainForm = false;
|
||||||
|
Application->Run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
BIN
trayicon.exe
Normal file
BIN
trayicon.exe
Normal file
Binary file not shown.
BIN
trayicon.res
Normal file
BIN
trayicon.res
Normal file
Binary file not shown.
165
traymain.cpp
Normal file
165
traymain.cpp
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//Borland C++Builder
|
||||||
|
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <vcl.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
#include <registry.hpp>
|
||||||
|
#pragma hdrstop
|
||||||
|
|
||||||
|
#include "traymain.h"
|
||||||
|
#include "TPropiedades.h"
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#pragma resource "*.dfm"
|
||||||
|
TTrayMainForm *TrayMainForm;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
__fastcall TTrayMainForm::TTrayMainForm(TComponent* Owner)
|
||||||
|
: TForm(Owner)
|
||||||
|
{
|
||||||
|
Running = true;
|
||||||
|
TrayMessage(NIM_ADD);
|
||||||
|
TrayMessage(NIM_MODIFY);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::DrawItem(TMessage& Msg)
|
||||||
|
{
|
||||||
|
IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
|
||||||
|
TForm::Dispatch(&Msg);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::MyNotify(TMessage& Msg)
|
||||||
|
{
|
||||||
|
POINT MousePos;
|
||||||
|
|
||||||
|
switch(Msg.LParam)
|
||||||
|
{
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
if ( GetCursorPos(&MousePos) )
|
||||||
|
{
|
||||||
|
PopupMenu1->PopupComponent = Propiedades;
|
||||||
|
SetForegroundWindow(Handle);
|
||||||
|
PopupMenu1->Popup(MousePos.x, MousePos.y);
|
||||||
|
PopupMenu1->PopupComponent = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Show();
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
Properties1Click(0);
|
||||||
|
break;
|
||||||
|
/*
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
Properties1Click(0);
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TForm::Dispatch(&Msg);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::FormDestroy(TObject *Sender)
|
||||||
|
{
|
||||||
|
TrayMessage(NIM_DELETE);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
bool __fastcall TTrayMainForm::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 TTrayMainForm::IconHandle(void)
|
||||||
|
{
|
||||||
|
if (Running)
|
||||||
|
return imagenOn -> Picture->Icon->Handle;
|
||||||
|
else
|
||||||
|
return imagenOFF -> Picture->Icon->Handle;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::ToggleState(void)
|
||||||
|
{
|
||||||
|
Running = !Running;
|
||||||
|
TrayMessage(NIM_MODIFY);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
PSTR __fastcall TTrayMainForm::TipText(void)
|
||||||
|
{
|
||||||
|
if (Running)
|
||||||
|
return ("Lanzador de RAS's esta Activado.");
|
||||||
|
else
|
||||||
|
return ("-- DESACTIVADO --");
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
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 TTrayMainForm::Properties1Click(TObject *Sender)
|
||||||
|
{
|
||||||
|
// Show();
|
||||||
|
Propiedades -> Visible = !(Propiedades->Visible);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::ToggleState1Click(TObject *Sender)
|
||||||
|
{
|
||||||
|
ToggleState();
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TTrayMainForm::Shutdown1Click(TObject *Sender)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void __fastcall TTrayMainForm::BSalirClick(TObject *Sender)
|
||||||
|
{
|
||||||
|
Visible = false;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void __fastcall TTrayMainForm::FormCreate(TObject *Sender)
|
||||||
|
{
|
||||||
|
Visible = false;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
BIN
traymain.dfm
Normal file
BIN
traymain.dfm
Normal file
Binary file not shown.
64
traymain.h
Normal file
64
traymain.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//Borland C++Builder
|
||||||
|
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#ifndef traymainH
|
||||||
|
#define traymainH
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <Forms.hpp>
|
||||||
|
#include <StdCtrls.hpp>
|
||||||
|
#include <Controls.hpp>
|
||||||
|
#include <Classes.hpp>
|
||||||
|
#include <ExtCtrls.hpp>
|
||||||
|
#include <Menus.hpp>
|
||||||
|
#include <Buttons.hpp>
|
||||||
|
#define MYWM_NOTIFY (WM_APP+100)
|
||||||
|
#define IDC_MYICON 1006
|
||||||
|
extern HINSTANCE g_hinst;
|
||||||
|
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
class TTrayMainForm : public TForm
|
||||||
|
{
|
||||||
|
__published:
|
||||||
|
TPopupMenu *PopupMenu1;
|
||||||
|
TMenuItem *Properties1;
|
||||||
|
TMenuItem *ToggleState1;
|
||||||
|
TMenuItem *Shutdown1;
|
||||||
|
TMenuItem *N1;
|
||||||
|
TMenuItem *N2;
|
||||||
|
TMenuItem *Acercade1;
|
||||||
|
TImage *imagenOn;
|
||||||
|
TImage *imagenOFF;
|
||||||
|
TSpeedButton *BSalir;
|
||||||
|
TMenuItem *Estado1;
|
||||||
|
void __fastcall FormDestroy(TObject *Sender);
|
||||||
|
void __fastcall Properties1Click(TObject *Sender);
|
||||||
|
void __fastcall ToggleState1Click(TObject *Sender);
|
||||||
|
void __fastcall Shutdown1Click(TObject *Sender);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void __fastcall BSalirClick(TObject *Sender);
|
||||||
|
|
||||||
|
void __fastcall FormCreate(TObject *Sender);
|
||||||
|
private: // private user declarations
|
||||||
|
void __fastcall DrawItem(TMessage& Msg);
|
||||||
|
void __fastcall MyNotify(TMessage& Msg);
|
||||||
|
bool __fastcall TrayMessage(DWORD dwMessage);
|
||||||
|
HANDLE __fastcall IconHandle(void);
|
||||||
|
void __fastcall ToggleState(void);
|
||||||
|
PSTR __fastcall TipText(void);
|
||||||
|
bool Running;
|
||||||
|
public: // public user declarations
|
||||||
|
virtual __fastcall TTrayMainForm(TComponent* Owner);
|
||||||
|
BEGIN_MESSAGE_MAP
|
||||||
|
MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
|
||||||
|
MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
|
||||||
|
END_MESSAGE_MAP(TForm)
|
||||||
|
};
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
extern TTrayMainForm *TrayMainForm;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user