使用C语言获取文件夹地址的方法收藏
发布日期:2021-05-10 16:05:56 浏览次数:10 分类:精选文章

本文共 2756 字,大约阅读时间需要 9 分钟。

���������C������������������������������������������������������������

���������C������������������������������������������������������ Windows API ������ SHGetFolderPath������������������������������������������������������������������������������������������������������������������������������������������������������������������������

CSI D ������������������

��������� SHGetFolderPath ��������������������������� CSI D ���������CSI D ������������������������������������������������������������ CSI D ���������������

  • CSIDL_COMMON_ADMINTOOLS (0x0002082F) ���������������������������������������
  • CSIDL_APPDATA (0x0001A13F) ���������������������������������������
  • CSIDL_DESKTOPDIRECTORY (0x00000010) ���������������������������
  • CSIDL_COMMON_DOCUMENTS (0x0002090D) ���������������������������������

������������������������������ CSI D ���������������������������������������������

������������������������������������

������������������������������������������������������������������

  • ������������������������������']===',><DualBuffer���'><<<
  • ��������������������������������������������� API ���������������������������

    • #include <stdio.h>
    • #include <stdlib.h>
    • #include <shlobj.h>
    1. ������������������
    2. ���������������������������������������������

      int argc, argv

      ������ sized TCHAR szPath[MAX_PATH]; ������������������������������������������

      1. ������ SHGetFolderPath ������
      2. ������ SHGetFolderPath ������������������������������������������

        HWND cwd(hwndParent)

        int cid Cooleruaiad pclidFlags

        PVOID pWorkDir

        int reserved

        SZ ePath

        ���������������������������������������������������������������������������������

        void main(int argc, char* argv) {TCHAR szPath[MAX_PATH];if (SUCCEEDED(SHGetFolderPath(NULL,CSIDL_COMMON_ADMINTOOLS | CSIDL FLAG CREATE,NULL,0,szPath))) {printf(szPath);printf("/n");}}

        ������������

        • CSI D FLAG ��������������� CSI D FLAG ��������������������� SHGetFolderPath ���������������������������CSIDL FLAG CREATE ���������������������������������
        • HRESULT ������������������������������������������������������

        ������ CSI D ���������������

        ��������� CSI D ������������������������������

        CSI D ������ ������������ ������������
        CSIDL_COMMON_ADMINTOOLS ��������������������������� C:\Program Files\Microsoft ActiveX\Configuration
        CSIDL_APPDATA ��������������������������������� C:\Users\username\AppData\Roaming
        CSIDL_DESKTOPDIRECTORY ������������������������������ C:\Users\username\desktop
        CSIDL_COMMON_DOCUMENTS ��������������������������������� C:\Users\username\Documents

        ������

        ������������ SHGetFolderPath ��������� CSI D ������������������������������ C ������������������������������������������������������ CSI D ���������������������������������������������������������������������������������������������������������������������������

    上一篇:VC/MFC(C++)实现文件拷贝和文件删除等
    下一篇:获取并修改文件时间

    发表评论

    最新留言

    路过,博主的博客真漂亮。。
    [***.116.15.85]2025年04月02日 23时10分22秒