void CToolsPanelImage2::InitToolTips()
{
	CToolsCtlPanel::InitToolTips();

	AddToolTip(IDC_IME_COLORART_CHECK);
	AddToolTip(IDC_IME_CROP_CHECK);
	AddToolTip(IDC_IME_FLIP_CHECK);
	AddToolTip(IDC_IME_CONTRAST_CHECK);
	AddToolTip(IDC_IME_TINT_CHECK);
	AddToolTip(IDC_IME_REDEYE_CHECK);
	AddToolTip(IDC_IME_BORDERS_CHECK);
	AddToolTip(IDC_IME_EFFECTS_CHECK);

}
LRESULT CToolsCtlPanelGraphics::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	CToolsCtlPanelCommon::InitToolCtrls(true);
	CToolsCtlPanelCommon::InitLineCombos(false);
	CToolsCtlPanelCommon::InitToolTips();

	m_ComboShapeName.InitDialog(GetDlgItem(IDC_SHAPE_NAME));
	int iShapeCount = CShape::GetShapeCount();
	for (int i = 0; i < iShapeCount; i++)
		m_ComboShapeName.AddString(CShape::GetShapeName(i));
	m_ComboShapeName.SetCurSel(-1);

	AddToolTip(IDC_SHAPE_NAME);
	bHandled = true;
	return S_OK;
}
//------------------------------------------------------------------------------
bool SettingPageMyINFO::CreateSettingPage(HWND hOwner) {
    CreateHWND(hOwner);
    
    if(bCreated == false) {
        return false;
    }

    RECT rcThis = { 0 };
    ::GetWindowRect(m_hWnd, &rcThis);

    int iGBinGBinGB = (rcThis.right - rcThis.left) - 25;
    int iGBinGBinGBEDT = (rcThis.right - rcThis.left) - 41;

    int iPosY = (2 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + 1 + clsGuiSettingManager::iEditHeight + (2 * clsGuiSettingManager::iOneLineGB) + 12;

    hWndPageItems[GB_DESCRIPTION_TAG] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_DESCRIPTION_TAG], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, 0, iFullGB, iPosY, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[BTN_REPORT_SUSPICIOUS_TAG] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REPORT_BAD_TAGS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_REPORT_SUSPICIOUS_TAG], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_REPORT_SUSPICIOUS_TAG] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[GB_NO_TAG_ACTION] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_NO_TAG_ACTION], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        5, clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iCheckHeight + 1, iGBinGB, clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + (2 * clsGuiSettingManager::iOneLineGB) + 7, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[CB_NO_TAG_ACTION] = ::CreateWindowEx(0, WC_COMBOBOX, "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST,
        13, (2 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + 1, iGBinGBEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)CB_NO_TAG_ACTION, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[CB_NO_TAG_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_ACCEPT]);
    ::SendMessage(hWndPageItems[CB_NO_TAG_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_REJECT]);
    ::SendMessage(hWndPageItems[CB_NO_TAG_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_REDIR]);
    ::SendMessage(hWndPageItems[CB_NO_TAG_ACTION], CB_SETCURSEL, clsSettingManager::mPtr->i16Shorts[SETSHORT_NO_TAG_OPTION], 0);

    hWndPageItems[GB_NO_TAG_MESSAGE] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_MSG_TO_SND], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        10, (2 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + clsGuiSettingManager::iEditHeight + 3, iGBinGBinGB, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_NO_TAG_MESSAGE] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_NO_TAG_MSG], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        18, (3 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + clsGuiSettingManager::iEditHeight + 3, iGBinGBinGBEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_NO_TAG_MESSAGE, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_NO_TAG_MESSAGE], EM_SETLIMITTEXT, 256, 0);

    hWndPageItems[GB_NO_TAG_REDIRECT] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REDIRECT_ADDRESS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        10, (2 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + clsGuiSettingManager::iEditHeight + 3 + clsGuiSettingManager::iOneLineGB, iGBinGBinGB, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_NO_TAG_REDIRECT] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_NO_TAG_REDIR_ADDRESS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        18, (3 * clsGuiSettingManager::iGroupBoxMargin) + clsGuiSettingManager::iCheckHeight + clsGuiSettingManager::iEditHeight + 3 + clsGuiSettingManager::iOneLineGB, iGBinGBinGBEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_NO_TAG_REDIRECT, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_NO_TAG_REDIRECT], EM_SETLIMITTEXT, 256, 0);
    AddToolTip(hWndPageItems[EDT_NO_TAG_REDIRECT], clsLanguageManager::mPtr->sTexts[LAN_REDIRECT_HINT]);

    hWndPageItems[GB_MYINFO_PROCESSING] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_MYINFO_PROCESSING], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, (2 * clsGuiSettingManager::iGroupBoxMargin) + (2 * clsGuiSettingManager::iEditHeight) + 10 + (6 * clsGuiSettingManager::iCheckHeight) + 28, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[LBL_ORIGINAL_MYINFO] = ::CreateWindowEx(0, WC_STATIC, clsLanguageManager::mPtr->sTexts[LAN_SEND_LONG_MYINFO], WS_CHILD | WS_VISIBLE | SS_LEFT,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin + ((clsGuiSettingManager::iEditHeight - clsGuiSettingManager::iTextHeight) / 2), ((rcThis.right - rcThis.left) - 21) / 2, clsGuiSettingManager::iTextHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[CB_ORIGINAL_MYINFO_ACTION] = ::CreateWindowEx(0, WC_COMBOBOX, "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST,
        (((rcThis.right - rcThis.left) - 21) / 2) + 13, iPosY + clsGuiSettingManager::iGroupBoxMargin, (rcThis.right - rcThis.left) - ((((rcThis.right - rcThis.left) - 21) / 2) + 26), clsGuiSettingManager::iEditHeight,
        m_hWnd, (HMENU)CB_ORIGINAL_MYINFO_ACTION, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[CB_ORIGINAL_MYINFO_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_FULL_MYINFO_ALL]);
    ::SendMessage(hWndPageItems[CB_ORIGINAL_MYINFO_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_FULL_MYINFO_PROFILE]);
    ::SendMessage(hWndPageItems[CB_ORIGINAL_MYINFO_ACTION], CB_ADDSTRING, 0, (LPARAM)clsLanguageManager::mPtr->sTexts[LAN_FULL_MYINFO_NONE]);
    ::SendMessage(hWndPageItems[CB_ORIGINAL_MYINFO_ACTION], CB_SETCURSEL, clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION], 0);
    AddToolTip(hWndPageItems[CB_ORIGINAL_MYINFO_ACTION], clsLanguageManager::mPtr->sTexts[LAN_MYINFO_TO_HINT]);

    iPosY += clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + 2;

    hWndPageItems[GB_MODIFIED_MYINFO_OPTIONS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_OPTIONS_FOR_SHORT_MYINFO], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        5, iPosY, iGBinGB, clsGuiSettingManager::iGroupBoxMargin + (6 * clsGuiSettingManager::iCheckHeight) + 15 + 8, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[BTN_REMOVE_DESCRIPTION] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REMOVE_DESCRIPTION], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_REMOVE_DESCRIPTION], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_STRIP_DESCRIPTION] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[BTN_REMOVE_TAG] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REMOVE_TAG], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iCheckHeight + 3, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_REMOVE_TAG], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_STRIP_TAG] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[BTN_REMOVE_CONNECTION] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REMOVE_CONNECTION], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin + (2 * clsGuiSettingManager::iCheckHeight) + 6, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_REMOVE_CONNECTION], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_STRIP_CONNECTION] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[BTN_REMOVE_EMAIL] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_REMOVE_EMAIL], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin + (3 * clsGuiSettingManager::iCheckHeight) + 9, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_REMOVE_EMAIL], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_STRIP_EMAIL] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[BTN_MODE_TO_MYINFO] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_MODE_TO_MYINFO], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin + (4 * clsGuiSettingManager::iCheckHeight) + 12, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_MODE_TO_MYINFO], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_MODE_TO_MYINFO] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    hWndPageItems[BTN_MODE_TO_DESCRIPTION] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_MODE_TO_DESCR], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        13, iPosY + clsGuiSettingManager::iGroupBoxMargin + (5 * clsGuiSettingManager::iCheckHeight) + 15, iGBinGBEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_MODE_TO_DESCRIPTION], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_MODE_TO_DESCRIPTION] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += clsGuiSettingManager::iGroupBoxMargin + (6 * clsGuiSettingManager::iCheckHeight) + 15 + 8;

    hWndPageItems[LBL_MINUTES_BEFORE_ACCEPT_NEW_MYINFO] = ::CreateWindowEx(0, WC_STATIC, clsLanguageManager::mPtr->sTexts[LAN_DONT_SEND_MYINFO_CHANGES], WS_CHILD | WS_VISIBLE | SS_LEFT,
        8, iPosY + 5 + ((clsGuiSettingManager::iEditHeight - clsGuiSettingManager::iTextHeight) / 2), ScaleGui(320), clsGuiSettingManager::iTextHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_MINUTES_BEFORE_ACCEPT_NEW_MYINFO] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER | ES_AUTOHSCROLL | ES_RIGHT,
        ScaleGui(320) + 13, iPosY + 5, (rcThis.right - rcThis.left) - (ScaleGui(320) + clsGuiSettingManager::iUpDownWidth + 26), clsGuiSettingManager::iEditHeight,
         m_hWnd, (HMENU)EDT_MINUTES_BEFORE_ACCEPT_NEW_MYINFO, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_MINUTES_BEFORE_ACCEPT_NEW_MYINFO], EM_SETLIMITTEXT, 3, 0);

    AddUpDown(hWndPageItems[UD_MINUTES_BEFORE_ACCEPT_NEW_MYINFO], (rcThis.right - rcThis.left) - clsGuiSettingManager::iUpDownWidth - 13, iPosY + 5, clsGuiSettingManager::iUpDownWidth, clsGuiSettingManager::iEditHeight,
        (LPARAM)MAKELONG(999, 0), (WPARAM)hWndPageItems[EDT_MINUTES_BEFORE_ACCEPT_NEW_MYINFO], (LPARAM)MAKELONG(clsSettingManager::mPtr->i16Shorts[SETSHORT_MYINFO_DELAY], 0));

    for(uint8_t ui8i = 0; ui8i < (sizeof(hWndPageItems) / sizeof(hWndPageItems[0])); ui8i++) {
        if(hWndPageItems[ui8i] == NULL) {
            return false;
        }

        ::SendMessage(hWndPageItems[ui8i], WM_SETFONT, (WPARAM)clsGuiSettingManager::hFont, MAKELPARAM(TRUE, 0));
    }

    ::EnableWindow(hWndPageItems[EDT_NO_TAG_MESSAGE], clsSettingManager::mPtr->i16Shorts[SETSHORT_NO_TAG_OPTION] != 0 ? TRUE : FALSE);
    ::EnableWindow(hWndPageItems[EDT_NO_TAG_REDIRECT], clsSettingManager::mPtr->i16Shorts[SETSHORT_NO_TAG_OPTION] == 2 ? TRUE : FALSE);
    ::EnableWindow(hWndPageItems[BTN_REPORT_SUSPICIOUS_TAG], clsSettingManager::mPtr->i16Shorts[SETSHORT_NO_TAG_OPTION] == 0 ? TRUE : FALSE);

    ::EnableWindow(hWndPageItems[BTN_REMOVE_DESCRIPTION], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);
    ::EnableWindow(hWndPageItems[BTN_REMOVE_TAG], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);
    ::EnableWindow(hWndPageItems[BTN_REMOVE_CONNECTION], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);
    ::EnableWindow(hWndPageItems[BTN_REMOVE_EMAIL], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);
    ::EnableWindow(hWndPageItems[BTN_MODE_TO_MYINFO], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);
    ::EnableWindow(hWndPageItems[BTN_MODE_TO_DESCRIPTION], clsSettingManager::mPtr->i16Shorts[SETSHORT_FULL_MYINFO_OPTION] == 0 ? FALSE : TRUE);

    clsGuiSettingManager::wpOldNumberEditProc = (WNDPROC)::SetWindowLongPtr(hWndPageItems[EDT_MINUTES_BEFORE_ACCEPT_NEW_MYINFO], GWLP_WNDPROC, (LONG_PTR)NumberEditProc);

	return true;
}
HWND CPagePanel::Create(HWND hWndParent)
{
	_ASSERTE(m_hWnd == NULL);
	_AtlWinModule.AddCreateWndData(&m_thunk.cd, (CDialogImplBase*)this);

	HDC hDC = ::CreateIC("DISPLAY", NULL, NULL, NULL);
	int nLogPixelsY = ::GetDeviceCaps(hDC, LOGPIXELSY);
	::DeleteDC(hDC);

	HINSTANCE hInst = _AtlBaseModule.GetResourceInstance();
	LPCSTR idDialog = MAKEINTRESOURCE(IDD);
	HWND hWnd = NULL;
	if (nLogPixelsY > 96)
	{
		do // A convenient block we can break out of
		{
			HRSRC hResource = ::FindResource(hInst, idDialog, RT_DIALOG);
			if (!hResource)
				break;
			HGLOBAL hTemplate = ::LoadResource(hInst, hResource);
			if (!hTemplate)
				break;
			LPVOID pTemplate = ::LockResource(hTemplate);
			if (pTemplate)
			{
				int nSize = ::SizeofResource(hInst, hResource);
				LPVOID pNewTemplate = (DLGTEMPLATE*)malloc(nSize);
				if (pNewTemplate)
				{
					memcpy(pNewTemplate, pTemplate, nSize);
					WORD* pwPointsize = (WORD*)_DialogSizeHelper::GetFontSizeField((DLGTEMPLATE*)pNewTemplate);
					if (pwPointsize)
						*pwPointsize = ((*pwPointsize * 96) / nLogPixelsY);

					hWnd = ::CreateDialogIndirectParam(hInst, (DLGTEMPLATE*)pNewTemplate, hWndParent, (DLGPROC)CPagePanel::StartDialogProc, NULL);

					free(pNewTemplate);
				}

				UnlockResource(hTemplate);
			}

			::FreeResource(hTemplate);

		} while (0);
	}

	if (!hWnd)
		hWnd = ::CreateDialogParam(hInst, idDialog, hWndParent, (DLGPROC)CPagePanel::StartDialogProc, NULL);

	m_ToolTip.Create(m_hWnd);
	m_ToolTip.Activate(true);
	DWORD c = m_ToolTip.GetDelayTime(TTDT_AUTOPOP); // How long if remains stationary
	DWORD a = m_ToolTip.GetDelayTime(TTDT_INITIAL); // before coming up
	DWORD b = m_ToolTip.GetDelayTime(TTDT_RESHOW); // between reappearances
//j	m_ToolTip.SetDelayTime(TTDT_INITIAL, 250);

	AddToolTip(IDC_DOC_PAGENAV);
	AddToolTip(IDC_DOC_PAGEADD);
	AddToolTip(IDC_DOC_PAGEDELETE);
	AddToolTip(IDC_DOC_PAGEPREV);
	AddToolTip(IDC_DOC_PAGENEXT);
	AddToolTip(IDC_BTN_CARD, IDS_BTN_VIEWCARD);
	AddToolTip(IDC_BTN_ENVELOPE, IDS_BTN_VIEWENV);

	_ASSERTE(m_hWnd == hWnd);
	return hWnd;
}
//------------------------------------------------------------------------------
bool SettingPageAdvanced::CreateSettingPage(HWND hOwner) {
    CreateHWND(hOwner);
    
    if(m_bCreated == false) {
        return false;
    }

    RECT rcThis = { 0 };
    ::GetWindowRect(m_hWnd, &rcThis);

    int iPosY = GuiSettingManager::m_iGroupBoxMargin + (4 * GuiSettingManager::m_iCheckHeight) + 17;

    m_hWndPageItems[GB_HUB_STARTUP_AND_TRAY] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_HUB_STARTUP_AND_TRAY_ICON],
        WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 0, 0, m_iFullGB, iPosY, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[BTN_AUTO_START] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_HUB_AUTO_START], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, GuiSettingManager::m_iGroupBoxMargin, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_AUTO_START], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_AUTO_START] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_CHECK_FOR_UPDATE] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_UPDATE_CHECK_ON_STARTUP], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, GuiSettingManager::m_iGroupBoxMargin + GuiSettingManager::m_iCheckHeight + 3, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_CHECK_FOR_UPDATE], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_CHECK_NEW_RELEASES] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_ENABLE_TRAY_ICON] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_ENABLE_TRAY_ICON], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, GuiSettingManager::m_iGroupBoxMargin + (2 * GuiSettingManager::m_iCheckHeight) + 6, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, (HMENU)BTN_ENABLE_TRAY_ICON, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_ENABLE_TRAY_ICON], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_TRAY_ICON] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_MINIMIZE_ON_STARTUP] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_MINIMIZE_ON_STARTUP], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, GuiSettingManager::m_iGroupBoxMargin + (3 * GuiSettingManager::m_iCheckHeight) + 9, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_MINIMIZE_ON_STARTUP], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_START_MINIMIZED] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[GB_HUB_COMMANDS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_HUB_COMMANDS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, m_iFullGB, GuiSettingManager::m_iOneLineOneChecksGB, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[LBL_PREFIXES_FOR_HUB_COMMANDS] = ::CreateWindowEx(0, WC_STATIC, LanguageManager::m_Ptr->m_sTexts[LAN_PREFIXES_FOR_HUB_CMDS],
        WS_CHILD | WS_VISIBLE | SS_LEFT, 8, iPosY + GuiSettingManager::m_iGroupBoxMargin + ((GuiSettingManager::m_iEditHeight - GuiSettingManager::m_iTextHeight) / 2), ScaleGui(350), GuiSettingManager::m_iTextHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[EDT_PREFIXES_FOR_HUB_COMMANDS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, SettingManager::m_Ptr->m_sTexts[SETTXT_CHAT_COMMANDS_PREFIXES], WS_CHILD |
        WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL, ScaleGui(350) + 13, iPosY + GuiSettingManager::m_iGroupBoxMargin, (rcThis.right - rcThis.left) - (ScaleGui(350) + 26), GuiSettingManager::m_iEditHeight,
        m_hWnd, (HMENU)EDT_PREFIXES_FOR_HUB_COMMANDS, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[EDT_PREFIXES_FOR_HUB_COMMANDS], EM_SETLIMITTEXT, 5, 0);

    m_hWndPageItems[BTN_REPLY_TO_HUB_COMMANDS_IN_PM] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_REPLY_HUB_CMDS_PM], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + GuiSettingManager::m_iEditHeight + 4, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_REPLY_TO_HUB_COMMANDS_IN_PM], BM_SETCHECK,
        (SettingManager::m_Ptr->m_bBools[SETBOOL_REPLY_TO_HUB_COMMANDS_AS_PM] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += GuiSettingManager::m_iOneLineOneChecksGB;

    m_hWndPageItems[GB_SCRIPTING] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_SCRIPTING], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, m_iFullGB, GuiSettingManager::m_iGroupBoxMargin + (3 * GuiSettingManager::m_iCheckHeight) + 14, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[BTN_ENABLE_SCRIPTING] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_ENABLE_SCRIPTING], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, (HMENU)BTN_ENABLE_SCRIPTING, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_ENABLE_SCRIPTING], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_SCRIPTING] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_STOP_SCRIPT_ON_ERROR] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_STOP_SCRIPT_ON_ERR], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + GuiSettingManager::m_iCheckHeight + 3, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_STOP_SCRIPT_ON_ERROR], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_STOP_SCRIPT_ON_ERROR] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_SAVE_SCRIPT_ERRORS_TO_LOG] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_LOG_SCRIPT_ERRORS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + (2 * GuiSettingManager::m_iCheckHeight) + 6, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_SAVE_SCRIPT_ERRORS_TO_LOG], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_LOG_SCRIPT_ERRORS] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += GuiSettingManager::m_iGroupBoxMargin + (3 * GuiSettingManager::m_iCheckHeight) + 14;

    m_hWndPageItems[GB_KICK_MESSAGES] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_KICK_MESSAGES], WS_CHILD | WS_VISIBLE |
        BS_GROUPBOX, 0, iPosY, m_iFullGB, m_iTwoChecksGB, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[BTN_FILTER_KICK_MESSAGES] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_FILTER_KICKS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, (HMENU)BTN_FILTER_KICK_MESSAGES, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_FILTER_KICK_MESSAGES], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_FILTER_KICK_MESSAGES] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_SEND_KICK_MESSAGES_TO_OPS] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_FILTERED_KICKS_TO_OPS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + GuiSettingManager::m_iCheckHeight + 3, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_SEND_KICK_MESSAGES_TO_OPS], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_SEND_KICK_MESSAGES_TO_OPS] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += m_iTwoChecksGB;

    m_hWndPageItems[GB_STATUS_MESSAGES] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_STATUS_MESSAGES], WS_CHILD | WS_VISIBLE |
        BS_GROUPBOX, 0, iPosY, m_iFullGB, m_iTwoChecksGB, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[BTN_SEND_STATUS_MESSAGES_TO_OPS] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_SEND_STATUS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, (HMENU)BTN_SEND_STATUS_MESSAGES_TO_OPS, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_SEND_STATUS_MESSAGES_TO_OPS], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_SEND_STATUS_MESSAGES] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    m_hWndPageItems[BTN_SEND_STATUS_MESSAGES_IN_PM] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_SEND_STATUS_PM], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + GuiSettingManager::m_iCheckHeight + 3, m_iFullEDT, GuiSettingManager::m_iCheckHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[BTN_SEND_STATUS_MESSAGES_IN_PM], BM_SETCHECK, (SettingManager::m_Ptr->m_bBools[SETBOOL_SEND_STATUS_MESSAGES_AS_PM] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += m_iTwoChecksGB;

    m_hWndPageItems[GB_ADMIN_NICK] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_ADMIN_NICK], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, m_iFullGB, GuiSettingManager::m_iOneLineGB, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[EDT_ADMIN_NICK] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, SettingManager::m_Ptr->m_sTexts[SETTXT_ADMIN_NICK], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin, m_iFullEDT, GuiSettingManager::m_iEditHeight, m_hWnd, (HMENU)EDT_ADMIN_NICK, ServerManager::m_hInstance, nullptr);
    ::SendMessage(m_hWndPageItems[EDT_ADMIN_NICK], EM_SETLIMITTEXT, 64, 0);

