zoukankan      html  css  js  c++  java
  • InstallSheild 获取系统环境变量,如Desktop路径等

      使用FOLDER_DESKTOP变量获取的桌面路径可能为:C:UsersPublicDesktop

      而不是C:Users用户Desktop

      

      Copy and paste the following define statements at the beginning of your setup.rul file.

      Also, make sure you copy and paste the prototype for the SHGetFolderPathA() Windows API.

      This Windows API retrieves the path to the locations you want.  

    setup.rul  Code 
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
     
    // Define Microsoft CSIDL constants
    //定义环境变量的ID,更详细参见shlobj.h
    //参见msdn KNOWNFOLDERID
    //http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx
    #define CSIDL_DESKTOP                   0x0000        // <desktop>
    #define CSIDL_INTERNET                  0x0001        // Internet Explorer (icon on desktop)
    #define CSIDL_PROGRAMS                  0x0002        // Start MenuPrograms
    #define CSIDL_CONTROLS                  0x0003        // My ComputerControl Panel
    #define CSIDL_PRINTERS                  0x0004        // My ComputerPrinters
    #define CSIDL_PERSONAL                  0x0005        // My Documents
    #define CSIDL_FAVORITES                 0x0006        // <user name>Favorites
    #define CSIDL_STARTUP                   0x0007        // Start MenuProgramsStartup
    #define CSIDL_RECENT                    0x0008        // <user name>Recent
    #define CSIDL_SENDTO                    0x0009        // <user name>SendTo
    #define CSIDL_BITBUCKET                 0x000a        // <desktop>Recycle Bin
    #define CSIDL_STARTMENU                 0x000b        // <user name>Start Menu
    #define CSIDL_MYDOCUMENTS               CSIDL_PERSONAL //  Personal was just a silly name for My Documents
    #define CSIDL_MYMUSIC                   0x000d        // "My Music" folder
    #define CSIDL_MYVIDEO                   0x000e        // "My Videos" folder
    #define CSIDL_DESKTOPDIRECTORY          0x0010        // <user name>Desktop
    #define CSIDL_DRIVES                    0x0011        // My Computer
    #define CSIDL_NETWORK                   0x0012        // Network Neighborhood (My Network Places)
    #define CSIDL_NETHOOD                   0x0013        // <user name> ethood
    #define CSIDL_FONTS                     0x0014        // windowsfonts
    #define CSIDL_TEMPLATES                 0x0015
    #define CSIDL_COMMON_STARTMENU          0x0016        // All UsersStart Menu
    #define CSIDL_COMMON_PROGRAMS           0X0017        // All UsersStart MenuPrograms
    #define CSIDL_COMMON_STARTUP            0x0018        // All UsersStartup
    #define CSIDL_COMMON_DESKTOPDIRECTORY   0x0019        // All UsersDesktop
    #define CSIDL_APPDATA                   0x001a        // <user name>Application Data
    #define CSIDL_PRINTHOOD                 0x001b        // <user name>PrintHood
    // Prototype SHGetFolderPathA in SHFolder.dll
    //加载SHFolder.dll,这样就可以使用SHGetFolderPathA()了
    prototype NUMBER SHFolder.SHGetFolderPathA(HWND, NUMBER, NUMBER, NUMBER, BYREF STRING);


     The following example code shows you how to call the above win api function.
    setup.rul  Code 
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
    function OnBegin()
        number nFolderCSIDL;      // CSIDL value you want to use
        string szPath;                // Will contain path returned from API
        number nResult;           // Return value from API
    begin
        
    try
            szPath = 
    "";
            nFolderCSIDL = CSIDL_DESKTOP;
            nResult = SHFolder.SHGetFolderPathA(
    NULL, nFolder, NULL0, szPath);
        
    if (nResult = 0) then
            MessageBox(
    "CSIDL_DESKTOP = " + szPath, 0);
        
    else
            SprintfBox(SEVERE, 
    "CSIDL_DESKTOP""Failed(%d): %s", nResult, FormatMessage(nResult));
        endif;
    end;
  • 相关阅读:
    spring-boot 访问时,加与不加项目名分析
    关于文章
    随笔
    工作小结五
    《文章翻译》PCA&SVD
    工作小结四
    工作小结三
    从零开始实现SSD目标检测(pytorch)(一)
    工作小结二
    《论文翻译》 GIOU
  • 原文地址:https://www.cnblogs.com/MakeView660/p/8807181.html
Copyright © 2011-2022 走看看