Windows Shell Programming...

来源:互联网 发布:种植牙的利与弊 知乎 编辑:程序博客网 时间:2024/05/22 06:28

Windows Shell Programming...

Windows Shell Programming...

                                      

Some Q&A about Windows Shell programming...



Q : 高分请教:最简单的方法得到windows文件所关联的执行程序路径

A :如:  
   txt文件  得到  D:\winnt\notepad.exe  
   dsw文件  得到  D:\Program  Files\Microsoft  Visual  Studio\Common\MSDev98\Bin\MSDEV.EXE  
 
ShellExecute就做到了~~    请问有什么简单方法可以实现吗?  
---------------------------------------------------------------  
 
FindExecutable  or  AssocQueryString



Q : 快捷方式上的小箭头和文件夹共享上的手是怎么放上去的? 想对shell进行扩展,使指定的部分文件和文件夹图标上叠加一个小图标,要实现什么接口

A :
需要实现的接口是  IShellIconOverlayIdentifier  
 
需要注册的位置是  
HKEY_LOCAL_MACHINE\Software\Microsoft\  
Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\MyOverlay  
               (Default)  =  {MyOverlay  CLSID  GUID}  
 
在MSDN    Creating  Icon  Overlay  Handlers  主题上有比较详细的解释

Q : vc中能否调用windows中拷贝文件的那个进度条?

A :
现在要实现拷贝文件的功能,时间较长.不想自己做个进度条,问能不能调用windows中拷贝文件的那个进度条?  
---------------------------------------------------------------  
 
Requirements    
   Version  5.00  and  later  of  Shell32.dll  
 
   Windows  NT/2000:  Requires  Windows  2000.    
   Windows  95/98/Me:  Requires  Windows  Me.    
 
IProgressDialog  
The  IProgressDialog  interface  is  exported  by  the  progress  dialog  box  object  (CLSID_ProgressDialog).  This  object  is  a  generic  way  to  show  a  user  how  an  operation  is  progressing.  It  is  typically  used  when  deleting,  uploading,  copying,  moving,  or  downloading  large  numbers  of  files.  
 
The  progress  dialog  box  object  creates  a  modeless  dialog  box  and  allows  the  client  to  set  its  title,  animation,  text  lines,  and  progress  bar.  The  object  then  handles  updating  on  a  background  thread  and  allows  the  user  to  cancel  the  operation.  Optionally,  it  estimates  the  time  remaining  until  the  operation  is  complete  and  displays  the  information  as  a  line  of  text.  
 
BUG:  PROGDLG_NOMINIMIZE  Flag  in  IProgressDialog::StartProgressDialog()  Has  No  Effect    
 
Q260222  
 
 
--------------------------------------------------------------------------------  
The  information  in  this  article  applies  to:  
 
Microsoft  Win32  Software  Development  Kit  (SDK),  on  platform(s):  
the  operating  system:  Microsoft  Windows  2000  
Q : 关于几个常见的SHELL问题

A
最近在CSDN上经常看到有人发问,怎样实现显示查找文件对话框,显示浏览文件夹对话框,显示关闭Windows对话框,一类的问题,所以我整理了几个常用的SHELL实现的方法。如下:  
 
           IShellDispatch*            pShellDispatch  =  NULL;  
           HRESULT  hResult  =  CoInitialize(NULL);  
           if(FAILED(hResult))  
           {  
                       return;  
           }  
 
           hResult  =  CoCreateInstance(CLSID_Shell,NULL,CLSCTX_INPROC_SERVER,  
                       IID_IDispatch,(LPVOID*)&pShellDispatch);  
           if(FAILED(hResult))  
           {  
                       return;  
           }  
 
//            COleVariant  OleVariant("桌面");  
//            COleVariant  OleTitle("IShellDispatch  test");  
//            Folder*  pFolder  =  NULL;  
//            hResult  =  pShellDispatch->BrowseForFolder((LONG)GetSafeHwnd(),  
//                        OleTitle.bstrVal,BIF_RETURNONLYFSDIRS,OleVariant,&pFolder);  
//显示浏览文件夹对话框  
 
//            hResult  =  pShellDispatch->CascadeWindows();//层叠窗口  
 
//            COleVariant  OleVariant("access.cpl");  
//            hResult  =  pShellDispatch->ControlPanelItem(OleVariant.bstrVal);//打开控制面板的程序  
 
//            COleVariant  OleVariant("我的电脑");  
//            hResult  =  pShellDispatch->Explore(OleTitle);//用资源管理器打开文件夹  
 
//            hResult  =  pShellDispatch->FileRun();//显示运行对话框  
 
//            hResult  =  pShellDispatch->FindComputer();//显示查找电脑对话框  
 
//            hResult  =  pShellDispatch->FindFiles();//显示查找文件对话框  
 
//            hResult  =  pShellDispatch->MinimizeAll();//显示桌面  
 
//            COleVariant  OleVariant("我的电脑");  
//            hResult  =  pShellDispatch->Open(OleTitle);//打开文件夹  
 
//            hResult  =  pShellDispatch->ShutdownWindows();//显示关闭Windows对话框  
 
//            hResult  =  pShellDispatch->TileHorizontally();//横向平铺窗口  
 
//            hResult  =  pShellDispatch->TileVertically();//纵向平铺窗口  
 
//            hResult  =  pShellDispatch->TrayProperties();//显示任务栏属性对话框  
 
//            hResult  =  pShellDispatch->UndoMinimizeALL();//撤销最小化窗口

 

原创粉丝点击