[PATCH 5/5] shell32: Implement a default property sheet for file system objects
Nikolay Sivov
nsivov at codeweavers.com
Mon Aug 22 03:44:01 CDT 2011
On 8/21/2011 19:21, Jay Yang wrote:
> + LoadStringA(shell32_hInstance,IDS_PROPSHEET_VARIOUS,
> + various_str,sizeof(various_str));
> + LoadStringW(shell32_hInstance,IDS_PROPSHEET_COUNT_FORMAT,
> + count_format,sizeof(count_format)/sizeof(WCHAR));
Why -A call here?
> + WCHAR count_str[64];
Again some magic.
> +static INT_PTR DefaultPropSheet_OnNotify(HWND hwndDlg,WPARAM wParam, NMHDR *header)
> +{
> + switch(header->code)
> + {
> + case PSN_APPLY:
> + {
> + UINT index;
> + PROPSHEETPAGEW *page;
> + DefaultPropSheet *propsheet;
> + WCHAR name[MAX_PATH];
> + UINT readonly_state, hidden_state;
> + UINT i;
> + index = SendMessageW(GetParent(hwndDlg),PSM_HWNDTOINDEX,(WPARAM)hwndDlg,0);
> + page = (PROPSHEETPAGEW*)SendMessageW(GetParent(hwndDlg),PSM_INDEXTOPAGE,index,0);
> + propsheet = (DefaultPropSheet*)page->lParam;
> +
> + /*set name*/
> + if(propsheet->cidl==1)
> + {
> + BOOL is_folder;
> + LPCITEMIDLIST pidl_child;
> + LPITEMIDLIST pidl,pidl_new,pidl_child_new,temp;
> + IShellFolder *folder;
> + WCHAR old_name[MAX_PATH];
> + GetDlgItemTextW(hwndDlg,IDC_PROPSHEET_NAME,name,sizeof(name)/sizeof(WCHAR));
> + pidl = ILCombine(propsheet->folder_pidl,propsheet->apidl[0]);
> + is_folder = _ILIsFolder(pidl);
> + temp = ILClone(pidl);
> + ILRemoveLastID(temp);
> + SHBindToParent(pidl,&IID_IShellFolder,(void**)&folder,&pidl_child);
> + ILGetDisplayNameExW(folder, pidl_child, old_name,SHGDN_NORMAL);
> + if(strcmpW(old_name,name)!=0)
> + {
> + if(SUCCEEDED(IShellFolder_SetNameOf(folder,hwndDlg,pidl_child,name,SHGDN_NORMAL,&pidl_child_new)))
> + {
> + pidl_new = ILCombine(temp,pidl_child_new);
> + SHChangeNotify(is_folder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM,SHCNF_IDLIST,pidl,pidl_new);
> + ILFree(pidl_child_new);
> + ILFree(pidl_new);
> + }
> + }
> + ILFree(temp);
> + ILFree(pidl);
> + IShellFolder_Release(folder);
> + }
> + /*set readonly/hidden*/
> + readonly_state = IsDlgButtonChecked(hwndDlg,IDC_PROPSHEET_READONLY);
> + hidden_state = IsDlgButtonChecked(hwndDlg,IDC_PROPSHEET_HIDDEN);
> + for(i=0;i<propsheet->cidl;i++)
> + {
> + LPITEMIDLIST pidl;
> + WCHAR path[MAX_PATH];
> + DWORD attributes;
> + pidl = ILCombine(propsheet->folder_pidl,propsheet->apidl[0]);
> + SHGetPathFromIDListW(pidl,path);
> + ILFree(pidl);
> + attributes = GetFileAttributesW(path);
> + switch(readonly_state)
> + {
> + case BST_CHECKED:
> + attributes |= FILE_ATTRIBUTE_READONLY;
> + break;
> + case BST_UNCHECKED:
> + attributes&= ~FILE_ATTRIBUTE_READONLY;
> + break;
> + }
> + switch(hidden_state)
> + {
> + case BST_CHECKED:
> + attributes |= FILE_ATTRIBUTE_HIDDEN;
> + break;
> + case BST_UNCHECKED:
> + attributes&= ~FILE_ATTRIBUTE_HIDDEN;
> + break;
> + }
> + SetFileAttributesW(path,attributes);
> + }
> + break;
> + }
> + case PSN_RESET:
> + {
> + UINT index;
> + PROPSHEETPAGEW *page;
> + DefaultPropSheet *propsheet;
> + index = SendMessageW(GetParent(hwndDlg),PSM_HWNDTOINDEX,(WPARAM)hwndDlg,0);
> + page = (PROPSHEETPAGEW*)SendMessageW(GetParent(hwndDlg),PSM_INDEXTOPAGE,index,0);
> + propsheet = ((DefaultPropSheet*)page->lParam);
> + IShellPropSheetExt_Release(&propsheet->IShellPropSheetExt_iface);
> + }
Missed 'break' probably?
> + default:
> + return FALSE;
> + }
> + return TRUE;
> +}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110822/79860e57/attachment-0001.htm>
More information about the wine-devel
mailing list