1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* Copyright (C) 2010-2012 Hendrik Leppkes
* http://www.1f0.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
#include "BaseDSPropPage.h"
CBaseDSPropPage::CBaseDSPropPage(LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, int DialogId, int TitleId)
: CBasePropertyPage(pName, pUnk, DialogId, TitleId), m_hHint(0)
{
}
HWND CBaseDSPropPage::createHintWindow(HWND parent,int timePop,int timeInit,int timeReshow)
{
HWND hhint = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
parent, NULL, NULL, NULL);
SetWindowPos(hhint,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
SendMessage(hhint,TTM_SETDELAYTIME,TTDT_AUTOPOP,MAKELONG(timePop,0));
SendMessage(hhint,TTM_SETDELAYTIME,TTDT_INITIAL,MAKELONG(timeInit,0));
SendMessage(hhint,TTM_SETDELAYTIME,TTDT_RESHOW,MAKELONG(timeReshow,0));
SendMessage(hhint,TTM_SETMAXTIPWIDTH,0,470);
return hhint;
}
TOOLINFO CBaseDSPropPage::addHint(int id, const LPWSTR text)
{
if (!m_hHint) m_hHint = createHintWindow(m_Dlg,15000);
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS|TTF_IDISHWND;
ti.hwnd = m_Dlg;
ti.uId = (LPARAM)GetDlgItem(m_Dlg, id);
ti.lpszText = text;
SendMessage(m_hHint, TTM_ADDTOOL, 0, (LPARAM)&ti);
return ti;
}
void CBaseDSPropPage::ListView_AddCol(HWND hlv, int &ncol, int w, const wchar_t *txt, bool right)
{
LVCOLUMN lvc;
lvc.mask = LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
lvc.iSubItem = ncol;
lvc.pszText = (LPWSTR)txt;
lvc.cx = w;
lvc.fmt = right ? LVCFMT_RIGHT : LVCFMT_LEFT;
ListView_InsertColumn(hlv, ncol, &lvc);
ncol++;
}
HRESULT CBaseDSPropPage::ShowPropPageDialog(IBaseFilter *pFilter, HWND hwndOwner)
{
CheckPointer(pFilter, E_INVALIDARG);
CoInitialize(NULL);
// Get PropertyPages interface
ISpecifyPropertyPages *pProp = NULL;
HRESULT hr = pFilter->QueryInterface<ISpecifyPropertyPages>(&pProp);
if (SUCCEEDED(hr) && pProp) {
// Get the filter's name and IUnknown pointer.
FILTER_INFO FilterInfo;
hr = pFilter->QueryFilterInfo(&FilterInfo);
IUnknown *pFilterUnk = NULL;
pFilter->QueryInterface<IUnknown>(&pFilterUnk);
// Show the page.
CAUUID caGUID;
pProp->GetPages(&caGUID);
pProp->Release();
hr = OleCreatePropertyFrame(
hwndOwner, // Parent window
0, 0, // Reserved
FilterInfo.achName, // Caption for the dialog box
1, // Number of objects (just the filter)
&pFilterUnk, // Array of object pointers.
caGUID.cElems, // Number of property pages
caGUID.pElems, // Array of property page CLSIDs
0, // Locale identifier
0, NULL // Reserved
);
// Clean up.
pFilterUnk->Release();
if (FilterInfo.pGraph)
FilterInfo.pGraph->Release();
CoTaskMemFree(caGUID.pElems);
hr = S_OK;
}
CoUninitialize();
return hr;
}
|