注册 登录
编程论坛 VFP论坛

怎么用程序关闭这个窗口?

a1999zqw 发布于 2024-12-29 09:29, 268 次点击
只有本站会员才能查看附件,请 登录

怎么用程序关闭这个窗口?
3 回复
#2
csyx2024-12-29 10:18
不知你要关闭的登录用户还是公用的图片文件夹,提供两个常数给你选择

程序代码:
#define CSIDL_MYPICTURES        0x0027   && 我的图片文件夹
#define CSIDL_COMMON_PICTURES   0x0036   && 公用图片文件夹

Declare Long SHGetSpecialFolderPath in shell32 Long, String @, Long, Long

cPath = Replicate(Chr(0), 260)
SHGetSpecialFolderPath(0, @ cPath, CSIDL_MYPICTURES, 0)
cPath = Rtrim(cPath, Chr(0))

oShell = NewObject('Shell.Application')
For each ow in oShell.Windows
    If ('explorer.exe' $ Lower(ow.FullName)) ;
            and (ow.Document.folder.self.path == m.cPath)
        ow.Quit
        Exit
    EndIf
EndFor

#3
a1999zqw2024-12-30 15:26
要关闭任意的文件夹,查找文件或文件夹的这个窗口,需要关闭,可能是c盘下的某个目录地址,也可能是E盘下的某个文件夹,也可能是F盘下的
#4
csyx2024-12-30 15:35
方法给你了,判断 ow.Document.folder.self.path 是不是要关闭的文件夹窗口即可。如果还不会用,当我没说
1