1
0

mtbrowser.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef NULLSOFT_MULTITHREADED_BROWSER_HEADER
  2. #define NULLSOFT_MULTITHREADED_BROWSER_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "../nu/HTMLContainer2.h"
  7. typedef struct _MTBROWSER
  8. {
  9. HTMLContainer2 *pContainer; // HTMLContainer2 object
  10. HANDLE hThread; // Browser object thread
  11. DWORD dwThreadId; // Browser object thread Id
  12. BOOL bQuiting; // Browser quiting (do not schedule any othe APC)
  13. HANDLE hMemMngr; // handle to the browser memory meanger.
  14. HWND hwndNotify; // set from pContainer->GetParentHWND();
  15. UINT uMsgNotify; // if 0 != uMsgNotify you will be notified that browser finished operation with wParam set to cmd code, and lParam result.
  16. } MTBROWSER;
  17. typedef void* HAPC;
  18. typedef void (CALLBACK *FREEPROC)(void* pMemFree);
  19. typedef void (CALLBACK *APCPROC)(HTMLContainer2 *pContainer, VARIANTARG *pArgs, INT cArgs, LPARAM *pResult);
  20. // messages
  21. #define MTBC_FIRST (0x0000)
  22. #define MTBC_LAST (0x00FF)
  23. #define MTBC_READY (MTBC_FIRST) // Posted when browser thread and browser object initialization completed //lParam = (HTMLContainer2*)
  24. #define MTBC_DESTROYED (MTBC_LAST) // Posted when browser object destroyed itself and browser thread about to exit. //lParam = (HTMLContainer2*)- destroyed!!!
  25. #define MTBC_APC_QUIT (MTBC_FIRST + 20) // Posted when browser executed quit APC
  26. #define MTBC_APC_NAVIGATE (MTBC_FIRST + 21) // Posted when browser executed navigate APC. lParam = (HRESULT)
  27. #define MTBC_APC_SETLOCATION (MTBC_FIRST + 22) // Posted when browser executed SetLocation APC. lParam = (HRESULT)
  28. #define MTBC_APC_REFRESH2 (MTBC_FIRST + 23) // Posted when browser executed Refresh2 APC. lParam = (HRESULT)
  29. #define MTBC_DOCUMENTCOMPLETE (MTBC_FIRST + 41) // lParam = (BOOL)bDocumentReady
  30. BOOL MTBrowser_Init(MTBROWSER *pmtb);
  31. BOOL MTBrowser_Clear(MTBROWSER *pmtb);
  32. BOOL MTBrowser_Start(MTBROWSER *pmtb, HTMLContainer2 *pContainer, UINT uMsgNotify);
  33. BOOL MTBrowser_Kill(MTBROWSER *pmtb, UINT nTerminateDelay); // use in WM_DESTROY
  34. // Async calls
  35. HAPC MTBrowser_InitializeAPC(MTBROWSER *pmtb, INT nCount, UINT nCmdCode, APCPROC fnAPC, VARIANTARG **pArgs);
  36. BOOL MTBrowser_CallAPC(HAPC hAPC);
  37. BOOL MTBrowser_QuitAPC(MTBROWSER *pmtb);
  38. BOOL MTBrowser_NavigateToNameAPC(MTBROWSER *pmtb, LPCWSTR pszURL, UINT fFlags);
  39. BOOL MTBrowser_SetLocationAPC(MTBROWSER *pmtb, RECT *pRect);
  40. BOOL MTBrowser_SetVisibleAPC(MTBROWSER *pmtb, BOOL bVisible);
  41. BOOL MTBrowser_Refresh2APC(MTBROWSER *pmtb, INT nRefreshMode);
  42. /// Thread Memory manager
  43. BOOL MTBrowser_AddMemRec(MTBROWSER *pmtb, void *pMem, FREEPROC fnFreeProc); // if fnFreeProc == NULL - standart free() will be used
  44. BOOL MTBrowser_FreeMemRec(MTBROWSER *pmtb, void *pMem);
  45. #endif //NULLSOFT_MULTITHREADED_BROWSER_HEADER