/*-----------------------------------------------------------------------*/
/*   FS-MTS  1.0  Ver.                                                   */
/*   Copyright (C) 2002 FIRST SAIL                                       */
/*   All Rights Reserved                                                 */
/*   Warning:                                                            */
/*       This program author is GuoHeng,this system is protected         */
/*   by copyright law and international Treaties . Unauthorized          */
/*   reproduction of  distribution of this  system, or any portion       */
/*   of it , may result in severe civil and criminal penalties ,         */
/*   and will be prosecuted to the maximum extern possible under         */
/*   the law.                                                            */
/*                                                                       */
/*   Update Date:2002-06-25                                              */
/*   Update Time:22:35:00                                                */
/*-----------------------------------------------------------------------*/

#ifndef   _MYFRAME_H__
#define   _MYFRAME_H__
/***********************************/
#include <stdlib.h>
#include <stdio.h>
#include <bios.h>
#include <io.h>
#include <conio.h>
#ifdef __BORLANDC__
        #include <graphics.h>
        #include <alloc.h>
#else
	#include <graphic_.h>
#endif
#include <dir.h>
#include <string.h>
#include <dos.h>
#include <time.h>
#include <math.h>
#include <malloc.h>

#include <Symbol.h>
#include <Mouse.h>
#include <Memory.h>
#include <Font.h>
#include <HglgPrit.h>
//#include <DownComm.h>
#include <Register.h>
#include <Listing.h>
#include <SVga_Dev.h>
#include <vbe3.h>
#include <Kernel.h>
#include <Graph.h>
#include <Socket3.h>
#include <NewMath.h>
#include <Spline.h>
#include <Print.h>

//#include <NewMath.h>
//#include <barcode.h>
//#include <Relay.h>


#define GROBAL_CHARACTER_MAX  30

        _CLASSDEF(CObject);
	_CLASSDEF(CWindow);
        _CLASSDEF(CButton);
        _CLASSDEF(CMinButton);
        _CLASSDEF(CMaxButton);
        _CLASSDEF(CCloseButton);
        _CLASSDEF(CEdit);
        _CLASSDEF(CDialog);
        _CLASSDEF(CBar);
        _CLASSDEF(CMenu);
        _CLASSDEF(CRadio);
        _CLASSDEF(CScrollBar);
        _CLASSDEF(CHScrollBar);
        _CLASSDEF(CVScrollBar);
        _CLASSDEF(CListBox);
        _CLASSDEF(CComboBox);

#ifndef CTRL_BASE
#define CTRL_BASE

#define OBJECTBASE   0001
#define LABELBASE    1001
#define EDITBASE     2001
#define LISTBASE     3001
#define COMBOBASE    4001
#define RADIOBASE    5001
#define CHECKBASE    6001
#define BUTTONBASE   7001
#define TOOLSBASE    9001
#define HSCROLLBASE  10001
#define VSCROLLBASE  20001
#define GRIDBASE     21001
#define GROUPBASE    22001
#define GRAPHBASE    23001
#define SLIDERBASE   24001
#define PROGRESSBASE 25001
#define SPINBASE     26001
#define ANIMALBASE   27001
#define MENUBASE     27101
#define BARBASE      27201

#endif

#define MESSAGE_DIALOG_EXTRA 10
#define FILEDIALOG_ATTRIB   (FA_RDONLY|FA_SYSTEM|FA_DIREC|FA_ARCH)
/***********************************/
#define NULL_SORT         (0x00000000L)
#define OBJECT_SORT       (0x00000001L            )
#define WINDOW_SORT       (0x00000002L|OBJECT_SORT)
#define DIALOG_SORT       (0x00000004L|WINDOW_SORT)
#define MESSAGE_SORT      (0x00000008L|DIALOG_SORT)
#define PASSWORD_SORT     (0x00000010L|DIALOG_SORT)
#define BUTTON_SORT       (0x00000020L|OBJECT_SORT)
#define MINBUTTON_SORT    (0x00000040L|BUTTON_SORT)
#define MAXBUTTON_SORT    (0x00000080L|BUTTON_SORT)
#define CLOSEBUTTON_SORT  (0x00000100L|BUTTON_SORT)
#define EDIT_SORT         (0x00000200L|OBJECT_SORT)
#define GRID_SORT         (0x00000400L|OBJECT_SORT)
#define BAR_SORT          (0x00000800L|OBJECT_SORT)
#define MENU_SORT         (0x00001000L|OBJECT_SORT)
#define RADIO_SORT        (0x00002000L|OBJECT_SORT)
#define LABEL_SORT        (0x00004000L|OBJECT_SORT)
#define LIST_SORT         (0x00008000L|OBJECT_SORT)
#define SCROLL_SORT       (0x00010000L|OBJECT_SORT)
#define HSCROLL_SORT      (0x00020000L|SCROLL_SORT)
#define VSCROLL_SORT      (0x00040000L|SCROLL_SORT)
#define COMBO_SORT        (0x00100000L|OBJECT_SORT)
#define SLIDER_SORT       (0x00200000L|OBJECT_SORT)
#define PROGRESS_SORT     (0x00400000L|OBJECT_SORT)
#define SPIN_SORT         (0x00800000L|OBJECT_SORT)
#define KEYBOARD_SORT     (0x01000000L|OBJECT_SORT)

/***********************************/
#define  GRID_ATTRIB_NULL  0
#define  GRID_ATTRIB_BOX   1
/***********************************/
#define  GRID_RADIO_BOX     0
#define  GRID_RADIO_RADIO   1
/***********************************/
#define BAR_ATTRIB_NORMAL     0
#define BAR_ATTRIB_DIR        1
#define BAR_ATTRIB_SEPARATOR  2
/***********************************/

/***********************************/

class  CObject
{
public:
	RECT  m_ClientRect;
	RECT  m_ScreenRect;
protected:
	int   m_nShape;
	int   m_nForeColor;
	int   m_nBackColor;
	BOOL  m_bVisible;
	BOOL  m_bSaveScreen;
	BOOL  m_bEnable;
    BOOL  m_bTab;

	char     *m_pWindowText;
protected:
	WORD     m_wShortcutKey;
	WORD     m_wID;
	HANDLE   m_hWnd;
	SORT     m_dwSort;
	DWORD	 m_dwBlock;

	CObject  *m_pParentWnd;
	CListManager m_ListManager;

	BOOL m_bPaintGround;
	int  m_nTextScale;
protected:
	BOOL  m_bMouseObjectDoWith;
	WORD  m_wReservedForObject[1];
	DWORD dwReservedForObject[3];

public:
	void  SetMouseObjectDoWith(BOOL bDoWith) {m_bMouseObjectDoWith = bDoWith;}
	BOOL  GetMouseObjectDoWth(){return(m_bMouseObjectDoWith);}

	void SetTextScale(int nScale);
	int  GetTextScale(){return (m_nTextScale);}
public:
	CListManager* GetListManager(){return(&m_ListManager);}
	int FAR  VirtualKeyboard();
	static BOOL StartControlView(struct viewporttype* pView);
	static void EndControlView(struct viewporttype* pView, BOOL bMouse);
public:
	int      GetBackColor(){return(m_nBackColor);}
	int      GetForeColor(){return(m_nForeColor);}
	int      GetShape(){return(m_nShape);}
	void     SetShape(int nShape){m_nShape=nShape;}
	void     SetCircle( int nXCircle,int nYCircle,int nRadus);
	void     SetEllipse(int nXCircle,int nYCircle,int nXRadus,int nYRadus);
	void     SetSaveScreen(BOOL bFlags){m_bSaveScreen = bFlags;}
	BOOL     GetSaveScreen(){return(m_bSaveScreen);}

	void     SetShortcutKey(WORD wKey){m_wShortcutKey=wKey;}
	WORD     GetShortcutKey(){return(m_wShortcutKey);}
	BOOL     GetVisible(){return(m_bVisible);}
	void     SetVisible(BOOL bVisible){m_bVisible=bVisible;}

	void     SetTab(BOOL bTab);//{m_bTab = bTab;}
	BOOL     GetTab(){return(m_bTab);}

	void     SetWindowText(const char FAR *pStr);
	char     FAR *GetWindowText(){return(m_pWindowText);}
protected:
	void     SetSort(SORT dwSort);//{m_dwSort=dwSort;}

	HANDLE   AddWndList(HANDLE hWnd);
	void     ClearWndList();
	HANDLE   Register();
	void     SetChildFocus(int nIndex,CObject *CObject,SORT dwSort);
	void     KillChildFocus(int nIndex,CObject *CObject,SORT dwSort);

	BOOL FAR  GetDisplayMemToXms(int,int,int,int);
	BOOL FAR  SetXmsToDisplayMem(int, int);
public:
	SORT     GetSort(){return(m_dwSort);}

	WORD     GetID(){return(m_wID);}
	void     SetID(WORD wID){m_wID=wID;}
	void     SetFc(void FAR (*pFc)(CObject*)=NULL);
	void     ClearObjectFromList(CObject* pOriObject);
	CObject* ObjectFromID(WORD wID);
public:
	BOOL      IsScreenRect(int nX,int nY);
	BOOL      IsClientRect(int nX,int nY);

	void     AddLeft(  int nAdd){m_ScreenRect.left  +=nAdd , m_ClientRect.left+=nAdd;}
	void     AddTop(   int nAdd){m_ScreenRect.top   +=nAdd , m_ClientRect.top+=nAdd;}
	void     AddRight (int nAdd){m_ScreenRect.right +=nAdd , m_ClientRect.right+=nAdd;}
	void     AddBottom(int nAdd){m_ScreenRect.bottom+=nAdd , m_ClientRect.bottom+=nAdd;}
public:
	HANDLE   CreateObject(int nX, int nY, int nWidth, int nHeight, const char FAR *pStr);
	CObject  *GetParent(){return(m_pParentWnd);}
	void     SetParent(CObject *pParentWnd){m_pParentWnd = pParentWnd;}
	HANDLE   GetSafeHwnd(){return(m_hWnd);}

    CObject*  GetSafeTopParent();
	BOOL FAR  SaveScreen();
	BOOL FAR  RestoreScreen();

	void SetEnable(BOOL bEnable);// {m_bEnable = bEnable;}
	BOOL GetEnable(){return(m_bEnable);}



