//---------------------------------------------------------------------------
#ifndef AllBoxH
#define AllBoxH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "actimg.h"
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <Grids.hpp>
#include <NMMSG.hpp>
#include <Psock.hpp>
#include <NMSTRM.hpp>
#include <mmsystem.h>
#include <Graphics.hpp>
#include "CoolForm.hpp"
#include "DialUp.h"

#define MYWM_NOTIFY         (WM_APP+100)
#define IDC_MYICON                     1006
extern HINSTANCE g_hinst;
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi);
//---------------------------------------------------------------------------
class TBoxes : public TForm
{
__published:	// IDE-managed Components
    TActiveImage *ActiveImage1;
    TActiveImage *ActiveImage2;
    TActiveImage *ActiveImage3;
    TActiveImage *ActiveImage4;
    TActiveImage *ActiveImage5;
    TActiveImage *ActiveImage6;
    TActiveImage *ActiveImage7;
    TImage *imagenOn;
    TImage *imagenOFF;
    TPopupMenu *PopupMenu1;
    TMenuItem *Properties1;
    TMenuItem *Shutdown1;
    TMenuItem *N2;
    TMenuItem *Acercade1;
    TStringGrid *AllBox;
    TLabel *Label1;
    TComboBox *para;
    TButton *Enviar;
    TMemo *Mensaje;
    TLabel *Label2;
    TEdit *asunto;
    TTimer *SendNow;
    TNMMsg *OutBox;
    TNMMSGServ *InBox;
    TCoolForm *CoolForm1;
    TEdit *LineChat;
    TMemo *MiniChat;
    TNMMsg *OutChat;
    TNMMSGServ *InChat;
    TTimer *NewMessage;
        TDialUp *DialUp1;
        TLabel *FechaMsg;
    void __fastcall ActiveImage4Click(TObject *Sender);
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall Properties1Click(TObject *Sender);
    void __fastcall Acercade1Click(TObject *Sender);
    void __fastcall Shutdown1Click(TObject *Sender);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    


    void __fastcall ActiveImage2Click(TObject *Sender);
    void __fastcall ActiveImage1Click(TObject *Sender);
    void __fastcall EnviarClick(TObject *Sender);
    void __fastcall ActiveImage3Click(TObject *Sender);
    void __fastcall SendNowTimer(TObject *Sender);
    void __fastcall AllBoxDblClick(TObject *Sender);
    void __fastcall ActiveImage5Click(TObject *Sender);
    void __fastcall ActiveImage6Click(TObject *Sender);
    
    

    
    void __fastcall InBoxMSG(TComponent *Sender, const AnsiString sFrom,
          const AnsiString sMsg);
    
    void __fastcall ActiveImage7Click(TObject *Sender);
    void __fastcall LineChatKeyPress(TObject *Sender, char &Key);
    void __fastcall InChatMSG(TComponent *Sender, const AnsiString sFrom,
          const AnsiString sMsg);
    void __fastcall NewMessageTimer(TObject *Sender);
    
    void __fastcall AllBoxKeyPress(TObject *Sender, char &Key);
    void __fastcall CoolForm1MouseUp(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
        void __fastcall DialUp1ActiveConnection(TObject *Sender,
          int Handle, TRasConnStatusA &Status, AnsiString StatusString,
          AnsiString EntryName, AnsiString DeviceType,
          AnsiString DeviceName);
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);
    int Status;

    AnsiString TranslateIP[50];

    char * __fastcall scanUntil( char *text, char Terminador );
    void __fastcall LoadUserList( void );
    int NumUsers;

    TNMMsg *OutChats[20];

  TStringList *InMessage;
    
public:		// User declarations
    __fastcall TBoxes(TComponent* Owner);
    void __fastcall LeeMensajes(char *carpeta);
    void __fastcall ExtractInfo(char *filename, AnsiString Box);
    AnsiString __fastcall TranslateName( AnsiString name );
    void __fastcall EnviaMensaje( AnsiString FileName );

    int BoxActive;
    int msgI;




BEGIN_MESSAGE_MAP
    MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
    MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TBoxes *Boxes;
//---------------------------------------------------------------------------
#endif
