On Mon, Mar 21, 2011 at 14:55, Nikolay Sivov bunglehead@gmail.com wrote:
+typedef struct FileDialogImpl {
- IFileDialog2 IFileDialog2_iface;
- IFileOpenDialog IFileOpenDialog_iface;
- IFileSaveDialog IFileSaveDialog_iface;
- LONG ref;
+} FileDialogImpl;
Maybe it's better to use a union and enum type field here, if it can't be open and save at the same time.
At the moment I'm checking the vtbl pointers to determine which type of dialog it is in QueryInterface, although this looked better using the old COM coding style (no explicit check necessary).
Is using a union and an explicit type field preferred?
- fdimpl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(FileDialogImpl));
- if(!fdimpl)
- return E_OUTOFMEMORY;
Zero initialization is useless here.
As mentioned above it's not completely useless currently, but I can initialize them explicitly.
Thanks for the review.