    BOOL  CenterScreen();
public:
	void  GetScreenRect(RECT *pRect){*pRect = m_ScreenRect;}
	void  GetClientRect(RECT *pRect){*pRect = m_ClientRect;}

	int   GetClientWidth() {return(m_ClientRect.right  -m_ClientRect.left+1);}
	int   GetClientHeight(){return(m_ClientRect.bottom -m_ClientRect.top +1);}
	int   GetScreenWidth() {return(m_ScreenRect.right  -m_ScreenRect.left+1);}
	int   GetScreenHeight(){return(m_ScreenRect.bottom -m_ScreenRect.top +1);}
	void  SetForeColor(int nColor){m_nForeColor=nColor;}
	void  SetBackColor(int nColor){m_nBackColor=nColor;}

public:
    BOOL  IsChar(WORD wKey, BOOL bChinese);

	void  SetLocationEx(int nLeft,int nTop,int nWidth,int nHeight);
	void  SetLocation(int nLeft,int nTop,int nRight,int nBototm);

	virtual void  ModifyCoordinate();
	virtual void  AddCoordinate(int nX,int nY);
	virtual void  SetCaption(const char *);

	virtual void  KillFocus(){};
	virtual void  SetFocus(){};

	virtual void    OnDraw();
	virtual void    Paint();
	virtual BOOL    ShowFrame();

	virtual BOOL    Show();
	virtual BOOL    AntiShow();
public:
	virtual int   Swapping();
protected:
    int     DefaultSwapping();
public:
	void    ShowPlane();
	void    ShowWindowFrame();
	void    ShowDialogFrame();
	BOOL    ButtonShow();
	BOOL    SingleShow();
	BOOL    EditShow();
	BOOL    MenuShow();
	BOOL    ButtonAntiShow();
	BOOL    AllObjectShow(int nFlags);
	BOOL    DrawAnimate(CObject *pObject,SORT dwSort);
public:
    BOOL    ButtonAntiShowBoard();
    BOOL    ButtonShowBoard();
public:
        BOOL CoObject();
	CObject();
        CObject(CObject* pParent);
	virtual ~CObject();

};

typedef struct _tagOBJECTLIST
{
	CObject   *object;
	void FAR  (*fc)(CObject* pCurObj);
	SORT      sort;
	DWORD     idCode;
}OBJECTLIST;


class  CLabel:public CObject
{
private:
	BOOL    m_bDisplayBitmap;
	char    m_strDisplayBitmap[80];
	BOOL	m_bBackColorDisplay;
	COLOR   m_nBitmapColor;
public:
	void    SetBackColorDisplay(BOOL bFlags){m_bBackColorDisplay=bFlags;}
	int     GetBackColorDisplay(){return(m_bBackColorDisplay);}
public:
	BOOL Show();
public:
	void    SetBitmapFlags(BOOL bValue){m_bDisplayBitmap=bValue;}
	void    SetBitmapFile(char  *pStr){_fstrcpy(m_strDisplayBitmap,pStr);}
	BOOL    GetBitmapFlags(){return(m_bDisplayBitmap);}
	char*   GetBitmapFile(){return(m_strDisplayBitmap);}
	void    SetBitmapColor(int nColor){m_nBitmapColor = nColor;}
	int     GetBitmapColor(){return(m_nBitmapColor);}
public:
	void    SetFocus();
	void    KillFocus();
public:
	void CoLabel();
	CLabel();
	CLabel(CObject *pParent);
};

class CStatic:public CLabel
{
public:
	virtual BOOL Show();
public:
	CStatic(CObject* pParent);
};

class CBar:public CObject
{
protected:
	  CMenu* m_pMenu;
protected:
	int m_nActivateForeColor;
	int m_nActivateBackColor;
	int m_nInactivateForeColor;
	int m_nInactivateBackColor;

	int m_nLocationPoint;
	CListManager m_ListManagerBar;
protected:
	void   RefreshBarWidth();
public:
	CListManager* GetListManagerBar(){return(&m_ListManagerBar);}

	int    GetCount();
	char*  GetItemCaption(int nIndex);
	char*  GetItemIcon(int nIndex);
	int    GetItemAttrib(int nIndex);
	void   SetItemCaption(int nIndex, const char* pStrCaption);
	void   SetItemIcon(int nIndex, const char* pStrIcon);

	void FAR  (*GetFc())(CObject*);
	void FAR  (*GetItemFc(int))(CObject*);
	int    GetIndex(){return(m_nLocationPoint);}
	BOOL   SetItemBar(int nIndex,CBar* pBar);
	CBar*  GetItemBar(int nIndex);


	void    SetMenu(CMenu *pMenu){m_pMenu = pMenu;}
	CMenu   *GetMenu(){return(m_pMenu);}
protected:
    int     DoWithMove(int nY, int nOldLocation, BOOL bComp);
    void    ShowCoordinate(int nX, int nY, int nColor);


public:
	BOOL    AddItem(char *pStr,void FAR (*pFc)(CObject*)=NULL,char* strIcon=NULL,int nAttrib = BAR_ATTRIB_NORMAL);
    BOOL    AddSeparator();

	void    DisplaySel(int nPoint, BOOL bFlags = TRUE);

public:
	BOOL  ShowBar(BOOL bFlags = TRUE);
	BOOL  Show();

	void    DoWithMove();
        int     Swapping();
public:
	void CoBar();
	CBar();
	CBar(CObject *pParent);
	~CBar();
};

class _CLASSTYPE CMenu:public CObject
{
private:
	int m_nActivateForeColor;
	int m_nActivateBackColor;
	int m_nInactivateForeColor;
	int m_nInactivateBackColor;
	int m_nLocationPoint;

	CListManager m_ListManagerMenu;
	BOOL m_bActive;
public:
	BOOL GetActive(){return(m_bActive);}
	void SetActive(BOOL bActive){m_bActive = bActive;}
public:
	CListManager* GetListManagerMenu(){return(&m_ListManagerMenu);}

	void FAR (*GetBarFc())(CObject*);
	void FAR (*GetItemFc(int))(CObject*);

	char*   GetItemCaption(int nIndex);
	CBar*   GetItemBar(int nIndex);
	BOOL	AddItem(char *pStr,CBar *pBar=NULL,void FAR (*pFc)(CObject*)=NULL);

	int     GetCount()
	{
		return(m_ListManagerMenu.GetLength());
	}
	void    SetIndex(int nIndex)
	{
		int nTotalCount = GetCount();
		if(nIndex < nTotalCount)
		{
			m_nLocationPoint=nIndex;
		}
	}
    int     GetIndex(){return(m_nLocationPoint);}

	void    DisplaySel(int nPoint,int nFlags=TRUE);

protected:
    int     DoWithMove(int nX, int nY, int nOldLocation, BOOL bComp);

public:
	BOOL	Show(BOOL bFlags);
	BOOL    Show();
	int     Swapping();

public:
	void   CoMenu();
	CMenu();
	CMenu(CObject *pParent);
	~CMenu();
};

class  CWindow:public CObject
{
protected:
	char    m_strCaption[80];
	char    m_strIcon[60];

	COLOR	m_nClientForeColor;
	COLOR	m_nClientBackColor;
	COLOR	m_nActivateBarForeColor;
	COLOR	m_nActivateBarBackColor;
	COLOR	m_nInactivateBarForeColor;
	COLOR	m_nInactivateBarBackColor;

	BOOL    m_bFirstShowWindow;
	DWORD   m_dwStyle;
	int     m_nFocus;
	int	m_nFont;
	BOOL	m_bActivate;
	BOOL    m_bChangeWindowOrder;
	BOOL    m_bRunNormal;
	struct  time m_Time;
protected:
	CMenu* m_pMenu;
	void  FAR (*m_pHelpFc)(CObject*);
	int   FAR (*m_pKeyboardFc)(CObject*);
	void  FAR (*m_pDrawFc)(CObject*);
	void  FAR (*m_pRightButtonDownFc)(CObject*);
	void  FAR (*m_pIdleFc)(CObject*);
	void  FAR (*m_pTimeFc)(CObject*);
protected:
	CListManager m_ListManager_Keyboard;
	BOOL     m_bTwinkleTitle;
public:
    CObject* QueryChangeKey(WORD wKey, CObject* pChild);
	void     SetTwinkleTitle(BOOL bTwinkle) {m_bTwinkleTitle = bTwinkle;}
	int      GetTwinkleTitle(){return (m_bTwinkleTitle);}

	void     SetCaption(const char *pStr){_fstrcpy(m_strCaption,pStr);};
	char*    GetCaption(){return(m_strCaption);}

	void     SetActivateBarBackColor(int nColor){m_nActivateBarBackColor=nColor;}
	int      GetShortcutKeyFocus(WORD wKey);

	CMenu    *GetMenu(){return(m_pMenu);}
	void     SetMenu(CMenu *pMenu){m_pMenu=pMenu;}

	void	 SetIcon(char *pStr);
	char*    GetIcon(){return(m_strIcon);};

	DWORD	 GetStyle(){return(m_dwStyle);}

	void	SetClientForeColor(int nColor){m_nClientForeColor=nColor;}
	void	SetClientBackColor(int nColor){m_nClientBackColor=nColor;}
	void	SetActivate(BOOL bFlags)      {m_bActivate       =bFlags;}
	BOOL    GetActivate(){return(m_bActivate);}

	void    SaveAndSetUserView(viewporttype *pViewPort);
	void    RestoreUserView(viewporttype    *pViewPort);

	void FAR (*GetHelpFc())(CObject*){return(m_pHelpFc);};
	void FAR (*GetIdleFc())(CObject*){return(m_pIdleFc);};
	void FAR (*GetTimeFc())(CObject*){return(m_pTimeFc);};
	int  FAR (*GetKeyboardFc())(CObject*){return(m_pKeyboardFc);};

	void    SetRightMouseFc(void FAR (*pFc)(CObject*)){m_pRightButtonDownFc=pFc;}
	void    SetHelpFc(void FAR (*pFc)(CObject*)=NULL){m_pHelpFc=pFc;}
	void    SetIdleFc(void FAR (*pFc)(CObject*)=NULL){m_pIdleFc=pFc;}
	void    SetTimeFc(void FAR (*pFc)(CObject*)=NULL){m_pTimeFc=pFc;}
	void    SetKeyboardFc(int FAR (*pFc)(CObject*)=NULL){m_pKeyboardFc=pFc;};
	void    SetDrawFc(void FAR (*pFc)(CObject*)=NULL){m_pDrawFc=pFc;};

public:
	void   AddCommandKey(WORD wKey, void FAR (*pFc)(CObject*));
	//static int FAR  CompareCommandKey(void FAR *,void FAR *);

	static BOOL FAR ChangeWindow(HANDLE hWnd,BOOL bFlags);

	static BOOL  DisplayFrameIcon(int nLeft,int nTop,char *strIcon);

	void     SetChangeWindowOrder(BOOL bChange){m_bChangeWindowOrder = bChange;}
	BOOL	 GetChangeWindowOrder(){return(m_bChangeWindowOrder);}
	void     SetRunNormal(BOOL bNormal){m_bRunNormal = bNormal;}
	BOOL     GetRunNormal(){return(m_bRunNormal);}

	int        GetFirstFocus();
	void	   SetObjectFocus(CObject *pObject);
	CObject*   GetObjectFocus();

	int      TransrateMenu();

	int      PurseMessage()
    {
        return (this->Swapping());
    }
	HANDLE	 CreateWindow(int nX,int nY,int nWidth,int nHeight, const char *strCaption);

private:
	BOOL     DoWithMoveWindow(int nX, int nY);
    CObject*     GetDefaultObject(int* pnFocus);
    int    SwapFocus(int nOld, int nNew, BOOL bKillOld, BOOL bSetNew);
public:
	virtual void    OnIdle();
	virtual void    OnTime();
	virtual void    OnDraw();

	virtual void  FAR KeyF3();
	virtual void  FAR KeyF1();
	virtual void  FAR KeyF2();
	virtual void  FAR KeyCtrlF1();
	virtual void  FAR KeyCtrlF2();
	virtual void  FAR KeyCtrlF3();

    virtual int  Swapping();


	BOOL    Center();
	void    Paint();
	BOOL    ShowFrame();
	BOOL	ShowWindow(DWORD dwStyle=MB_OK);
	void    Paint(int nLeft,int nTop,int nRight,int nBottom);
public:
	void    CoWindow();
	CWindow();
	CWindow(CObject *pParent);
	~CWindow();
};

class _CLASSTYPE  CDialog :public CWindow
{
public:
	int    DoModal();
public:
	void  CoDialog();
	CDialog();
	CDialog(CObject* pParent);
	~CDialog();
};

class _CLASSTYPE CMessageDialog:public CDialog
{
public:
	int  CreateMessageDialog(int nLeft,int nTop,int nWidth,int nHeight,DWORD dwStyle);

public:
	void CoMessageDialog();
	CMessageDialog();
	CMessageDialog(CObject *pParent);
	~CMessageDialog();
};

class _CLASSTYPE CButton:public CObject
{
protected:
	char    m_strCaption[80];
    BOOL    m_bDefaultFlags;
public:
	void   SetCaption(const char *pStr){_fstrcpy(m_strCaption,pStr);};
	char*  GetCaption(){return(m_strCaption);}
public:
    BOOL   GetDefaultFlags(){return (m_bDefaultFlags);}
    void   SetDefaultFlags(BOOL bFlags){m_bDefaultFlags = bFlags;}
public:
	void   KillFocus();
	void   SetFocus();

	BOOL   Show();
	BOOL   AntiShow();
public:
	void CoButton();
	CButton();
	CButton(CObject *pParent);
	~CButton();
};

class _CLASSTYPE CMinButton :public CButton
{
public:
	BOOL Show();
	BOOL AntiShow();
public:
	CMinButton();
	CMinButton(CObject *pParentWnd=NULL);
};

class _CLASSTYPE CMaxButton :public CButton
{
public:
	BOOL Show();
	BOOL AntiShow();
public:
	CMaxButton();
	CMaxButton(CObject *pParentWnd);
};

class _CLASSTYPE CCloseButton :public CButton
{
public:
	BOOL Show();
	BOOL AntiShow();
public:
	CCloseButton();
	CCloseButton(CObject *pParent);
};


class CGrid:public CObject
{
protected:
	CXmsMemory m_XmsMemory;

	DWORD m_dwItemIndex;
	DWORD m_dwVolumnIndex;
	DWORD m_dwItemCursor;
	DWORD m_dwVolumnCursor;

	DWORD m_dwItemCount;
	DWORD m_dwVolumnCount;
protected:
	BOOL   m_bNumber;
	BOOL   m_bOnlyRead;
	void FAR (*m_pCopyGridFc)(CObject*);
	void FAR (*m_pPasteGridFc)(CObject*);
protected:
	CEdit* m_pEdit;
	CRadio* m_pRadioBox;
	CHScrollBar* m_pScrollBarH;
	CVScrollBar* m_pScrollBarV;
	int  m_nPaneTextColor;
protected:
	int  m_nDisableVolumnCount;
public:
	void SetPaneTextColor(int nColor){m_nPaneTextColor = nColor;}
public:
	void SetCopyGridFc(void FAR (*pCopyGridFc)(CObject*)){m_pCopyGridFc=pCopyGridFc;}
	void SetPasteGridFc(void FAR (*pPasteGridFc)(CObject*)){m_pPasteGridFc=pPasteGridFc;}
public:
	void  SetVolumnCaption(DWORD dwVolumn, char* pCaption);
	void  SetVolumnWidth(DWORD dwVolumn, int nWidthCh);
	void  SetVolumnAttrib(DWORD dwVolumn, int nStyle);
	void  SetVolumnRadioStyle(DWORD dwVolumn, int nStyle);
	char* GetVolumnCaption(DWORD dwVolumn);
	int   GetVolumnWidth(DWORD dwVolumn);
	int   GetVolumnAttrib(DWORD dwVolumn);
	int   GetVolumnRadioStyle(DWORD dwVolumn);

	DWORD CalcEnableVolumnCount();
	DWORD CalcEnableItemCount();

	void DisplayEdit(DWORD dwItemCursor, DWORD dwVolumnCursor, BOOL bEditShow);
	void DisplayEdit(BOOL bEditShow = TRUE);
		void DisplayData();
	void DisplayLine(DWORD dwLine);
public:
       void  SetOnlyRead(BOOL bFlags){m_bOnlyRead=bFlags;}
       void  SetNumberFlags(BOOL bFlags){m_bNumber=bFlags;}

       BOOL  GetOnlyRead(){return(m_bOnlyRead);}
       BOOL  GetNumberFlags(){return (m_bNumber);}

       void  SetItemCaption(DWORD dwItem, char* pStr){SetSel(dwItem, 0 , pStr);}
       void  SetSel(DWORD dwItem, DWORD dwIndex, char* pStr);
       char* GetSel(DWORD dwItem, DWORD dwIndex);

       DWORD GetItemIndex(){return(m_dwItemIndex);}
       DWORD GetItemCursor(){return(m_dwItemCursor);}
       DWORD GetVolumnIndex(){return(m_dwVolumnIndex);}
       DWORD GetVolumnCursor(){return(m_dwVolumnCursor);}
       void  SetItemIndex(DWORD dwIndex){m_dwItemIndex=dwIndex;}
       void  SetItemCursor(DWORD dwCursor){m_dwItemCursor=dwCursor;}
       void  SetVolumnIndex(DWORD dwIndex){m_dwVolumnIndex = dwIndex;}
       void  SetVolumnCursor(DWORD dwCursor){m_dwVolumnCursor=dwCursor;}
       void  SetItemCount(DWORD dwCount);
       void  SetVolumnCount(DWORD dwCount);
       DWORD GetItemCount(){return(m_dwItemCount);}
       DWORD GetVolumnCount(){return(m_dwVolumnCount);}
       DWORD GetItemPoint(){return(m_dwItemIndex + m_dwItemCursor);}
       DWORD GetVolumnPoint(){return(m_dwVolumnIndex + m_dwVolumnCursor);}
public:
	int  GetDisableVolumnCount();
	void SetDisableVolumnCount(int nCount);

protected:
       DWORD   GetMouseCursorV(int nMouseX);
       virtual void UpdateData(DWORD nIndexH,DWORD nIndexV,BOOL bFlags=TRUE);
public:
       virtual BOOL PreEditColor(DWORD  dwItem, DWORD dwVolumn,
		int* pnForeColor, int* pnBackColor);
public:

       CEdit* GetEdit(){return(m_pEdit);}
       BOOL IsCeilVisible(DWORD dwItem, DWORD dwVolumn);
	   HWND CreateGridEx(int nLeft, int nTop, int nWidth, int nHeight, const char* pStr = NULL);
	   HWND CreateGrid(int nLeft, int nTop, int nRight, int nBottom, const char* pStr = NULL);

       void  ModifyCoordinate();
       BOOL Show();
       void Paint();

       void   ModifyEditLocation();
       void   DisplaySel(DWORD  dwItem, DWORD dwVolumn, BOOL bFocus = FALSE);
       void   DisplayVolumnCaption();

       int    Swapping();
       int    TransrateEditMessage();
public:
       CGrid(CObject *);
       ~CGrid();
};

class _CLASSTYPE   CEdit:public CObject
{
protected:
	char  m_strBuffer[EDIT_BUFFER_SIZE];

	int   m_nIndex;
	int   m_nTotalCount;
	int   m_nMaxCount;
	int   m_nCursor;
	BOOL  m_bModify;

	BOOL  m_bOnlyRead;
	BOOL  m_bNumber;
	BOOL  m_bPassword;
	BOOL  m_nDelayCursor;

	struct time  m_Time;
protected:
	int   AddChar(int nKey,int nChar);
	int   AddChar(int nChar);

	void  SetCursorToEnd();
	void  TwinkleCursor();

    int   GetEnableDisplayCount();
    void  ShowCursor(BOOL bShow, BOOL bCloseMouse);
public:
	static BOOL IsNumberKey(int nKey, BOOL bDot, BOOL bSub);

	BOOL  GetModify(){return(m_bModify);}
	void  SetModify(BOOL bValue){m_bModify=bValue;}
	void  SetMaxCount(int nCount);
        int   GetMaxCount(){return(m_nMaxCount);}

