windows shell program(3)

Drag and Drop

If you have read windows shell program(1), it will be easy. Only a reg script:
NoRemove Drive
 {
  NoRemove shellex
  {
    NoRemove DragDropHandlers
    {
    ForceRemove ......
    }
  }
 }
 NoRemove Directory
 {
  NoRemove shellex
  {
    NoRemove DragDropHandlers
    {
    ForceRemove ......
    }
  }
 }
 NoRemove Folder
 {
  NoRemove shellex
  {
   NoRemove DragDropHandlers
   {
    ForceRemove ........   }
  }
 }  

OK, We can drop and drag now!

Shell PropPage Sheet
IShellExtInit is used to select some files as above.
IShellPropSheetExt is used to add or modify property sheet of files.
There are two methods in interface of IShellPropSheetExt:
STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE lpfnAddPageProc, LPARAM lParam);
STDMETHOD(ReplacePage)(UINT, LPFNADDPROPSHEETPAGE, LPARAM);
ReplacePage
method only be used to extend the control panel's property page sheet .So, sometimes wo don't use it.
AddPages method parameters have a method pointer and a LPARAM variable.They all are used by shell.The lpfnAddpageProc points to inner function of shell proces to add pages. lParam is a very important value that is used by shell. Now we only talk about the lpfnAddpageProc.
In the AddPages function, there is a important Variable--PROPSHEETPAGE.
HRESULT CFileTimeShlExt::AddPages ( LPFNADDPROPSHEETPAGE lpfnAddPageProc, LPARAM lParam )
{
PROPSHEETPAGE psp;
TCHAR szPageTitle [MAX_PATH];
string_list::const_iterator it, itEnd;

for ( it = m_lsFiles.begin(), itEnd = m_lsFiles.end(); it != itEnd; it++ )
{
// 'it' 指向下一个文件名. 分配一个给页面使用的字符串拷贝.
LPCTSTR szFile = _tcsdup ( it->c_str() );

// 从文件名中截去路径和扩展名 – 用其作为页面标题. 该名称截取为 24 个字符以适合Tab的大小.
lstrcpy ( szPageTitle, it->c_str() );
PathStripPath ( szPageTitle );
PathRemoveExtension ( szPageTitle );
szPageTitle[24] = '/0';
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE | PSP_DEFAULT | PSP_USEICONID | PSP_USECALLBACK;
psp.hInstance = _Module.GetModuleInstance();
psp.pszTemplate = MAKEINTRESOURCE(IDD_FILETIME_PROPPAGE);
psp.pszIcon = MAKEINTRESOURCE(IDI_ICON);
psp.pszTitle = szPageTitle;
psp.pfnDlgProc = PropPageDlgProc;
psp.lParam = (LPARAM) szFile;
psp.pfnCallback = PropPageCallbackProc;
psp.pcRefParent = (UINT*) &_Module.m_nLockCnt;
hPage = CreatePropertySheetPage ( &psp );
if ( NULL != hPage )
{
if ( !if ( NULL != hPage )
{
if ( !lpfnAddPageProc ( hPage, lParam ))
{ DestroyPropertySheetPage ( hPage ); }
}

} // end for
return S_OK;
}( hPage, lParam ))
{ DestroyPropertySheetPage ( hPage ); }
}

} // end for
return S_OK;
}

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值