OLD | NEW |
| (Empty) |
1 /* | |
2 * DownloadDialog.h 2009-01-11 14:18:18 Jakob Holck | |
3 */ | |
4 | |
5 #pragma once | |
6 | |
7 enum | |
8 { | |
9 UF_BINDSTATUS_FIRST = BINDSTATUS_FINDINGRESOURCE, | |
10 UF_BINDSTATUS_LAST = BINDSTATUS_ACCEPTRANGES | |
11 }; | |
12 | |
13 #include <atlhost.h> | |
14 #include <atlstr.h> | |
15 | |
16 // CPluginDownloadDialog | |
17 | |
18 class CPluginDownloadDialog : public CAxDialogImpl<CPluginDownloadDialog> | |
19 { | |
20 | |
21 public: | |
22 | |
23 CPluginDownloadDialog(){}; | |
24 ~CPluginDownloadDialog(){}; | |
25 | |
26 static DWORD WINAPI StartThread (LPVOID param); //controlling function h
eader | |
27 | |
28 struct DOWNLOADSTATUS | |
29 { | |
30 ULONG ulProgress; | |
31 ULONG ulProgressMax; | |
32 ULONG ulStatusCode; | |
33 LPCWSTR szStatusText; | |
34 }; | |
35 | |
36 typedef struct THREADSTRUCT //structure for passing
to the controlling function | |
37 { | |
38 CPluginDownloadDialog* _this; | |
39 HANDLE hEventStop; | |
40 CWindow pBar; | |
41 CString url; | |
42 CString path; | |
43 CString errortext; | |
44 CString postdownloadtext; | |
45 } THREADSTRUCT; | |
46 | |
47 void SetUrlAndPath(CString url_, CString path_); | |
48 | |
49 enum { IDD = IDD_DOWNLOADDIALOG }; | |
50 | |
51 BEGIN_MSG_MAP(CPluginDownloadDialog) | |
52 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) | |
53 COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel) | |
54 COMMAND_HANDLER(IDC_INSTALLBTN, BN_CLICKED, OnClickedInstall) | |
55 COMMAND_HANDLER(IDC_INSTALLBTN, BN_CLICKED, OnBnClickedInstallbtn) | |
56 CHAIN_MSG_MAP(CAxDialogImpl<CPluginDownloadDialog>) | |
57 END_MSG_MAP() | |
58 | |
59 LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); | |
60 LRESULT OnClickedInstall(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHand
led) | |
61 { | |
62 EndDialog(wID); | |
63 return 1; | |
64 } | |
65 | |
66 LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandl
ed) | |
67 { | |
68 EndDialog(wID); | |
69 return 0; | |
70 } | |
71 | |
72 struct DOWNLOADPARAM | |
73 { | |
74 HWND hWnd; | |
75 HANDLE hEventStop; | |
76 CString strURL; | |
77 CString strFileName; | |
78 }; | |
79 | |
80 private: | |
81 HANDLE m_eventStop; | |
82 | |
83 protected: | |
84 | |
85 CString m_url; | |
86 CString m_path; | |
87 CString m_errorText; | |
88 CString m_postText; | |
89 | |
90 public: | |
91 LRESULT OnBnClickedInstallbtn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndC
tl*/, BOOL& /*bHandled*/); | |
92 | |
93 }; | |
94 | |
95 | |
96 // CBSCallbackImpl | |
97 class CBSCallbackImpl : public IBindStatusCallback | |
98 { | |
99 | |
100 public: | |
101 | |
102 CBSCallbackImpl(HWND hWnd, HANDLE eventStop, CWindow pBar); | |
103 | |
104 // IUnknown methods | |
105 STDMETHOD(QueryInterface)(REFIID riid, void **ppvObject); | |
106 STDMETHOD_(ULONG, AddRef)(); | |
107 STDMETHOD_(ULONG, Release)(); | |
108 | |
109 // IBindStatusCallback methods | |
110 STDMETHOD(OnStartBinding)(DWORD, IBinding *); | |
111 STDMETHOD(GetPriority)(LONG *); | |
112 STDMETHOD(OnLowResource)(DWORD); | |
113 STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCod
e, LPCWSTR szStatusText); | |
114 STDMETHOD(OnStopBinding)(HRESULT, LPCWSTR); | |
115 STDMETHOD(GetBindInfo)(DWORD *, BINDINFO *); | |
116 STDMETHOD(OnDataAvailable)(DWORD, DWORD, FORMATETC *, STGMEDIUM *); | |
117 STDMETHOD(OnObjectAvailable)(REFIID, IUnknown *); | |
118 | |
119 protected: | |
120 | |
121 ULONG m_ulObjRefCount; | |
122 | |
123 private: | |
124 | |
125 HWND m_hWnd; | |
126 CWindow m_pBar; | |
127 HANDLE m_hEventStop; | |
128 }; | |
OLD | NEW |