	BOOL  GetOnlyRead(){return(m_bOnlyRead);}
	void  SetOnlyRead(BOOL bFlags){m_bOnlyRead=bFlags;}

    void  SetIndex(int nIndex){m_nIndex = nIndex;}
    void  SetCursor(int nCursor){m_nCursor = nCursor;}


	int   GetIndex(){return(m_nIndex);}
	int   GetCursor(){return(m_nCursor);}
	int   GetTotalCount(){return(m_nTotalCount);}
	void  SetNumberFlags(BOOL bFlags){m_bNumber=bFlags;}
	void  SetPasswordFlags(BOOL bFlags){m_bPassword=bFlags;}

	BOOL  GetNumberFlags(){return (m_bNumber);}
	BOOL  GetPasswordFlags(){return(m_bPassword);}

	char  *GetBuffer(){return(m_strBuffer);}
	void  SetBuffer(const char *pStr);
public:
	void  SetNumber(float fNumber, int nDot, BOOL bDisplay);
public:
	void  KillFocus();
	void  SetFocus();
public:
	BOOL  Show();
	void  Paint();
	int   Swapping();
public:
	void CoEdit();
	CEdit();
	CEdit(CObject *pParent);
	~CEdit();
};


class CMultiEdit:public CEdit
{
protected:
       BOOL m_bPrivate;

       CVScrollBar* m_pScrollBarV;
public:
       BOOL m_bFocus;
	long m_dwIndexRow;
	long m_dwCursorRow;
	long m_dwIndexCol;
	long m_dwCursorCol;

	CXmsMemoryListingManager m_XmsMemoryData;
protected:
	BOOL m_bMultiModify;
protected:
	//BOOL  FindEmptyLocation(DWORD* pdwLocation, int nSize, XMS_MEMORY_BLOCK2* pXms);
	//BOOL  InsertEmptyLocation(DWORD dwIndex, char* pStr, XMS_MEMORY_BLOCK2* pXms);
	//BOOL  AddEmptyLocation(DWORD dwAdd);
	//BOOL InitXmsListing(DWORD dwSize);
    //void Debug();

    int GetMaxRowCount();
	int GetTrueSize(int nLength);
    void GetCurrentRect(RECT* pRc);
    int  ModifyEditBuffer(char* pStr, int nBufferSize);
    void ModifyScroll(BOOL bShow);
    DWORD GetTotalCount();
public:
	void SetModify(BOOL bModify) {m_bMultiModify = bModify;}
	BOOL GetModify(){return (m_bMultiModify);}
public:
    BOOL GetLineText(DWORD dwIndex, char* pStr, XMS_MEMORY_BLOCK2* pXms);
    BOOL SetLineText(DWORD dwIndex, char* pStr);

	BOOL LoadFile(const char* pStr);
	BOOL SaveFile(const char* pStr);

	void  SetWindowText(const char *pStr);
	char* GetWindowText(char *pStr, DWORD dwMaxCount);

public:
    HANDLE CreateObject(int nX, int nY, int nWidth, int nHeight, const char FAR *pStr);

	void  ModifyCoordinate();
    void Paint();
    BOOL Show();
    void SetFocus();
    void KillFocus();
	int Swapping();

public:
	CMultiEdit(CObject*);
};

/*
class CMultiEdit:public CEdit
{
private:
       BOOL m_bPrivate;
public:
       BOOL m_bFocus;
	long m_dwIndexRow;
    long m_dwCursorRow;
    long m_dwIndexCol;
    long m_dwCursorCol;

	CXmsMemory m_XmsMemoryData;
private:
	BOOL  FindEmptyLocation(DWORD* pdwLocation, int nSize, XMS_MEMORY_BLOCK2* pXms);
	BOOL  InsertEmptyLocation(DWORD dwIndex, char* pStr, XMS_MEMORY_BLOCK2* pXms);
	BOOL  AddEmptyLocation(DWORD dwAdd);

    BOOL InitXms(DWORD dwSize);
    int GetMaxRowCount();
	int GetTrueSize(int nLength);
    void GetCurrentRect(RECT* pRc);
    void Debug();
    int  ModifyEditBuffer(char* pStr, int nBufferSize);

public:
    BOOL GetLineText(DWORD dwIndex, char* pStr, XMS_MEMORY_BLOCK2* pXms);
    BOOL SetLineText(DWORD dwIndex, char* pStr);

	BOOL LoadFile(char* pStr);
    BOOL SaveFile(char* pStr);

	void  SetWindowText(char FAR *pStr);
	char* GetWindowText(char FAR *pStr);

public:


    void Paint();
    BOOL Show();
    void SetFocus();
    void KillFocus();
	int Swapping();

public:
	CMultiEdit(CObject*);
};
*/
class _CLASSTYPE CRadio:public CObject
{
protected:
	char    m_strCaption[80];

	BOOL	m_bRadio;
	BOOL    m_bBox;
	BOOL	m_bStatic;
	BOOL    m_bMessage;
public:
	void    SetCaption(const char *pStr){_fstrcpy(m_strCaption,pStr);};
	char*   GetCaption(){return(m_strCaption);}
	BOOL 	GetStatic(){return(m_bStatic);}
	void    SetStatic(BOOL bStatic){m_bStatic=bStatic;}
	BOOL    GetMessage(){return(m_bMessage);}

	void    SetRadio(BOOL bFlags){m_bRadio=bFlags;}
	void    SetBox(BOOL bFlags  ){m_bBox  =bFlags;}
	BOOL    GetRadio(){return(m_bRadio);}
	BOOL    GetBox(){return(m_bBox);}

	BOOL    ChangeRadio();

    void    SetCurSel(int nIndex, BOOL bDisplay);
    int     GetCurSel();
    CRadio* GetSelRadio();

//private:
public:
	int     FindGroupLocation();
public:
	void SetFocus();
	void KillFocus();

	void Paint();
	BOOL Show();
	BOOL ShowFrame();
	int  Swapping();
public:
	void CoRadio();
	CRadio();
	CRadio(CObject *pParent);
	~CRadio();
};

class   _CLASSTYPE CScrollBar:public CObject
{
protected:
	int     m_nKey;

	CButton *m_pLeftButton;
	CButton *m_pRightButton;
	CButton *m_pMiddleButton;

	DWORD   m_dwMax;
	DWORD   m_dwMin;
	DWORD   m_dwLocation;

	float   m_fBei;
public:
	void  SetBei(float fBei){m_fBei = fBei;}
	float SetBei(){return (m_fBei);}
	CButton* GetLeftButton(){return(m_pLeftButton);}
	CButton* GetRightButton(){return(m_pRightButton);}
	CButton* GetMiddleButton(){return(m_pMiddleButton);}

	void   SetRange(DWORD dwMin,DWORD dwMax);
	void   SetPos(DWORD dwLocation);
	DWORD  GetPos(){return(m_dwLocation);};
	void   GetRange(DWORD *pdwMin,DWORD *pdwMax){*pdwMin=m_dwMin;*pdwMax=m_dwMax;}
	static void FAR ClickScrollBar(CObject* pCurObj);
public:
	BOOL  CoScrollBar();
	CScrollBar();
	CScrollBar(CObject *pObject);
	~CScrollBar();
};

class   _CLASSTYPE CHScrollBar:public CScrollBar
{
private:
	void FAR (*m_pScrollLeftFc)(CHScrollBar *pHScroll);
	void FAR (*m_pScrollPosFc)(CHScrollBar *pHScroll);
	void FAR (*m_pScrollRightFc)(CHScrollBar *pHScroll);
private:
	int GetKey(){int nKey = m_nKey; m_nKey = 0; return(nKey);};
public:
	void   SetButton(int nIndex);
	void   SetScrollLeftFc (void FAR (*pFc)(CHScrollBar *pHScroll)){m_pScrollLeftFc = pFc;};
	void   SetScrollPosFc  (void FAR (*pFc)(CHScrollBar *pHScroll)){m_pScrollPosFc  = pFc;};
	void   SetScrollRightFc(void FAR (*pFc)(CHScrollBar *pHScroll)){m_pScrollRightFc = pFc;};

	HANDLE CreateScrollBar(int nLeft,int nTop,int nWidth,int nHeight, const char* pStrCaption = NULL);
	int    Swapping();
public:
	BOOL  Show();
	void  Paint();
	void  ShowCoordinate(int nOrder);
private:
    void  ShowLeftButton();
    void  ShowMiddleButton();
    void  ShowRightButton();

public:
	CHScrollBar();
	CHScrollBar(CObject *pObject);
};

class   _CLASSTYPE CVScrollBar:public CScrollBar
{
private:
	void FAR (*m_pScrollTopFc)(CVScrollBar *pVScroll);
	void FAR (*m_pScrollPosFc)(CVScrollBar *pVScroll);
	void FAR (*m_pScrollBottomFc)(CVScrollBar *pVScroll);
private:
	int GetKey(){int nKey = m_nKey; m_nKey = 0; return(nKey);};
public:
	void   SetButton(int nIndex);
	void   SetScrollTopFc (void FAR (*pFc)(CVScrollBar *pVScroll)){m_pScrollTopFc = pFc;};
	void   SetScrollPosFc  (void FAR (*pFc)(CVScrollBar *pVScroll)){m_pScrollPosFc  = pFc;};
	void   SetScrollBottomFc(void FAR (*pFc)(CVScrollBar *pVScroll)){m_pScrollBottomFc = pFc;};

	HANDLE CreateScrollBar(int nLeft,int nTop,int nWidth,int nHeight, const char* pStrCaption = NULL);
	int    Swapping();
private:
    void  ShowUpButton();
    void  ShowMiddleButton();
    void  ShowDownButton();
public:
	BOOL  Show();
	void  Paint();
	void  ShowCoordinate(int nOrder);
public:
	CVScrollBar();
	CVScrollBar(CObject *pObject);
};

class _CLASSTYPE CListBox:public CObject
{
private:
	DWORD m_dwCount;
	DWORD m_dwIndex;
	DWORD m_dwPoint;
	BOOL  m_bExternal;
	int   m_nLineCharacter;

