网站首页  词典首页

请输入您要查询的计算机术语:

 

术语 CWinApp::GetProfileString
释义 CWinApp::GetProfileString

CString GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL );

返回值
返回值是应用程序的.INI文件中的字符串,如果找不到该字符串,则为lpszDefault。框架支持的字符串最大长度为_MAX_PATH。如果lpszDefault为NULL,则返回值是一个空字符串。

参数:
lpszSection指向一个以null结尾的字符串,指定了包含入口的部分。
lpszEntry指向一个以null结尾的字符串,其中包含了要获取字符串的入口。这个值不能为NULL。
lpszDefault指向给定入口的缺省字符串值,当初始化文件中找不到入口时使用该值。

说明:
调用这个函数以获得与应用程序的注册表或.INI文件中指定部分的入口相关的字符串。
这些入口按照如下方式保存:
·Windows NT 该值保存在注册表中
·Windows 3.X 该值保存在WIN.INI文件中
·Windows 95 该值保存在WIN.INI的缓冲版本中

示例:
CString strSection = "My Section";
CString strStringItem = "My String Item";
CString strIntItem = "My Int Item";
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileString(strSection, strStringItem, "test");
CString strValue;
strValue = pApp->GetProfileString(strSection, strStringItem);
ASSERT(strValue == "test");
pApp->WriteProfileInt(strSection, strIntItem, 1234);
int nValue;
nValue = pApp->GetProfileInt(strSection, strIntItem, 0);
ASSERT(nValue == 1234);

请参阅:
CWinApp::GetProfileInt, CWinApp::WriteProfileString, ::GetPrivateProfileString
随便看

 

MFC类库中文详解手册包含4274条MFC类库参考词条,基本涵盖了Microsoft基本类库中的类、全局函数、全局变量和宏的内容,是计算机编程的有利工具。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 12:24:53