I wasn't sure how much it would help... But heres the function in question:
Code:
void CTextManager::Open(SOpenParams *pParams)
{
m_szText = "";
pParams->Update = UpdateText;
m_pFileManager->Open(pParams);
}
Code:
class CTextManager
{
public:
CTextManager(HWND hWnd);
~CTextManager();
// Text Manager Functions
void SetFileManager(CFileManager *pFileManager) { m_pFileManager = pFileManager; }
void Resize(RECT rect);
void Updated();
// File Manager Functions
void Open(SOpenParams *pParams);
void Save(SSaveParams *pParams, bool bSaveAs);
void UpdateText(int iProgress);
// Search Functions
void Search();
private:
HMODULE m_hRichEdit; // Rich edit library
HWND m_hParent; // Main window
HWND m_hEdit; // Edit Control
CFileManager *m_pFileManager; // File Manager
CSearch m_Search; // Search Algorithm
SSaveParams *m_pSaveParams;
SOpenParams *m_pOpenParams;
string m_szText;
bool m_bUpdated; // Flag to show whether the text has been updated since we last did something
};
And the SOpenParams struct
Code:
struct SOpenParams
{
LPSTR szText; // Buffer to store text
void (*Opened)(bool bSuccess, SError error); // Function to call when file has been opened
void (*Update)(int progress); // Function to call to update text
bool bUpdated; // True when Update() has finished
int iChunkSize; // Amount of chars to read in a chunk
SOpenParams();
~SOpenParams();
CRITICAL_SECTION *pcsFileMgrData;
private:
char const *szFilePath; // Pointer to the buffer containing the file path
friend class CFileManager;
friend void __cdecl OpenThread(void *pParams);
};