	CXmsMemory  *m_pXmsMemory;
	CVScrollBar *m_pVScrollBar;
	CEdit       *m_pEdit;

private:
    //BOOL  m_bMoveMouse;
public:
    //BOOL  GetMoveMouse(){return(m_bMoveMouse);}
    //void  SetMoveMouse(BOOL bMoveMouse){m_bMoveMouse = bMoveMouse;}
public:

	void FAR (*m_pUpdateDataFc)(CListBox *pListBox,int nIndex,BOOL bWrite);
	void FAR (*m_pEnterFc)(CListBox *pListBox,int nIndex);
public:
	void   SetLineCharacter(int nValue);
	int    GetLineCharacter(){return(m_nLineCharacter);}

	void   SetXmsMemory(CXmsMemory* pXmsMemory){m_pXmsMemory = pXmsMemory;}
	CXmsMemory* GetXmsMemory(){return(m_pXmsMemory);}

	void  SetUpdateDataFc(void FAR (*pFc)(CListBox *,int,BOOL)){m_pUpdateDataFc=pFc;}
	void  SetEnterFc(void FAR  (*pFc)(CListBox *,int)){m_pEnterFc=pFc;}
	void  FAR (*GetEnterFc())(CListBox*, int nIndex){return(m_pEnterFc);};

	void  SetExternal(BOOL bValue){m_bExternal=bValue;}
	BOOL  GetExternal(){return(m_bExternal);}

	BOOL  SetSel(DWORD dwValue,char *pStr);
	char* GetSel(DWORD dwValue);
	BOOL  SetCount(DWORD dwValue);
	DWORD GetCount(){return(m_dwCount);}
	void  SetIndex(DWORD dwValue);//{m_dwIndex=dwValue;}
	DWORD GetIndex(){return(m_dwIndex);}
	void  SetPoint(DWORD dwValue){m_dwPoint=dwValue;}
	DWORD GetPoint(){return(m_dwPoint);}
	CVScrollBar *GetScrollBar(){return(m_pVScrollBar);}
	CEdit       *GetEdit(){return(m_pEdit);}

	RECT* GetSelLocation(int nSort);
	void  ModifyEditLocation(int nSort);
	int   GetEnableItemDisplayCount();
public:
	BOOL  AddSel(char *pStr);
	BOOL  DeleteSel(DWORD dwIndex);

public:
	virtual void UpdateData(DWORD dwIndex,BOOL bWrite=FALSE);

	HANDLE CreateList(int nX,int nY,int nWidth,int nBottom,const char FAR *pStr);
	int    Swapping();
public:
    void  DisplaySel(DWORD dwIndex, BOOL bFocus);

	void  KillFocus();
	void  SetFocus();
    void  ModifyCoordinate();

	BOOL  Show();
	void  Paint();
public:
	BOOL CoListBox();
	CListBox();
	CListBox(CObject *pParent);
	~CListBox();
};

class _CLASSTYPE CComboBox:public CObject
{
private:
	CEdit       *m_pEdit;
	CListBox    *m_pListBox;
	BOOL	    m_bReadOnly;

	DWORD m_dwCount;
	DWORD m_dwIndex;
	int   m_nLineCharacter;

	void FAR (*m_pEnterFc)(CComboBox *pComboBox,int nIndex);
	CXmsMemory* m_pXmsMemory;
public:
	void   SetLineCharacter(int nValue);
	int    GetLineCharacter(){return(m_nLineCharacter);}
	void   SetXmsMemory(CXmsMemory *pXmsMemory){m_pXmsMemory = pXmsMemory;}
	CXmsMemory*GetXmsMemory(){return(m_pXmsMemory);}
	CEdit *GetEdit(){return(m_pEdit);}

	void   SetEnterFc(void FAR  (*pFc)(CComboBox *,int)){m_pEnterFc = pFc;}
	void   FAR (*GetEnterFc())(CComboBox*, int nIndex){return(m_pEnterFc);};

	BOOL   SetCount(DWORD dwValue);
	DWORD  GetCount(){return(m_dwCount);}
	void   SetIndex(DWORD dwValue){m_dwIndex=dwValue;}
	DWORD  GetIndex(){return(m_dwIndex);}

	BOOL   IsDrapDown(){return(((m_pListBox != NULL)?TRUE:FALSE));}
	BOOL   GetReadOnly(){return(m_bReadOnly);}
	void   SetReadOnly(BOOL bValue)
        {
                m_bReadOnly=bValue;
                if (NULL != m_pEdit)
                {
                        m_pEdit->SetOnlyRead(bValue);
                }
        }
public:
	BOOL  SetSel(DWORD dwValue,char *pStr);
	char* GetSel(DWORD dwValue);

	BOOL  DelSel(int nIndex);
	BOOL  AddSel(char *pStr);
	BOOL  DeleteSel(DWORD dwIndex);

	void ShowCoordinate();
public:
	HANDLE CreateCombo(int nX,int nY,int nWidth,int nBottom,const char FAR *pStr);
	int    Swapping();
public:
	void  KillFocus();
	void  SetFocus();

	BOOL  Show();
	void  Paint();
public:
	BOOL CoComboBox();
	CComboBox();
	CComboBox(CObject *pParent);
	~CComboBox();
};

class _CLASSTYPE CComboBoxEx:public CComboBox
{
public:
	//virtual void KillFocus();
	virtual void SetFocus();
public:
	CNewComboBox(CObject* pParent);
};


class CSliderCtrl:public CObject
{
protected:
	long m_dwPos;
    long m_dwMin;
    long m_dwMax;
protected:
	BOOL m_bHorz;
    void FAR (*m_pChangeSliderFc)(CSliderCtrl* pSliderCtrl);
public:
    void  SetHorz(BOOL bHorz){m_bHorz = bHorz;}
	void  SetPos(long dwPos){m_dwPos = dwPos;}
    long  GetPos(){return(m_dwPos);}

	void GetRange(long* pdwMin, long* pdwMax){*pdwMin = m_dwMin,*pdwMax = m_dwMax;};
    void SetRange(long dwMin, long dwMax);//{m_dwMin = dwMin, m_dwMax = dwMax;}

    void SetChangeSliderFc(void FAR (*pFc)(CSliderCtrl* pSliderCtrl)){m_pChangeSliderFc = pFc;}
public:
	void  KillFocus();
	void  SetFocus();
	BOOL  AddShow(DWORD dwPos);
	BOOL  Show();
	int   Swapping();
public:
	CSliderCtrl(CObject* pParent);
};

class CProgressCtrl:public CObject
{
private:
	long m_dwPos;
    long m_dwMin;
    long m_dwMax;
private:
	BOOL m_bHorz;
public:
    void  SetHorz(BOOL bHorz){m_bHorz = bHorz;}
	void  SetPos(long dwPos){m_dwPos = dwPos;}
    long  GetPos(){return(m_dwPos);}

	void GetRange(long* pdwMin, long* pdwMax){*pdwMin = m_dwMin,*pdwMax = m_dwMax;}
    void SetRange(long dwMin, long dwMax);//{m_dwMin = dwMin, m_dwMax = dwMax;}
private:
	BOOL PrivateShow(BOOL bBox);
public:
	BOOL  AddShow(DWORD dwPos);
	BOOL  Show();
public:
	CProgressCtrl(CObject*);	
};


/*
class CFileDialog:public CDialog
{
public:
	char     m_strPath[MAXPATH];
	char     m_strFile[13];
	char     m_strFullPathName[MAXPATH];
	char     m_strCurrentPath[MAXPATH];

	CListBox  *m_pListBox;
	CComboBox *m_pComboBox;
	CLabel    *m_pLabel1;
	CLabel    *m_pLabel2;
	CLabel    *m_pLabel3;
public:
	int  FindFileCount(char *pStr,int nAttrib);

	BOOL LoadCombo(BOOL bDisplay=FALSE);
	BOOL LoadList(BOOL bDisplay=FALSE);
public:
	CFileDialog();
	~CFileDialog();
};

*/

class CDesktop:public CObject
{
private:
	int     m_nPoint;
	int     m_nLightColor;
        BOOL    m_bBackColorDisplay;

	CListManager m_ListManager2;
public:
	CListManager* GetListManager2(){return(&m_ListManager2);}
	void    SetLightColor(int nColor){ m_nLightColor = nColor;}
	int     GetLightColor(){ return(m_nLightColor); }

	int     GetPoint(){return(m_nPoint);}
	void    SetPoint(int nPoint){m_nPoint = nPoint;}

	BOOL    AddLink(char *pStrIcon, char* strCaption,void FAR (*pFc)(CObject*));
    void    SetBackColorDisplay(BOOL bDisplay){m_bBackColorDisplay = bDisplay;}
public:
	static void FAR Delete_Desktop(void FAR * pUser);
	static void FAR Function_Desktop(CObject* pCurObj);
public:
	void    SetFocus();
	void    KillFocus();
	int     Swapping();

	BOOL   Show();
public:
	CDesktop(CObject *pObject);
	~CDesktop();
};

class CToolsBar:public CObject
{
private:
	int     m_nPoint;
	CListManager m_ListManager2;
        BOOL m_bBackColorDisplay;
public:
	CListManager* GetListManager2(){return(&m_ListManager2);}

	int     GetPoint(){return(m_nPoint);}
	void    SetPoint(int nPoint){m_nPoint = nPoint;}

	BOOL   AddButton(char *pStrIcon , void FAR (*pFc)(CObject*, WORD) = NULL, WORD wID = 0);
        void    SetBackColorDisplay(BOOL bDisplay){m_bBackColorDisplay = bDisplay;}
public:
	static void FAR Function_ToolsBar(CObject* pCurObj);
	static void FAR Delete_ToolsBar(void FAR * pUser);
public:
	void    SetFocus();
	void    KillFocus();
	int     Swapping();

	BOOL   Show();
public:
	CToolsBar(CObject *pObject);
	~CToolsBar();
};


class CSpinCtrl:public CObject
{
private:
        DWORD m_dwSpin;
        DWORD m_dwMin;
        DWORD m_dwMax;

        CEdit* m_pEdit;
        BOOL  m_bHorz;
public:
       DWORD GetSpin();//{return(m_dwSpin);}
       void  SetSpin(DWORD dwSpin);//{m_dwSpin  = dwSpin;}
       void  GetRange(DWORD* pdwMin, DWORD* pdwMax)
       {
               *pdwMin = m_dwMin;
               *pdwMax = m_dwMax;
       }
       void  SetRange(DWORD dwMin, DWORD dwMax);
       void  SetBody(CEdit* pEdit);
       CEdit* GetBody(){return (m_pEdit);}

public:
       HANDLE CreateObject(int nX, int nY,
           int nWidth, int nHeight, const char FAR *pStr);