#if defined(_WITH_SQLITE) || defined(_WITH_POSTGRES) || defined(_WITH_MYSQL)
	iPosY += GuiSettingManager::m_iOneLineGB;

    m_hWndPageItems[GB_DATABASE_SUPPORT] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_DATABASE_SUPPORT], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, m_iFullGB, GuiSettingManager::m_iOneLineGB, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[CHK_ENABLE_DATABASE] = ::CreateWindowEx(0, WC_BUTTON, LanguageManager::m_Ptr->m_sTexts[LAN_ENABLE_DATABASE], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + GuiSettingManager::m_iGroupBoxMargin + ((GuiSettingManager::m_iEditHeight - GuiSettingManager::m_iCheckHeight) / 2), int(m_iFullEDT * 0.4) - 2, GuiSettingManager::m_iCheckHeight, m_hWnd, (HMENU)CHK_ENABLE_DATABASE, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[LBL_REMOVE_OLD_RECORDS] = ::CreateWindowEx(0, WC_STATIC, LanguageManager::m_Ptr->m_sTexts[LAN_REMOVE_OLD_RECORDS], WS_CHILD | WS_VISIBLE | SS_RIGHT, int(m_iFullEDT * 0.4)+10, iPosY + GuiSettingManager::m_iGroupBoxMargin + ((GuiSettingManager::m_iEditHeight - GuiSettingManager::m_iTextHeight) / 2), 
		((m_iFullEDT - (int((m_iFullEDT/2)*0.2) + GuiSettingManager::m_iUpDownWidth)) + 8) - (int(m_iFullEDT * 0.4)+15), GuiSettingManager::m_iTextHeight, m_hWnd, nullptr, ServerManager::m_hInstance, nullptr);

    m_hWndPageItems[EDT_REMOVE_OLD_RECORDS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, nullptr, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER | ES_AUTOHSCROLL | ES_RIGHT,
        (m_iFullEDT - (int((m_iFullEDT/2)*0.2) + GuiSettingManager::m_iUpDownWidth)) + 8, iPosY + GuiSettingManager::m_iGroupBoxMargin, int((m_iFullEDT/2) * 0.2), GuiSettingManager::m_iEditHeight,
        m_hWnd, (HMENU)EDT_REMOVE_OLD_RECORDS, ServerManager::m_hInstance, nullptr);

    AddUpDown(m_hWndPageItems[UD_REMOVE_OLD_RECORDS], (m_iFullEDT-GuiSettingManager::m_iUpDownWidth) + 8, iPosY + GuiSettingManager::m_iGroupBoxMargin, GuiSettingManager::m_iUpDownWidth, GuiSettingManager::m_iEditHeight, (LPARAM)MAKELONG(32767, 0),
        (WPARAM)m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], (LPARAM)MAKELONG(SettingManager::m_Ptr->m_i16Shorts[SETSHORT_DB_REMOVE_OLD_RECORDS], 0));
