CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

怎样开启文件属性窗口?????????

楼主john_christopher(释)2002-02-09 15:18:42 在 VB / 基础类 提问

怎样开启文件属性窗口????????? 问题点数:100、回复次数:9Top

1 楼Jneu(沧海桑田)回复于 2002-02-09 15:31:53 得分 0

Declare   Function   ShellExecuteEX   Lib   "shell32.dll"   Alias   "ShellExecuteEx"   (SEI   As   SHELLEXECUTEINFO)   As   LongTop

2 楼blacklevin(黑闪电)回复于 2002-02-09 15:34:59 得分 10

声明:  
  Type   SHELLEXECUTEINFO  
  cbSize   As   Long  
  fMask   As   Long  
  hwnd   As   Long  
  lpVerb   As   String  
  lpFile   As   String  
  lpParameters   As   String  
  lpDirectory   As   String  
  nShow   As   Long  
  hInstApp   As   Long  
  lpIDList   As   Long  
  lpClass   As   String  
  hkeyClass   As   Long  
  dwHotKey   As   Long  
  hIcon   As   Long  
  hProcess   As   Long  
  End   Type  
   
  Public   Const   SEE_MASK_INVOKEIDLIST   =   &HC  
  Public   Const   SEE_MASK_NOCLOSEPROCESS   =   &H40  
  Public   Const   SEE_MASK_FLAG_NO_UI   =   &H400  
   
  Declare   Function   ShellExecuteEX   Lib   "shell32.dll"   Alias   _  
  "ShellExecuteEx"   (SEI   As   SHELLEXECUTEINFO)   As   Long    
   
  代码:  
  '   使用:   ShowProps("c:\command.com",Me.hWnd)  
  Public   Sub   ShowProps(FileName   As   String,   OwnerhWnd   As   Long)  
  Dim   SEI   As   SHELLEXECUTEINFO  
  Dim   r   As   Long  
  With   SEI  
  .cbSize   =   Len(SEI)  
  .fMask   =   SEE_MASK_NOCLOSEPROCESS   Or   _  
  SEE_MASK_INVOKEIDLIST   Or   SEE_MASK_FLAG_NO_UI  
  .hwnd   =   OwnerhWnd  
  .lpVerb   =   "properties"  
  .lpFile   =   FileName  
  .lpParameters   =   vbNullChar  
  .lpDirectory   =   vbNullChar  
  .nShow   =   0  
  .hInstApp   =   0  
  .lpIDList   =   0  
  End   With  
  r   =   ShellExecuteEX(SEI)    
  End   SubTop

3 楼sonicdater(事过境迁,除了技术,我什么都没有了)回复于 2002-02-09 18:18:39 得分 20

