getprofiledir.pm

来自「此程序是本人编写的在MFC环境下调用Matlab函数进行编程的实例」· PM 代码 · 共 54 行

PM
54
字号
package getprofiledir;# $Revision: 1.2 $use Exporter ();@ISA = qw(Exporter);@EXPORT = qw(get_user_profile_dir);use Win32::Registry;use strict;# This function is responsible for obtaining the directory name in which# mexopts.bat and mbuildopts.bat should be stored.sub get_user_profile_dir{# outputs:    my ($userProfile);    # UserProfile environment variable is set by NT only.    $userProfile = $ENV{'UserProfile'};    if ($userProfile eq "")    {        my ($RegKey, $RegValue, $hkey, $value, %values);        # ProfileReconciliation is set on Win95/98 if User Profiles are         # enabled.        if ($main::HKEY_CURRENT_USER->Open("Software\\Microsoft\\Windows\\" .                                           "CurrentVersion\\ProfileReconciliation",                                           $hkey))        {            $hkey->GetValues(\%values);            foreach $value (keys(%values))            {                $RegKey = $values{$value}->[0];                $RegValue = $values{$value}->[2];                if ($RegKey eq "ProfileDirectory") {                    $userProfile = $RegValue;                }            }            $hkey->Close();        }        if ($userProfile eq "")        {            $userProfile = $ENV{'windir'};        }    }    $userProfile .= "\\Application Data\\MathWorks\\MATLAB\\R12";    $userProfile;} # get_user_profile_dir

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?