       BOOL Show();
	   int  Swapping();
private:
        void ShowUpButton(BOOL bClick);
        void ShowDownButton(BOOL bClick);
        void ChangeEdit(BOOL bDisplay);
        void ChangeSpin();
public:
       void SetHorz(BOOL bHorz){m_bHorz = bHorz;}
       BOOL GetHorz(){return(m_bHorz);}
private:
        BOOL CoSpinCtrl();
        RECT GetValidRect();
        //void Refresh();
public:
       CSpinCtrl(CObject* pParent);
};

class CGraphWindow:public CLabel
{
private:
       CTorqueGraph m_GraphWave;
public:
       CTorqueGraph*   GetGraphWave();

	   HANDLE   CreateObject(int nX,int nY,int nWidth,int nHeight, const char FAR *pStr);
public:
       BOOL Show();
public:
       CGraphWindow(CObject* pObject);
};

class CKeyboardCtrl:public CObject
{
private:
	int m_nIndex;
    int m_nLineCount;
	BOOL m_bCap;
    BOOL m_bShift;
    BOOL m_bCtrl;
    BOOL m_bAlt;
    float m_fScale;
    BOOL  m_bNumber;
private:
	static void FAR ClickKeyboardButton(CObject* pCurObj);
	static int ModifyLeft(BYTE byLeft);
public:
	void SetScale(float fScale);
	float GetScale(){return(m_fScale);}
	void SetAttrib(int nIndex, int nLineCount);
	void GetAttrib(int* pnIndex, int* pnLineCount)
    {
	*pnIndex = m_nIndex, *pnLineCount = m_nLineCount;
    }
	void SetNumber(BOOL bNumber)
	{
		m_bNumber = bNumber;
	}
	BOOL GetNumber() {return (m_bNumber);}
private:
    void ShowUpButton(BOOL bClick);
    void ShowDownButton(BOOL bClick);

public:
       HANDLE   CreateObject(int nX, int nY, int nWidth,
		int nHeight, const char FAR *pStr);

	BOOL Show();

public:

	CKeyboardCtrl(CObject* pParent);
};

class CNumberKeyboard:public CObject
{
public:
        float m_fScale;
        char  m_strArray[5][4][6];
	WORD  m_wArray[5][4];
	int   m_nPage;

	DWORD m_dwOldTime;
	DWORD m_dwNewTime;

	int   m_nRowPoint;
	int   m_nColPoint;
	int   m_nButtonPoint;

	BOOL  m_bCap;
	BOOL  m_bShift;
	BOOL  m_bCtrl;
private:
	void  ChangePage(int nPage, BOOL bShow);
public:
       float GetScale(){return(m_fScale);}
       void  SetScale(float fScale);

       void SetPage(int nPage){this->ChangePage(nPage, FALSE);}
       int  GetPage() {return (m_nPage);}
public:
	void  DoWithEnglish9(); //2020-03-17
public:
       static void FAR Fc_ClickNumberKeyboard(CObject* pCur);
       static void FAR ShowAndDo(CObject* pCur, BOOL bShow);
public:
       HANDLE   CreateObject(int nX, int nY, int nWidth,
		int nHeight, const char FAR *pStr);
       BOOL Show();
public:
       CNumberKeyboard(CObject* pParent);
};

class CAnimalCtrl:public CObject
{
private:
	WORD m_wStopTime;
	int  m_nPoint;
	int  m_nPages;


	int m_nTimer;

private:
	CXmsMemory m_XmsMemory;
public:
	BOOL m_bTransparentAuto;
	BOOL m_bTransparent;
	int  m_nTransparentColor;
public:
	//void SetAgain(int nAgain){m_nAgain = nAgain;}
	//int  GetAgain(){return(m_nAgain);}
	void Play();
	void Stop();
	void SetStopTime(WORD wTime){m_wStopTime = wTime;}
	WORD GetStopTime(){return(m_wStopTime);}
	void SetPoint(int nPoint){m_nPoint = nPoint;}
	int  GetPoint(){return(m_nPoint);}
	void SetPages(int nPages){m_nPages = nPages;}
	int  GetPages(){return(m_nPages);}
	int  GetTimer(){return(m_nTimer);}
	CXmsMemory* GetXmsMemory(){return(&m_XmsMemory);}
	void SetTransparentAttrib(BOOL bTransparent, int nColor, BOOL bAuto)
	{
		m_bTransparentAuto = bAuto;
		m_bTransparent = bTransparent;
		m_nTransparentColor = nColor;

	}

public:
	BOOL  LoadFile(const char* pStrFile);
public:
	BOOL Show();
public:
	CAnimalCtrl(CObject* pParent);
	~CAnimalCtrl();
};

class CArrowButton:public CLabel
{
protected:
	void FAR (*m_pFc_Left)(CObject*);
	void FAR (*m_pFc_Right)(CObject*);
	void FAR (*m_pFc_Up)(CObject*);
	void FAR (*m_pFc_Down)(CObject*);
	void FAR (*m_pFc_Middle)(CObject*);
protected:
	static void FAR __Function_ArrowButton(CObject* pCurObj);
public:
	int  m_nBallColor;
	int  m_nPhase;
public:
	void SetPhase(int nPhase){m_nPhase = nPhase;}
	void SetBallColor(int nColor){m_nBallColor = nColor;}
	void SetFc_Arrow(int nButton, void FAR (*pFc)(CObject*));
/*
	{
		switch (nButton)
		{
			//Left
			case 0: m_pFc_Left = pFc; break;
			//Right
			case 1: m_pFc_Right = pFc; break;
			//Up
			case 2: m_pFc_Up = pFc; break;
			//Down
			case 3: m_pFc_Down = pFc; break;
			//Middle
			case 4: m_pFc_Middle = pFc; break;

		}
	}
*/
	void KernelDo(BOOL bShow, int nBallColor,
		int nRow, int nCol, BOOL bClick);
public:
	BOOL Show();
public:
	CArrowButton(CObject* pObj);
	~CArrowButton();
};

struct  PASSWORD
{
	char  strUser[16];
	char  strPassword[12];
	WORD  wPriviledge;
	WORD  wKey;
};

//BOOL    FAR ChangeWindow(HANDLE hWnd,BOOL bFlags=TRUE);
void    FAR WindowManager();


void    FAR CloseWindow(CObject*);
void  FAR ClickPublicButton(CObject* pObj, int nResult);
void    FAR ClickBootButton(CObject* pCurObj);
void    FAR ClickCloseButton(CObject*);
void    FAR ClickEnterButton(CObject*);
void    FAR ClickCancelButton(CObject*);
void    FAR ClickYesButton(CObject*);
void    FAR ClickNoButton(CObject*);
void    FAR ClickRetryButton(CObject*);
void    FAR ClickTimeButton(CObject*);

BOOL    FAR LoadSystemProfileParameter();
BOOL    FAR InitSystem(int argc,char **argv);
BOOL    FAR CloseSystem();


void WinSail_GetTimerAttrib(int nTimer, WORD* pwMaxTime);
void WinSail_ModifyTimer(int nTimer, WORD wTime);
int WinSail_SetTimer(DWORD dwParam, WORD wTime,
		void FAR (*pFc)(DWORD), DWORD dwWindow);
void WinSail_KillTimer(int nTimer);

BOOL FAR ReMove(char FAR *pStr);


			//void AfxSetMSGBoxTimeFc(void FAR (*pFc)(CObject*));
			//void FAR (*pOldMsgFc)(CObject *)= (void FAR (*)(CObject *))::AfxGetMsgBoxTimeFc();

			//::AfxSetMSGBoxTimeFc(::WaitLockMsgKeyboard);
void    FAR AfxPushMessageBoxTime(int nSecondTime, BOOL bBox = TRUE);
int     FAR GetPushMessageBoxTime();
void    FAR AfxSetMsgBoxTimeFc(void FAR (*pFc)(CObject*));
BOOL    AfxSetMsgBoxRealFalgs(BOOL bFlags);
DWORD   FAR AfxGetMsgBoxTimeFc();

DWORD  AfxGetMessageBoxHandle();
void   AfxSetMessageBoxNeedSaveHandle(BOOL bSave);



void   FAR  AfxSetMsgBoxButtonEx2(
	void FAR (*pFc1)(CObject*),  const char* pStrCaption1,
	void FAR (*pFc2)(CObject*),  const char* pStrCaption2,
	void FAR (*pFc3)(CObject*),  const char* pStrCaption3,
	void FAR (*pFc4)(CObject*),  const char* pStrCaption4,
	void FAR (*pFc5)(CObject*),  const char* pStrCaption5,
	void FAR (*pFc6)(CObject*),  const char* pStrCaption6,
	void FAR (*pFc7)(CObject*),  const char* pStrCaption7,
	void FAR (*pFc8)(CObject*),  const char* pStrCaption8,
	void FAR (*pFc9)(CObject*),  const char* pStrCaption9,
	void FAR (*pFc10)(CObject*), const char* pStrCaption10);

void    FAR AfxSetMsgBoxButtonEx(
	void FAR (*pFc1)(CObject*) = NULL, const char* pCaption1 = NULL,
	void FAR (*pFc2)(CObject*) = NULL,  const char* pCaption2 = NULL,
	void FAR (*pFc3)(CObject*) = NULL, const char* pCaption3 = NULL,
	void FAR (*pFc4)(CObject*) = NULL, const char* pCaption4 = NULL);


int     FAR AfxMessageBox(char FAR *pstrCaption,char FAR *pstrText,DWORD dwStyle=MB_OK);
int     FAR AfxMessageBox(char FAR *pstrText,DWORD dwStyle=MB_OK);

int     FAR AfxMessageBox(float fValue);
int     FAR AfxMessageBox(double dbValue);
int     FAR AfxMessageBox(int nValue);
int     FAR AfxMessageBox(WORD wValue);
int     FAR AfxMessageBox(long gValue);
int     FAR AfxMessageBox(DWORD dwValue);

PASSWORD*   GetPassword(int nIndex);
PASSWORD*   GetPassword(char *pStrUser);
BOOL        ChangeUserName(char *pOldUser,char *pNewUser);
BOOL        SetPassword(char *pUser,char *pStrPassword,BOOL bAdd=FALSE);


void        SetPrintBlank(int nBlank);
int         GetPrintBlank();
BOOL    FAR PrintChangePage();
void    FAR PrintEnter(FILE *pFile);
BOOL    FAR PrintChineseBlank(FILE *pFile,int nWidth);
BOOL    FAR PrintChinese(FILE *pFile,char* pStr,int nBackColor,int nTimes);
BOOL    FAR PrintScreenCh(char FAR *pStr);
BOOL    FAR PrintScreenEx(FILE *pFile,int nOriX,int nOriY,int nWidth,int nHeight,int nBackColor,BOOL bBei=FALSE,BOOL bEnter=TRUE);
BOOL    FAR PrintScreen(int nOriX,int nOriY,int nWidth,int nHeight,int nBackColor,BOOL bBei=FALSE);

void    FAR UserRegister();
void    FAR AboutDialog();
void    FAR CommSetting();
void    FAR ModifyPriviledge();
BOOL    FAR ShowAdvertistment(int nFlags=1);


BOOL    FAR AfxKbhit();
int     FAR Bioskey(int);
void    FAR ClearKeyboard();
void    FAR AddKeyboard(int nKey);
void    FAR AddKeyboardString(char *pStr);
void    FAR SetKeyboard(int nKey);


void AfxShow3D(int nLeft, int nTop, int nRight, int nBottom,
    int nColor1, int nColor2, int nColor3, int nColor4,
    int nColor5, BOOL bDisplayColor5);

void AfxShow3D(RECT* pRc,
    int nColor1, int nColor2, int nColor3, int nColor4,
    int nColor5, BOOL bDisplayColor5);

BOOL AfxCenterScreen(RECT* pRect);

CDialog*     AfxOpenWaitDialog(char *pStrCaption=NULL,char *pStrText=NULL);
void    FAR  AfxCloseWaitDialog(CDialog *pDialog);

//CFileDialog* FileDialog(BOOL bOpen=TRUE);
BOOL AfxOpenFileDialog(BOOL bOpen, char* strFullPathName,
	const char* pStrDefaultFileName = NULL,
	const char* pStrDefaultDirName = NULL);

void   FAR   AfxLoadDialog();
//CDialog*     InputDialogBox(const char *pStrCaption, const char *pStrLabel, const char *pStrEdit = NULL);