Public   Type   SHELLEXECUTEINFO  
  cbSize   As   Long  
  fMask   As   Long  
  hwnd   As   Long  
  lpVerb   As   String  
  lpFile   As   String  
  lpParameters   As   String  
  lpDirectory   As   String  
  nShow   As   Long  
  hInstApp   As   Long  
  lpIDList   As   Long  
  lpClass   As   String  
  hkeyClass   As   Long  
  dwHotKey   As   Long  
  hIcon   As   Long  
  hProcess   As   Long  
  End   Type  
  Public   Const   SEE_MASK_NOCLOSEPROCESS   =   &H40  
  Public   Const   SW_SHOWNORMAL   =   1  
  Public   Declare   Function   ShellExecuteEx   Lib   "shell32.dll"   Alias   "ShellExecuteExA"   (lpExecInfo   As   _  
  SHELLEXECUTEINFO)   As   Long  
  Public   Const   SE_ERR_FNF   =   2  
  Public   Const   SE_ERR_NOASSOC   =   31  
  Public   Declare   Function   WaitForSingleObject   Lib   "kernel32.dll"   (ByVal   hHandle   As   Long,   ByVal   _  
  dwMilliseconds   As   Long)   As   Long  
  Public   Const   INFINITE   =   &HFFFF  
  Public   Const   WAIT_TIMEOUT   =   &H102  
   
  '   ***   Place   the   following   code   inside   window   Form1.   ***  
  Private   Sub   Command1_Click()  
  Dim   sei   As   SHELLEXECUTEINFO     '   structure   used   by   the   function  
  Dim   retval   As   Long     '   return   value  
   
  '   Load   the   information   needed   to   open   C:\Docs\readme.txt  
  '   into   the   structure.  
  With   sei  
  '   Size   of   the   structure  
  .cbSize   =   Len(sei)  
  '   Use   the   optional   hProcess   element   of   the   structure.  
  .fMask   =   SEE_MASK_NOCLOSEPROCESS  
  '   Handle   to   the   window   calling   this   function.  
  .hwnd   =   Form1.hWnd  
  '   The   action   to   perform:   open   the   file.  
  .lpVerb   =   "open"  
  '   The   file   to   open.  
  .lpFile   =   "C:\Docs\readme.txt"  
  '   No   additional   parameters   are   needed   here.  
  .lpParameters   =   ""  
  '   The   default   directory   --   not   really   necessary   in   this   case.  
  .lpDirectory   =   "C:\Docs\"  
  '   Simply   display   the   window.  
  .nShow   =   SW_SHOWNORMAL  
  '   The   other   elements   of   the   structure   are   either   not   used  
  '   or   will   be   set   when   the   function   returns.  
  End   With  
   
  '   Open   the   file   using   its   associated   program.  
  retval   =   ShellExecuteEx(sei)  
  If   retval   =   0   Then  
  '   The   function   failed,   so   report   the   error.     Err.LastDllError  
  '   could   also   be   used   instead,   if   you   wish.  
  Select   Case   sei.hInstApp  
  Case   SE_ERR_FNF  
  Debug.Print   "The   file   C:\Docs\readme.txt   was   not   found."  
  Case   SE_NOASSOC  
  Debug.Print   "No   program   is   associated   with   *.txt   files."  
  Case   Else  
  Debug.Print   "An   unexpected   error   occured."  
  End   Select  
  Else  
  '   Wait   for   the   opened   process   to   close   before   continuing.     Instead  
  '   of   waiting   once   for   a   time   of   INFINITE,   this   example   repeatedly   checks   to   see   if   the  
  '   is   still   open.     This   allows   the   DoEvents   VB   function   to   be   called,   preventing  
  '   our   program   from   appearing   to   lock   up   while   it   waits.  
  Do  
  DoEvents  
  retval   =   WaitForSingleObject(sei.hProcess,   0)  
  Loop   While   retval   =   WAIT_TIMEOUT  
  Debug.Print   "Notepad   (or   whatever   program   was   opened)   has   just   closed."  
  End   If  
  End   SubTop

4 楼tg123(T.G.)回复于 2002-02-09 18:50:46 得分 10

Const   SEE_MASK_INVOKEIDLIST   =   &HC  
  Const   SEE_MASK_NOCLOSEPROCESS   =   &H40  
  Const   SEE_MASK_FLAG_NO_UI   =   &H400  
  Private   Type   SHELLEXECUTEINFO  
          cbSize   As   Long  
          fMask   As   Long  
          hwnd   As   Long  
          lpVerb   As   String  
          lpFile   As   String  
          lpParameters   As   String  
          lpDirectory   As   String  
          nShow   As   Long  
          hInstApp   As   Long  
          lpIDList   As   Long  
          lpClass   As   String  
          hkeyClass   As   Long  
          dwHotKey   As   Long  
          hIcon   As   Long  
          hProcess   As   Long  
  End   Type  
  Private   Declare   Function   ShellExecuteEx   Lib   "shell32.dll"   Alias   "ShellExecuteEx"   (SEI   As   SHELLEXECUTEINFO)   As   Long  
  Sub   ShowProps(FileName   As   String,   OwnerhWnd   As   Long)  
          Dim   SEI   As   SHELLEXECUTEINFO  
          Dim   r   As   Long  
          With   SEI  
                  'Set   the   structure's   size  
                  .cbSize   =   Len(SEI)  
                  'Seet   the   mask  
                  .fMask   =   SEE_MASK_NOCLOSEPROCESS   Or   _  
                    SEE_MASK_INVOKEIDLIST   Or   SEE_MASK_FLAG_NO_UI  
                  'Set   the   owner   window  
                  .hwnd   =   OwnerhWnd  
                  'Show   the   properties  
                  .lpVerb   =   "properties"  
                  'Set   the   filename  
                  .lpFile   =   FileName  
                  .lpParameters   =   vbNullChar  
                  .lpDirectory   =   vbNullChar  
                  .nShow   =   0  
                  .hInstApp   =   0  
                  .lpIDList   =   0  
          End   With  
          r   =   ShellExecuteEX(SEI)  
  End   Sub  
  Private   Sub   Form_Load()  
          'KPD-Team   1999  
          'URL:   http://www.allapi.net/  
          'E-Mail:   KPDTeam@Allapi.net  
          ShowProps   "c:\config.sys",   Me.hwnd  
  End   Sub  
  Top

