MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / OpenConfiguration

Function OpenConfiguration

Source/dllmain.cpp:80–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void CALLBACK OpenConfiguration(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
81{
82 HRESULT hr = S_OK;
83 CUnknown *pInstance = CreateInstance<CMpcVideoRenderer>(nullptr, &hr);
84 IBaseFilter *pFilter = nullptr;
85 pInstance->NonDelegatingQueryInterface(IID_IBaseFilter, (void **)&pFilter);
86 if (pFilter) {
87 pFilter->AddRef();
88
89 hr = CoInitialize(nullptr);
90
91 // Get PropertyPages interface
92 ISpecifyPropertyPages *pProp = nullptr;
93 hr = pFilter->QueryInterface<ISpecifyPropertyPages>(&pProp);
94 if (SUCCEEDED(hr) && pProp)
95 {
96 // Get the filter's name and IUnknown pointer.
97 FILTER_INFO FilterInfo;
98 hr = pFilter->QueryFilterInfo(&FilterInfo);
99 // We don't need the graph, so don't sit on a ref to it
100 if (FilterInfo.pGraph)
101 FilterInfo.pGraph->Release();
102
103 IUnknown *pFilterUnk = nullptr;
104 pFilter->QueryInterface<IUnknown>(&pFilterUnk);
105
106 // Show the page.
107 CAUUID caGUID;
108 pProp->GetPages(&caGUID);
109 pProp->Release();
110 hr = OleCreatePropertyFrame(
111 nullptr, // Parent window
112 0, 0, // Reserved
113 FilterInfo.achName, // Caption for the dialog box
114 1, // Number of objects (just the filter)
115 &pFilterUnk, // Array of object pointers.
116 caGUID.cElems, // Number of property pages
117 caGUID.pElems, // Array of property page CLSIDs
118 0, // Locale identifier
119 0, nullptr // Reserved
120 );
121
122 // Clean up.
123 pFilterUnk->Release();
124 CoTaskMemFree(caGUID.pElems);
125
126 hr = S_OK;
127 }
128 CoUninitialize();
129 }
130 delete pInstance;
131}

Callers

nothing calls this directly

Calls 4

GetPagesMethod · 0.80
AddRefMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected