void RegisteredUsersDialog::FilterRegs() {
    int iTextLength = ::GetWindowTextLength(m_hWndWindowItems[EDT_FILTER]);

    if(iTextLength == 0) {
        m_sFilterString.clear();

    	AddAllRegs();
    } else {
        m_iFilterColumn = (int)::SendMessage(m_hWndWindowItems[CB_FILTER], CB_GETCURSEL, 0, 0);

        char buf[65];

        int iLen = ::GetWindowText(m_hWndWindowItems[EDT_FILTER], buf, 65);

        for(int i = 0; i < iLen; i++) {
            buf[i] = (char)tolower(buf[i]);
        }

        m_sFilterString = buf;

        ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)FALSE, 0);

        ::SendMessage(m_hWndWindowItems[LV_REGS], LVM_DELETEALLITEMS, 0, 0);

        RegUser * curReg = nullptr,
            * nextReg = RegManager::m_Ptr->m_pRegListS;

        while(nextReg != nullptr) {
            curReg = nextReg;
            nextReg = curReg->m_pNext;

            switch(m_iFilterColumn) {
                case 0:
                    if(stristr2(curReg->m_sNick, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
                case 1:
                    if(stristr2(curReg->m_sPass, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
                case 2:
                    if(stristr2(ProfileManager::m_Ptr->m_ppProfilesTable[curReg->m_ui16Profile]->m_sName, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
            }

            AddReg(curReg);
        }

        ListViewSelectFirstItem(m_hWndWindowItems[LV_REGS]);

        ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)TRUE, 0);
    }
}
void MainWindowPageScripts::AddScriptsToList(const bool &bDelete) {
    ::SendMessage(hWndPageItems[LV_SCRIPTS], WM_SETREDRAW, (WPARAM)FALSE, 0);

    if(bDelete == true) {
        ::SendMessage(hWndPageItems[LV_SCRIPTS], LVM_DELETEALLITEMS, 0, 0);
    }

	for(uint8_t ui8i = 0; ui8i < ScriptManager->ui8ScriptCount; ui8i++) {
        ScriptToList(ui8i, true, false);
	}

    ListViewSelectFirstItem(hWndPageItems[LV_SCRIPTS]);

    ::SendMessage(hWndPageItems[LV_SCRIPTS], WM_SETREDRAW, (WPARAM)TRUE, 0);

    UpdateUpDown();
}
void RegisteredUsersDialog::AddAllRegs() {
    ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)FALSE, 0);

    ::SendMessage(m_hWndWindowItems[LV_REGS], LVM_DELETEALLITEMS, 0, 0);

    RegUser * curReg = nullptr,
        * nextReg = RegManager::m_Ptr->m_pRegListS;

    while(nextReg != nullptr) {
        curReg = nextReg;
        nextReg = curReg->m_pNext;

        AddReg(curReg);
    }

    ListViewSelectFirstItem(m_hWndWindowItems[LV_REGS]);

    ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)TRUE, 0);
}