Build Date: 27-May-2019
When building a DirectShow app, it's usually desirable to display camera configuration property sheets, such as this one.

There's several coding issues with getting this work that appear over and over in developer forums, as follows.
Let's clarify this...
The OleCreatePropertyFrame call displays a modal dialog box, and the X, Y position is ignored. This is a known Microsoft bug. The solution is to create a new locator window (a Button class will do) in the desired place and use the new handle to locate the PropertyFrame. Remember to delete the locator window when you are done.
The PropertyFrame attaches itself to the window (which never appears) and is presented to the user at the position set when the locator window was created. Here's some sample code.
|
//
hwndApp is the app parent window ISpecifyPropertyPages
*pSpec; HRESULT hr =
pVideoCapture->QueryInterface(IID_ISpecifyPropertyPages,(void **)&pSpec); HWND hLocatorWnd = NULL; hLocatorWnd = CreateWindow(TEXT("Button"),TEXT("Locator"),WS_POPUPWINDOW, // The width and height (20,20) are arbitrary. hr =
OleCreatePropertyFrame(hLocatorWnd, // Check returned hr value as needed, then clean up. DestroyWindow(hLocatorWnd); CoTaskMemFree(cauuid.pElems); |
The second issue, getting the button return codes, is at first glance more difficult. The OleCreatePropertyFrame call returns an HRESULT only, and even if you create and register a new window class with its own WndProc handler, you still can't get the Property Frame button return codes.
In fact, you don't need the button return codes at all. The Property Frame is a COM (a.k.a Ole) object and all message handling is done internally. All your code needs to do is handle the HRESULT.
For example, the above Video Proc Amp sheet appears while the video stream is running, and changes you make e.g. Gain are reflected in the video stream.
If you click the Cancel button, the Property Sheet object resets the original video stream values and, as you would expect, the video stream remains unchanged.
Once a change is made, the Apply button is enabled. If you click the Apply button, the changes are are written to the video stream, and the Cancel button does not cause a reversion.
Likewise, clicking the OK button, as you would expect, updates the video stream and the Property Sheet closes.
*****************************