#endif

    for(uint8_t ui8i = 0; ui8i < (sizeof(m_hWndPageItems) / sizeof(m_hWndPageItems[0])); ui8i++) {
        if(m_hWndPageItems[ui8i] == nullptr) {
            return false;
        }

        ::SendMessage(m_hWndPageItems[ui8i], WM_SETFONT, (WPARAM)GuiSettingManager::m_hFont, MAKELPARAM(TRUE, 0));
    }

    ::EnableWindow(m_hWndPageItems[BTN_MINIMIZE_ON_STARTUP], SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_TRAY_ICON] == true ? TRUE : FALSE);

    ::EnableWindow(m_hWndPageItems[BTN_STOP_SCRIPT_ON_ERROR], SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_SCRIPTING] == true ? TRUE : FALSE);
    ::EnableWindow(m_hWndPageItems[BTN_SAVE_SCRIPT_ERRORS_TO_LOG], SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_SCRIPTING] == true ? TRUE : FALSE);

    ::EnableWindow(m_hWndPageItems[BTN_SEND_KICK_MESSAGES_TO_OPS], SettingManager::m_Ptr->m_bBools[SETBOOL_FILTER_KICK_MESSAGES] == true ? TRUE : FALSE);

    ::EnableWindow(m_hWndPageItems[BTN_SEND_STATUS_MESSAGES_IN_PM], SettingManager::m_Ptr->m_bBools[SETBOOL_SEND_STATUS_MESSAGES] == true ? TRUE : FALSE);

#if defined(_WITH_SQLITE) || defined(_WITH_POSTGRES) || defined(_WITH_MYSQL)
	if(SettingManager::m_Ptr->m_bBools[SETBOOL_ENABLE_DATABASE] == true) {
		::SendMessage(m_hWndPageItems[CHK_ENABLE_DATABASE], BM_SETCHECK, BST_CHECKED, 0);

		::EnableWindow(m_hWndPageItems[LBL_REMOVE_OLD_RECORDS], TRUE);
		::EnableWindow(m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], TRUE);
		::EnableWindow(m_hWndPageItems[UD_REMOVE_OLD_RECORDS], TRUE);
	} else {
		::SendMessage(m_hWndPageItems[CHK_ENABLE_DATABASE], BM_SETCHECK, BST_UNCHECKED, 0);

		::EnableWindow(m_hWndPageItems[LBL_REMOVE_OLD_RECORDS], FALSE);
		::EnableWindow(m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], FALSE);
		::EnableWindow(m_hWndPageItems[UD_REMOVE_OLD_RECORDS], FALSE);
	}

	::SendMessage(m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], EM_SETLIMITTEXT, 5, 0);
	AddToolTip(m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], LanguageManager::m_Ptr->m_sTexts[LAN_ZERO_DISABLED]);
#endif

#if defined(_WITH_SQLITE) || defined(_WITH_POSTGRES) || defined(_WITH_MYSQL)
	GuiSettingManager::m_wpOldButtonProc = (WNDPROC)::SetWindowLongPtr(m_hWndPageItems[CHK_ENABLE_DATABASE], GWLP_WNDPROC, (LONG_PTR)EnableDbCheckProc);
	GuiSettingManager::m_wpOldEditProc = (WNDPROC)::SetWindowLongPtr(m_hWndPageItems[EDT_REMOVE_OLD_RECORDS], GWLP_WNDPROC, (LONG_PTR)EditProc);
#else
    GuiSettingManager::m_wpOldEditProc = (WNDPROC)::SetWindowLongPtr(m_hWndPageItems[EDT_ADMIN_NICK], GWLP_WNDPROC, (LONG_PTR)EditProc);
#endif
	return true;
}
//------------------------------------------------------------------------------
bool SettingPageGeneral::CreateSettingPage(HWND hOwner) {
    CreateHWND(hOwner);

    if(bCreated == false) {
        return false;
    }

    RECT rcThis = { 0 };
    ::GetWindowRect(m_hWnd, &rcThis);

    iFullGB = (rcThis.right - rcThis.left) - 5;
    iFullEDT = (rcThis.right - rcThis.left) - 21;
    iGBinGB = (rcThis.right - rcThis.left) - 15;
    iGBinGBEDT = (rcThis.right - rcThis.left) - 31;

    int iPosY = clsGuiSettingManager::iOneLineGB;

	int iHeight = iTwoChecksGB + clsGuiSettingManager::iGroupBoxMargin + (2 * clsGuiSettingManager::iCheckHeight) + 4 + clsGuiSettingManager::iOneLineGB + 5 + clsGuiSettingManager::iOneLineTwoChecksGB + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iCheckHeight + (2 * clsGuiSettingManager::iOneLineGB) + 6 +
		clsGuiSettingManager::iGroupBoxMargin + (3 * clsGuiSettingManager::iCheckHeight) + 14 + 3;
	
	iHeight = iHeight > ((3 * iOneLineTwoGroupGB) + clsGuiSettingManager::iOneLineGB + 3) ? iHeight : ((3 * iOneLineTwoGroupGB) + clsGuiSettingManager::iOneLineGB + 3);
	
    ::SetWindowPos(m_hWnd, NULL, 0, 0, rcThis.right, iHeight, SWP_NOMOVE | SWP_NOZORDER);

    hWndPageItems[GB_LANGUAGE] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_LANGUAGE], WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 0, 0, ScaleGui(297), clsGuiSettingManager::iOneLineGB,
        m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[CB_LANGUAGE] = ::CreateWindowEx(0, WC_COMBOBOX, "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 8, clsGuiSettingManager::iGroupBoxMargin, ScaleGui(297) - 16, clsGuiSettingManager::iEditHeight,
        m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[GB_MAX_USERS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_MAX_USERS_LIMIT], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        ScaleGui(297) + 5, 0, (rcThis.right - rcThis.left) - (ScaleGui(297) + 10), clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_MAX_USERS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, "", WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER | ES_AUTOHSCROLL | ES_RIGHT,
        ScaleGui(297) + 13, clsGuiSettingManager::iGroupBoxMargin, (rcThis.right - rcThis.left) - (ScaleGui(297) + clsGuiSettingManager::iUpDownWidth + 26), clsGuiSettingManager::iEditHeight,
        m_hWnd, (HMENU)EDT_MAX_USERS, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_MAX_USERS], EM_SETLIMITTEXT, 5, 0);

    AddUpDown(hWndPageItems[UD_MAX_USERS], (rcThis.right - rcThis.left)-clsGuiSettingManager::iUpDownWidth-13, clsGuiSettingManager::iGroupBoxMargin, clsGuiSettingManager::iUpDownWidth, clsGuiSettingManager::iEditHeight, (LPARAM)MAKELONG(32767, 1),
        (WPARAM)hWndPageItems[EDT_MAX_USERS], (LPARAM)MAKELONG(clsSettingManager::mPtr->i16Shorts[SETSHORT_MAX_USERS], 0));

    hWndPageItems[GB_HUB_NAME] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_HUB_NAME], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_HUB_NAME] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_HUB_NAME], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, clsGuiSettingManager::iOneLineGB + clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_HUB_NAME, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_HUB_NAME], EM_SETLIMITTEXT, 256, 0);

    iPosY += clsGuiSettingManager::iOneLineGB;

    hWndPageItems[GB_HUB_TOPIC] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_HUB_TOPIC], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_HUB_TOPIC] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_HUB_TOPIC], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_HUB_TOPIC, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_HUB_TOPIC], EM_SETLIMITTEXT, 256, 0);

    iPosY += clsGuiSettingManager::iOneLineGB;

    hWndPageItems[GB_HUB_DESCRIPTION] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_HUB_DESCRIPTION], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, clsGuiSettingManager::iOneLineOneChecksGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_HUB_DESCRIPTION] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_HUB_DESCRIPTION], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_HUB_DESCRIPTION, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_HUB_DESCRIPTION], EM_SETLIMITTEXT, 256, 0);

    hWndPageItems[BTN_ANTI_MOGLO] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_ANTI_MOGLO], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + 4, iFullEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_ANTI_MOGLO], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_ANTI_MOGLO] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += clsGuiSettingManager::iOneLineOneChecksGB;

    hWndPageItems[GB_HUB_ADDRESS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_HUB_ADDRESS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, clsGuiSettingManager::iOneLineTwoChecksGB + clsGuiSettingManager::iOneLineGB + 3, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_HUB_ADDRESS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_HUB_ADDRESS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_HUB_ADDRESS, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_HUB_ADDRESS], EM_SETLIMITTEXT, 256, 0);

    hWndPageItems[BTN_RESOLVE_ADDRESS] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_RESOLVE_HOSTNAME], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + 4, iFullEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, (HMENU)BTN_RESOLVE_ADDRESS, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_RESOLVE_ADDRESS], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_RESOLVE_TO_IP] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    int iFourtyPercent = (int)(iGBinGB * 0.4);
    hWndPageItems[GB_IPV4_ADDRESS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_IPV4_ADDRESS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        5, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + clsGuiSettingManager::iCheckHeight + 5, iFourtyPercent - 3, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_IPV4_ADDRESS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->bBools[SETBOOL_RESOLVE_TO_IP] == true ? clsServerManager::sHubIP :
        (clsSettingManager::mPtr->sTexts[SETTXT_IPV4_ADDRESS] != NULL ? clsSettingManager::mPtr->sTexts[SETTXT_IPV4_ADDRESS] : ""),
        WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL, 13, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + clsGuiSettingManager::iCheckHeight + 5 + clsGuiSettingManager::iGroupBoxMargin, iFourtyPercent - 19, clsGuiSettingManager::iEditHeight,
        m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_IPV4_ADDRESS], EM_SETLIMITTEXT, 15, 0);

    hWndPageItems[GB_IPV6_ADDRESS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_IPV6_ADDRESS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        10 + (iFourtyPercent - 3), iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + clsGuiSettingManager::iCheckHeight + 5, (iGBinGB - (iFourtyPercent - 3)) - 5, clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_IPV6_ADDRESS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->bBools[SETBOOL_RESOLVE_TO_IP] == true ? clsServerManager::sHubIP6 :
        (clsSettingManager::mPtr->sTexts[SETTXT_IPV6_ADDRESS] != NULL ? clsSettingManager::mPtr->sTexts[SETTXT_IPV6_ADDRESS] : ""),
        WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL, 18 + (iFourtyPercent - 3), iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + clsGuiSettingManager::iCheckHeight + 5 + clsGuiSettingManager::iGroupBoxMargin,
        (iGBinGB - (iFourtyPercent - 3)) - 21, clsGuiSettingManager::iEditHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_IPV6_ADDRESS], EM_SETLIMITTEXT, 39, 0);

    hWndPageItems[BTN_BIND_ADDRESS] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_BIND_ONLY_ADDRS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + clsGuiSettingManager::iCheckHeight + clsGuiSettingManager::iOneLineGB + 10, iFullEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_BIND_ADDRESS], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_BIND_ONLY_SINGLE_IP] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    iPosY += clsGuiSettingManager::iOneLineTwoChecksGB + clsGuiSettingManager::iOneLineGB + 3;

    hWndPageItems[GB_TCP_PORTS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_TCP_PORTS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, ScaleGui(362), clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_TCP_PORTS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_TCP_PORTS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin, ScaleGui(362) - 16, clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_TCP_PORTS, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_TCP_PORTS], EM_SETLIMITTEXT, 64, 0);
    AddToolTip(hWndPageItems[EDT_TCP_PORTS], clsLanguageManager::mPtr->sTexts[LAN_TCP_PORTS_HINT]);

    hWndPageItems[GB_UDP_PORT] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_UDP_PORT], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        ScaleGui(362) + 5, iPosY, (rcThis.right - rcThis.left) - (ScaleGui(362) + 10), clsGuiSettingManager::iOneLineGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_UDP_PORT] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_UDP_PORT], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER | ES_AUTOHSCROLL,
        ScaleGui(362) + 13, iPosY + clsGuiSettingManager::iGroupBoxMargin, (rcThis.right - rcThis.left) - (ScaleGui(362) + 26), clsGuiSettingManager::iEditHeight, m_hWnd, (HMENU)EDT_UDP_PORT, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_UDP_PORT], EM_SETLIMITTEXT, 5, 0);
    AddToolTip(hWndPageItems[EDT_UDP_PORT], clsLanguageManager::mPtr->sTexts[LAN_ZERO_DISABLED]);

    iPosY += clsGuiSettingManager::iOneLineGB;

    hWndPageItems[GB_HUB_LISTS] = ::CreateWindowEx(WS_EX_TRANSPARENT, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_HUB_REG_ADRS], WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
        0, iPosY, iFullGB, clsGuiSettingManager::iOneLineOneChecksGB, m_hWnd, NULL, clsServerManager::hInstance, NULL);

    hWndPageItems[EDT_HUB_LISTS] = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, clsSettingManager::mPtr->sTexts[SETTXT_REGISTER_SERVERS], WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin, iFullEDT, clsGuiSettingManager::iEditHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[EDT_HUB_LISTS], EM_SETLIMITTEXT, 1024, 0);
    AddToolTip(hWndPageItems[EDT_HUB_LISTS], clsLanguageManager::mPtr->sTexts[LAN_HUB_LIST_REGS_HINT]);

    hWndPageItems[BTN_HUBLIST_AUTO_REG] = ::CreateWindowEx(0, WC_BUTTON, clsLanguageManager::mPtr->sTexts[LAN_AUTO_REG], WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
        8, iPosY + clsGuiSettingManager::iGroupBoxMargin + clsGuiSettingManager::iEditHeight + 4, iFullEDT, clsGuiSettingManager::iCheckHeight, m_hWnd, NULL, clsServerManager::hInstance, NULL);
    ::SendMessage(hWndPageItems[BTN_HUBLIST_AUTO_REG], BM_SETCHECK, (clsSettingManager::mPtr->bBools[SETBOOL_AUTO_REG] == true ? BST_CHECKED : BST_UNCHECKED), 0);

    for(uint8_t ui8i = 0; ui8i < (sizeof(hWndPageItems) / sizeof(hWndPageItems[0])); ui8i++) {
        if(hWndPageItems[ui8i] == NULL) {
            return false;
        }

        ::SendMessage(hWndPageItems[ui8i], WM_SETFONT, (WPARAM)clsGuiSettingManager::hFont, MAKELPARAM(TRUE, 0));
    }

    // add default language and select it
    ::SendMessage(hWndPageItems[CB_LANGUAGE], CB_ADDSTRING, 0, (LPARAM)"Default English");
    ::SendMessage(hWndPageItems[CB_LANGUAGE], CB_SETCURSEL, 0, 0);

    // add all languages found in language dir
    struct _finddata_t langfile;
    intptr_t hFile = _findfirst((clsServerManager::sPath+"\\language\\"+"*.xml").c_str(), &langfile);

    if(hFile != -1) {
        do {
    		if(((langfile.attrib & _A_SUBDIR) == _A_SUBDIR) == true ||
				stricmp(langfile.name+(strlen(langfile.name)-4), ".xml") != NULL) {
    			continue;
    		}

            ::SendMessage(hWndPageItems[CB_LANGUAGE], CB_ADDSTRING, 0, (LPARAM)string(langfile.name, strlen(langfile.name)-4).c_str());
        } while(_findnext(hFile, &langfile) == 0);

    	_findclose(hFile);
    }

    // Select actual language in combobox
    if(clsSettingManager::mPtr->sTexts[SETTXT_LANGUAGE] != NULL) {
        uint32_t ui32Count = (uint32_t)::SendMessage(hWndPageItems[CB_LANGUAGE], CB_GETCOUNT, 0, 0);
        for(uint32_t ui32i = 1; ui32i < ui32Count; ui32i++) {
            uint32_t ui32Len = (uint32_t)::SendMessage(hWndPageItems[CB_LANGUAGE], CB_GETLBTEXTLEN, ui32i, 0);
            if(ui32Len == (int32_t)clsSettingManager::mPtr->ui16TextsLens[SETTXT_LANGUAGE]) {
                char * buf = (char *)HeapAlloc(clsServerManager::hPtokaXHeap, HEAP_NO_SERIALIZE, ui32Len+1);

                if(buf == NULL) {
                    AppendDebugLogFormat("[MEM] Cannot allocate %u bytes for buf in SettingPageGeneral::CreateSettingPage\n", ui32Len+1);
                    return false;
                }

                ::SendMessage(hWndPageItems[CB_LANGUAGE], CB_GETLBTEXT, ui32i, (LPARAM)buf);
                if(stricmp(buf, clsSettingManager::mPtr->sTexts[SETTXT_LANGUAGE]) == NULL) {
                    ::SendMessage(hWndPageItems[CB_LANGUAGE], CB_SETCURSEL, ui32i, 0);

                    if(HeapFree(clsServerManager::hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)buf) == 0) {
                        AppendDebugLog("%s - [MEM] Cannot deallocate buf in SettingPageGeneral::CreateSettingPage\n");
                    }

                    break;
                }

                if(HeapFree(clsServerManager::hPtokaXHeap, HEAP_NO_SERIALIZE, (void *)buf) == 0) {
                    AppendDebugLog("%s - [MEM] Cannot deallocate buf in SettingPageGeneral::CreateSettingPage\n");
                }
            }
        }
    }

    if(clsSettingManager::mPtr->bBools[SETBOOL_RESOLVE_TO_IP] == true) {
        ::EnableWindow(hWndPageItems[EDT_IPV4_ADDRESS], FALSE);
        ::EnableWindow(hWndPageItems[EDT_IPV6_ADDRESS], FALSE);
    }

    clsGuiSettingManager::wpOldButtonProc = (WNDPROC)::SetWindowLongPtr(hWndPageItems[BTN_HUBLIST_AUTO_REG], GWLP_WNDPROC, (LONG_PTR)ButtonProc);

    return true;
}
void CToolsCtlPanelText::InitToolTips()
{
	CToolsCtlPanelCommon::InitToolTips();
	AddToolTip(IDC_TEXT_SIZE);
	AddToolTip(IDC_FONT);
	AddToolTip(IDC_BOLD);
	AddToolTip(IDC_ITALIC);
	AddToolTip(IDC_UNDERLINE);
	AddToolTip(IDC_LEFT);
	AddToolTip(IDC_CENTER);
	AddToolTip(IDC_RIGHT);
	AddToolTip(IDC_TOP);
	AddToolTip(IDC_MIDDLE);
	AddToolTip(IDC_BOTTOM);
	AddToolTip(IDC_SPELLCHECK, IDS_SPELLCHECK);
}