BOOL         AfxInputDialog(const char *pStrCaption,
	const char *pStrLabel, const char *pOriEdit, char* pDesEdit, int nCount, BOOL bPassword = FALSE,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialog2 (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialog3 (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrLabel3, const char *pOriEdit3, char* pDesEdit3, int nCount3, BOOL bPassword3,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialog4 (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrLabel3, const char *pOriEdit3, char* pDesEdit3, int nCount3, BOOL bPassword3,
	const char *pStrLabel4, const char *pOriEdit4, char* pDesEdit4, int nCount4, BOOL bPassword4,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialog6 (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrLabel3, const char *pOriEdit3, char* pDesEdit3, int nCount3, BOOL bPassword3,
	const char *pStrLabel4, const char *pOriEdit4, char* pDesEdit4, int nCount4, BOOL bPassword4,
	const char *pStrLabel5, const char *pOriEdit5, char* pDesEdit5, int nCount5, BOOL bPassword5,
	const char *pStrLabel6, const char *pOriEdit6, char* pDesEdit6, int nCount6, BOOL bPassword6,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialogAndCheck (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrCheck1,  const BOOL bCheck1,  BOOL* pbCheck1,
	int nTestScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialog2AndCheck (const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrCheck1,  const BOOL bCheck1,  BOOL* pbCheck1,
	const char *pStrCheck2,  const BOOL bCheck2,  BOOL* pbCheck2,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialogAndCheck4(const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrCheck1,  const BOOL bCheck1,  BOOL* pbCheck1,
	const char *pStrCheck2,  const BOOL bCheck2,  BOOL* pbCheck2,

	const char *pStrLabel3, const char *pOriEdit3, char* pDesEdit3, int nCount3, BOOL bPassword3,
	const char *pStrLabel4, const char *pOriEdit4, char* pDesEdit4, int nCount4, BOOL bPassword4,
	const char *pStrCheck3,  const BOOL bCheck3,  BOOL* pbCheck3,
	const char *pStrCheck4,  const BOOL bCheck4,  BOOL* pbCheck4,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

BOOL AfxInputDialogAndCheck6(const char *pStrCaption,
	const char *pStrLabel1, const char *pOriEdit1, char* pDesEdit1, int nCount1, BOOL bPassword1,
	const char *pStrLabel2, const char *pOriEdit2, char* pDesEdit2, int nCount2, BOOL bPassword2,
	const char *pStrCheck1,  const BOOL bCheck1,  BOOL* pbCheck1,
	const char *pStrCheck2,  const BOOL bCheck2,  BOOL* pbCheck2,

	const char *pStrLabel3, const char *pOriEdit3, char* pDesEdit3, int nCount3, BOOL bPassword3,
	const char *pStrLabel4, const char *pOriEdit4, char* pDesEdit4, int nCount4, BOOL bPassword4,
	const char *pStrCheck3,  const BOOL bCheck3,  BOOL* pbCheck3,
	const char *pStrCheck4,  const BOOL bCheck4,  BOOL* pbCheck4,

	const char *pStrLabel5, const char *pOriEdit5, char* pDesEdit5, int nCount5, BOOL bPassword5,
	const char *pStrLabel6, const char *pOriEdit6, char* pDesEdit6, int nCount6, BOOL bPassword6,
	const char *pStrCheck5,  const BOOL bCheck5,  BOOL* pbCheck5,
	const char *pStrCheck6,  const BOOL bCheck6,  BOOL* pbCheck6,
	int nTextScale = 1, BOOL bKeyboardCtrl = TRUE, BOOL bNumberCtrl = FALSE);

//long    FAR GetFileLength(char *pStr);
void    FAR ColorPane(int,int);
//BOOL    FAR IsProfileBoolen(char *pStr);
//char 	FAR *GetCurrentDirectory(char FAR *pCur);
char FAR *GetCurrentDirectory(char FAR *pCur);

BOOL        CopyFile(const char *pStrSource, const char *pStrTarget, BOOL bFailExist = FALSE);
char*       SetDisplayBufferDot(char *buf,float fValue);
char*       SetDisplayBufferDotEx(char *buf,float fValue, int nAddDot);

void    FAR ShowState(int nOriX,int nOriY,int nOriWidth,int nOriHeight,int nBackColor,int nCell,char *pStr,BOOL bEnd=FALSE);
void    FAR DisplaySystemDateAndTime(CObject*);

void    FAR DrawBoxCaption(int nLeft,int nTop,int nRight,int nBottom,
	char *pStr = NULL, int nForeColor = BLACK, int nBackColor = LIGHTGRAY, int nBei = 1, int nOption = 1);
void    FAR DrawBoxCaptionEx(int nLeft,int nTop,int nWidth,int nHeight,
	char *pStr, int nForeColor = BLACK, int nBackColor = LIGHTGRAY, int nBei = 1, int nOption = 1);

void AfxRestoreMainExe(BOOL bChild, BOOL bKeyboard = TRUE, char* pBuffer = NULL);
int  AfxGetLanguageVersion();
int  AfxGetCompanyVersion();
BOOL        GetEnglishVersion();

WORD    FAR GetEntryAgainFormat();
void    FAR SetCommCommandAsk(BOOL (*pAskFc)());
BOOL    FAR *GetCommCommandAsk();
void    FAR SetIdleNet(BOOL bNet);
BOOL    FAR GetIdleNet();

void    FAR ReceiveFileFromCommFc(int nPage);
void    FAR SendFileFromCommFc(int nPage);

void FAR  SetCommAskNeedFc(BOOL FAR (*pFc)());
BOOL FAR  (*GetCommAskNeedFc())();

void      SetAd_Chinese(char *pStrAd);
void      SetAd_English(char *pStrAd);

BOOL    FAR AddFile(char *pTargetFile,char *pSourceFile);
char*   AlignString(char  *pStr,int nCount,int nStyle = ALIGN_MIDDLE, BOOL bClip = FALSE, char nFillCh = ' ');


void  FAR DrawLight_Freq(int nX,int nY,int nRadus,int* pnCount,int nFreq1=3,int nFreq2=30);
void      Draw_FirstSail(int nX,int nY,int nInternal=26,int nBoardColor=WHITE,int nFillColor=GREEN,int nTimes1=2,int nTimes2=1);


void FAR DisplayAttribSetting();
void FAR CloseSystemDialog();

char* AfxGetSystemString(int nIndex);
BOOL  AfxGetSystemSwitch();
BOOL AfxGetSystemUsbAlert();

void  AfxSetSystemManager(BOOL bManager);
BOOL  AfxGetSystemManager();

char* AfxGetSystemPassword();
void  AfxSetSystemPassword(char* pStr);
char* AfxGetSystemUserName();
void  AfxSetSystemUserName(char* pStr);
BOOL  AfxGetSingleFont();
BOOL  AfxSetSingleFont(BOOL bSingle);
BOOL  AfxChangeSingleFont();

void  AfxWriteFunctionAsm(DWORD dwFc,WORD wSize);
void FAR AfxClearScreen(int nFillColor);

void  SetDisplayDateTime(BOOL bDisplay);
BOOL  GetDisplayDateTime();

void  SetAgain(BOOL bAgain);
BOOL  GetAgain();
BOOL  GetMultiTask();

BOOL FAR AfxKeyboardState(int nState);

//BOOL  AfxWindowManager();

#define LANGUAGE_STRING_ENTER   0
#define LANGUAGE_STRING_CANCEL  1
#define LANGUAGE_STRING_RETRY   2
#define LANGUAGE_STRING_YES     3
#define LANGUAGE_STRING_NO      4
#define LANGUAGE_STRING_CLOSE   5
#define LANGUAGE_STRING_QUIT    6
#define LANGUAGE_STRING_DEBUG   7
#define LANGUAGE_STRING_OPEN    8
#define LANGUAGE_STRING_SAVE    9
#define LANGUAGE_STRING_SEARCH       10
#define LANGUAGE_STRING_REBOOT       11
#define LANGUAGE_STRING_LOGOFF       12

#define LANGUAGE_STRING_FILE         13
#define LANGUAGE_STRING_STYLE        14
#define LANGUAGE_STRING_FILESTYLE    15
#define LANGUAGE_STRING_ABOUT        16
#define LANGUAGE_STRING_HELP         17
#define LANGUAGE_STRING_SELECT       18

#define LANGUAGE_STRING_CLOSESYSTEM  19
#define LANGUAGE_STRING_SELECT_DO    20
#define LANGUAGE_STRING_DATA         21
#define LANGUAGE_STRING_KEYBOARD     22
#define LANGUAGE_STRING_USER         23
#define LANGUAGE_STRING_PASSWORD     24

#define LANGUAGE_STRING_START       25
#define LANGUAGE_STRING_QUERY       26
#define LANGUAGE_STRING_PRINT       27
#define LANGUAGE_STRING_COPY        28
#define LANGUAGE_STRING_PASTE       29
#define LANGUAGE_STRING_NEW         30
#define LANGUAGE_STRING_DEL         31

#define LANGUAGE_STRING_RENAME      32
#define LANGUAGE_STRING_DISCARD     33

#define LANGUAGE_STRING_ADVANCE     34
#define LANGUAGE_STRING_RESET       35

#define LANGUAGE_STRING_CONTROL     36
#define LANGUAGE_STRING_ITEM        37
#define LANGUAGE_STRING_UNIT        38
#define LANGUAGE_STRING_LOWLIMIT    39
#define LANGUAGE_STRING_HIGHLIMIT   40
#define LANGUAGE_STRING_RESULT      41
#define LANGUAGE_STRING_REMARK      42
#define LANGUAGE_STRING_AUTHORITY   43
#define LANGUAGE_STRING_ENTER2      44

#define LANGUAGE_STRING_FIRST       45
#define LANGUAGE_STRING_LAST        46
#define LANGUAGE_STRING_PREV        47
#define LANGUAGE_STRING_NEXT        48
#define LANGUAGE_STRING_PREV_PAGE   49
#define LANGUAGE_STRING_NEXT_PAGE   50
#define LANGUAGE_STRING_MONITOR     51
#define LANGUAGE_STRING_EXIT        52

#define LANGUAGE_STRING_DISCARD_QUIT    53
#define LANGUAGE_STRING_SAVE_QUIT       54

#define LANGUAGE_STRING_IMPORT      55
#define LANGUAGE_STRING_EXPORT      56


char*   AfxTransrateString(int nCode, char* pBuffer = NULL);
char*   AfxTransrateStringEx(int nCode, int nShortcutKeyCh, char* pBuffer = NULL);

int   TransrateKey(CObject* pCurObj);
BOOL  IsNumberKey(int nKey,BOOL bDot);

DWORD BindDateFromLong(int nYear,int nMonth,int nDay);
DWORD BindTimeFromLong(int nHour,int nMinute,int nSecond);
BOOL  DivideDateFromLong(DWORD dwDate,int *pnYear,int *pnMonth,int *pnDay);
BOOL  DivideTimeFromLong(DWORD dwTime,int *pnHour,int *pnMinute,int *pnSecond);

void  FAR GetTime(struct time* pTime);
void  FAR GetDate(struct date* pDate);

void AfxTaskDialog();
void AfxDeviceDialog();


BYTE* AfxGetIpSelfAddr();
BYTE* AfxGetIpPeerAddr();
BYTE* AfxGetIpMaskAddr();
BYTE* AfxGetIpGatewayAddr();
BYTE* AfxGetNICAddr();
BYTE* AfxGetHostName();
BYTE* AfxGetPeerName();
BOOL  AfxGetIPGatewayMaybe();


int  AfxGetBGIDevice();
WORD AfxGetVersion();
void SetWindowCenterEnable(BOOL bEnable);
BOOL GetWindowCenterEnable();
BOOL AfxInstallSail(char* pTargetName, char* pConfigName, BOOL bDisplay);

void MoveScreenDC (int nLeft, int nTop, int nWidth, int nHeight, int nNewLeft, int nNewTop);
void SetExitCodeForWindow(int nExitCode);

#define REGISTER_WINSAIL_IME() \
   ::AfxRegisterIme(::GlobalImeManager);


#define REGISTER_WINSAIL_TCPIP() \
	::AfxRegisterNetcardEntry(::GlobalInitSocket,	\
		::GlobalCloseSocket, ::EthernetEntry)

#define REGISTER_WINSAIL_MULTITASK() \
	::AfxRegisterMultitaskEntry(::KernelInitProcess,	\
		::KernelCloseProcess, ::__MultiTaskDelay)


BOOL GlobalImeManager(CObject** pImeCtrl,
     CObject* pParent, BOOL bMalloc);

//Register Ime Entry
BOOL AfxRegisterIme(BOOL (*pFc)(CObject**,
     CObject*, BOOL) = NULL);

//Register Tcpip Entry
BOOL AfxRegisterNetcardEntry(
	BOOL (*pSocketInitFc)() = ::GlobalInitSocket,
		BOOL (*pSocketCloseFc)() = ::GlobalCloseSocket,
	BOOL (*pSocketLoopFc)(BOOL, BOOL, BOOL) = ::EthernetEntry);


//Register Multask Entry
BOOL AfxRegisterMultitaskEntry(
		BOOL (*pMultitaskInitFc)() = ::KernelInitProcess,
		BOOL (*pMultitaskCloseFc)() = ::KernelCloseProcess,
		void (*pMultitaskDelayFc)(WORD wMilliSeconds) = ::__MultiTaskDelay);

BOOL AfxMousePressKey(WORD wTimeout);
int AfxSetEllipseButton(BOOL bEllipse);
BOOL AfxIsWindowVM();
BOOL AfxGetBmpDialog();

void AfxSetTestTimes(int nTimes);
void AfxSetJudgeRight(int nLogical);
void AfxSetGotoMonitor(BOOL bGotoMonitor);
void AfxSetDoorMonitor(BOOL bSave);
void AfxSetSaveDatabase(BOOL bSave);
void AfxSetResistanceSort(BOOL bSave);
void AfxSetAdvanceUser0(BOOL bSave);
void AfxSetAdvanceUser1(BOOL bSave);
void AfxSetAdvanceUser2(BOOL bSave);
void AfxSetAdvanceUser3(BOOL bSave);
void AfxSetAdvanceUser4(BOOL bSave);
void AfxSetAdvanceUser5(BOOL bSave);

void AfxSetAlertBuzzer(BOOL bBuzzer);
void AfxSetAlertSpeaker(BOOL bSpeaker);
void AfxSetAlertDialogBox(BOOL bDialogBox);
void AfxSetAlertContinue(BOOL bContinue);

int  AfxGetTestTimes();
int  AfxGetJudgeRight();
BOOL AfxGetGotoMonitor();
BOOL AfxGetDoorMonitor();
BOOL AfxGetSaveDatabase();
BOOL AfxGetResistanceSort();
BOOL AfxGetAdvanceUser0();
BOOL AfxGetAdvanceUser1();
BOOL AfxGetAdvanceUser2();
BOOL AfxGetAdvanceUser3();
BOOL AfxGetAdvanceUser4();
BOOL AfxGetAdvanceUser5();

BOOL AfxGetAlertBuzzer();
BOOL AfxGetAlertSpeaker();
BOOL AfxGetAlertDialogBox();
BOOL AfxGetAlertContinue();

BYTE  FAR AfxSetIRQMask(BYTE byMask);
BYTE  FAR AfxAddIRQMask(BYTE byMask);

BOOL DivideFulPathToDirAndName(const char* strPath, char* strDir, char* strName);

BOOL FAR AfxColorDialog(int* pnColor, BOOL* pbSet, int* pnConnect, BOOL bTransrate);
//void AfxDebugGraph(WORD* pwData, int nCount);
char* AfxGetSystemTempBuffer256();
BOOL AfxIsExistFile(const char* pStrFile);
DWORD AfxBindDosMCB(BYTE* pNowMemory);
void   AfxSetMessageBoxColor(int nForeColor, int nBackColor,
	BOOL bOnlyRestoreDefault, BOOL bTwinkleTitle);
void   AfxSetMessageButtonColor(int nForeColor, int nBackColor);

void AfxClearMessageBoxKeyFc();
BOOL AfxAddMessageBoxKeyFc(WORD wKey, void FAR (*pFc)(CObject*));

int     FAR AfxGetPushMessageBoxTime();
DWORD FAR AfxGetMessageBoxSuperSecond();
void    FAR  (*AfxGetSuperTimeFc())(CObject*);


void SetSpline3Fc(int (*pFc)(SPLINEPOINT* pPoint));

int  AfxGetObjectMouseMoveX();
int  AfxGetObjectMouseMoveY();
void AfxClearObjectKouseMoveFlags();

DWORD AfxGetCurrentTimerCounter();
BOOL AfxJudgeOverTimerCounter(DWORD dwTime1, DWORD dwTime2, float fSecond);
BOOL AfxJudgeOverTimerCounterEx(DWORD dwTime1, float fSecond);

CDialog*  AfxDebugGraphWaveEx(int nChannelCount);

void AfxPublic_ComboBoxEx(CComboBox* pComboBox);
void AfxSetComboMouseEnterFc(void (*pFc)(CComboBox*));
void (*AfxGetComboMouseEnterFc())(CComboBox *);

void AfxPublic_EditEx(CEdit* pEdit);
void AfxSetEditMouseEnterFc(void (*pFc)(CEdit*));
void (*AfxGetEditMouseEnterFc())(CEdit *);

BOOL AfxGetWindowControlOnlyOne();
void AfxSetWindowControlFc(void (*pFc)(CWindow*), BOOL bOnlyOne);
void AfxSetWindowOnDrawFc(void (*pFc)(CWindow*));
void (*AfxGetWindowControlFc())(CWindow *pWindow);
void (*AfxGetWindowOnDrawFc())(CWindow *pWindow);


#include <Wizard.h>

#endif