5 楼minglx(我会给你分)回复于 2002-02-09 21:46:44 得分 0

选中文件,按右键,再选取“属性”  
   
  哈~~~!!Top

6 楼asciiman(MS、周杰伦一个不能少!)回复于 2002-02-09 22:21:59 得分 0

同Tg123(T.G.)Top

7 楼tianxiaolei(辛武)回复于 2002-02-10 14:11:01 得分 60

开启文件属性窗口    
  声明:  
  Type   SHELLEXECUTEINFO  
  cbSize   As   Long  
  fMask   As   Long  
  hwnd   As   Long  
  lpVerb   As   String  
  lpFile   As   String  
  lpParameters   As   String  
  lpDirectory   As   String  
  nShow   As   Long  
  hInstApp   As   Long  
  lpIDList   As   Long  
  lpClass   As   String  
  hkeyClass   As   Long  
  dwHotKey   As   Long  
  hIcon   As   Long  
  hProcess   As   Long  
  End   Type  
   
  Public   Const   SEE_MASK_INVOKEIDLIST   =   &HC  
  Public   Const   SEE_MASK_NOCLOSEPROCESS   =   &H40  
  Public   Const   SEE_MASK_FLAG_NO_UI   =   &H400  
   
  Declare   Function   ShellExecuteEX   Lib   "shell32.dll"   Alias   "ShellExecuteEx"   (SEI   As   SHELLEXECUTEINFO)   As   Long    
   
  代码:  
  '   使用:   ShowProps("c:\command.com",Me.hWnd)  
  Public   Sub   ShowProps(FileName   As   String,   OwnerhWnd   As   Long)  
  Dim   SEI   As   SHELLEXECUTEINFO  
  Dim   r   As   Long  
  With   SEI  
  .cbSize   =   Len(SEI)  
  .fMask   =   SEE_MASK_NOCLOSEPROCESS   Or   SEE_MASK_INVOKEIDLIST   Or   SEE_MASK_FLAG_NO_UI  
  .hwnd   =   OwnerhWnd  
  .lpVerb   =   "properties"  
  .lpFile   =   FileName  
  .lpParameters   =   vbNullChar  
  .lpDirectory   =   vbNullChar  
  .nShow   =   0  
  .hInstApp   =   0  
  .lpIDList   =   0  
  End   With  
  r   =   ShellExecuteEX(SEI)    
  End   Sub    
  Top

8 楼john_christopher(释)回复于 2002-02-10 14:37:33 得分 0

这里的给分制度弄的我很胡涂Top

9 楼FUNDGIRL(阿弥陀佛(别抢我分,谢谢))回复于 2002-02-13 11:23:49 得分 0

分分~Top

相关问题

  • 文件属性?
  • 怎样使用Windows自带的文件属性窗口?
  • 关于文件属性
  • 什么叫属性文件?
  • 文件属性的问题
  • 文件属性的问题。
  • 关于文件的属性
  • 如何在以属性单为主窗口的程序加上最小化按钮?并且如何把每个属性页连上帮助文件?
  • 如何修改文件属性
  • 如何修改文件的属性

关键词

  • .net
  • 属性
  • 文件
  • shell
  • dll
  • sei
  • showprops
  • shellexecuteex
  • mask
  • invokeidlist

得分解答快速导航

  • 帖主:john_christopher
  • blacklevin
  • sonicdater
  • tg123
  • tianxiaolei

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo