ini 文件 里面写的这些内容6666是什么意思思

哪位知道手机字体那个ini文件里面的具体意思_百度知道
哪位知道手机字体那个ini文件里面的具体意思
自由更换字体FontRouterLT的FontRouter.ini逐行详解下面内容是 中文解释 !的FontRouter.ini文件。; FontRouter LT 设置文件,注释行第一字符必须是 “;”[Global]; 全局选项区段,其中的所有选项均影响整体功能或者效果。Enable=1; 是否开启FontRouter.; 缺省: 1NativeFont=1; 1-支持GDR字体,0-不支持GDR字体; 缺省: 1LogLevel=1; 日志详细程度: 1-只记录致命错误, 2-只记录错误, 3-只记录警告, 4-记录所有信息, 5-记录运行bug; 日志所在路径&C:\Logs\FontRouter& ; 缺省: 4ForceAntiAliased=4; 位图字体设置(仅在SymbianOS 7或以上版本系统起作用);
0 - 默认效果;
1 - 倾向于“单色点阵效果” ;
2 - 强制“单色点阵效果” ;
3 - 倾向于“反锯齿效果” ;
4 - 强制“反锯齿效果” ;
5 - 倾向于Symbian 9.2的Sub-pixel点阵格式;
6 - 强制Symbian 9.2的Sub-pixel点阵格式; 缺省: 4FixFontMetrics=1; 东亚字体修正; 0 - 不修正; 1 - 模拟Nokia中文字体修正; 缺省: 0FixCharMetrics=1; 对FixFontMetrics不适当修正进行自动修正;
0 - 不修正;
1 - 自动修正; 缺省: 0; 不启用的字体文件,必须是绝对路径如:;DisableFontFile=Z:\Resource\Fonts\S60SC.ccc;DisableFontFile=S60TCHK.cccZoomRatio=100ZoomMinSize=0ZoomMaxSize=48; ZoomRatio用于所有字体的按比例缩放,取值为百分比(不含“%”),默认值为100。 ; ZoomMinSize、ZoomMaxSize限制全局字体比例缩放的作用范围。Chroma=100; 用于调节开启反锯齿显示效果后的字体笔画深浅度,取值为百分比(不含“%”),默认值为100。(对未开启反锯齿效果的字体无效).ExtraFontFile=\Data\Fonts\*.*; 扩展字体导入路径.[FontMap];字体映射区段*=*=*; 格式:字体名[@字体高度]=字体名[@字体高度][:字体参数] ,字体名[@字体高度][:字体参数];
字体名[@字体高度]=字体名[@字体高度][:字体参数]
字体名[@字体高度]= ;;其中,第一种格式是标准的中英文分别映射至不同字体;第二种格式表示不区分中英文字体,均用“替代字体”;第三种格式表示FontRouter将忽略这个请求的字体,而交给Symbian本身的字体机制处理(就好像没有FontRouter存在的效果)。 ;字体名:字体文件中定义的字体名称,而非字体文件名(通常你需要从字体提供商那里获得字体文件中包含的字体名称,考虑在FontRouter下一个版本中增加显示字体名的功能)。 ;字体高度:单位是点阵,如果不包含则表示匹配所有字体高度的请求。注意,Symbian系统在请求字体时所使用的高度并不一定是字体的是实际高度,所以通常情况下,不建议指定字体高度。 ;字体名-的含义同上。这里的字体高度是指选择作为实际显示字体的高度。注意,点阵字体通常只包含一种或少数几种确定的字体高度,而TrueType字体则支持较大范围内任意的字体高度,所以对于点阵字体,实际显示的字体高度只是与这里指定值最接近的高度,不一定完全相等。 ;字体参数-可以对显示字体作特殊属性的调整:;
强制反锯齿;
相当Y轴偏移进行调整(n 是不调整);
字距(n 是不调整);
行距(n 是不调整);
缩放(缺省: 100);
颜色(缺省: 100);其中“Y”代表对字体的Y轴偏移进行调整,在未指定此参数时,FontRouter会自动根据中英文字体的关系计算出最佳的Y轴偏移。但实际由于字体格式的复杂性,自动计算的Y轴偏移可能并不是效果最好的,这时就需要使用“Y”参数进行调整了。在字母Y之后紧接调整的具体数值即可,例如 LatinBold13:Y-2 或 LatinPlain12:Y1。 ; “A”和“a”分别表示强制使用“反锯齿”效果 及 强制使用“单色”效果。这一参数比全局的ForceAntiAliased拥有更高优先级。 ;  参数搭配使用时,只需连续书写即可,例如:Arial:Y-1A 或 Arial:AY-1。 ;
Sans MT 936_S60=*;
Sans MT [email=936_S60@11=Microsoft]936_S60@11=Microsoft[/email] YaHei;
Sans MT [email=936_S60@12=Microsoft]936_S60@12=Microsoft[/email] [email=YaHei@15:Y-1]YaHei@15:Y-1[/email]
时间 日历 功能表 信息预览及信息文件夹字体;
Sans MT [email=936_S60@16]936_S60@16[/email]
待机时快捷字体 选项字体 菜单 名片Sans MT 936_S60 中国移动 短信字体 功能表上栏标签 ;
Sans MT 936_S60=FrLt [email=DFGirl@18:Y1]DFGirl@18:Y1[/email]
中国移动 短信字体 功能表上栏标签;
Sans MT [email=936_S60@24=FZLiBian-S02:W1]936_S60@24=FZLiBian-S02:W1[/email];
Sans MT [email=936_S60@30]936_S60@30[/email]=; S60 3rd专用选项Series 60 ZDigi=; UIQ3专用选项Monospaced=Eikon=Symbol=Calc=Calcinv=Digital=
其他类似问题
ini文件的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁&&&&&&&&&&&&&&&&&&
posts - 222,comments - 15,trackbacks - 0
在VC程序中利用系统提供的GetPrivateProfileString及WritePrivateProfileString函数直接读写系统配置ini文件(指定目录下的Ini文件)
假设在当前目录下有一个文件名为Tets.ini的文件用于保存用户名和密码文件格式如下:[Section1]Item1=huzhifengItem2=1234565
1.写INI文件void CINI_File_TestDlg::OnButtonWrite() {// TODO: Add your control notification handler code here
CString strSection&&&&&&& = "Section1";&& CString strSectionKey&&&& = "Item1";char strBuff[256];&& CString strValue&&&&&&& = _T("");CString strFileP
strFilePath=GetCurrentDirectory(256,strBuff);&& //获取当前路径strFilePath.Format("%s\\Test.ini",strBuff);
GetDlgItemText(IDC_EDIT_NAME,strValue);&&&&& //获取文本框内容:即姓名WritePrivateProfileString(strSection,strSectionKey,strValue,strFilePath);&& //写入ini文件中相应字段
strSectionKey="Item2";GetDlgItemText(IDC_EDIT_PASSWORD,strValue);&&& //获取文本框内容:即密码WritePrivateProfileString(strSection,strSectionKey,strValue,strFilePath);}
2.读INI文件内容void CINI_File_TestDlg::OnButtonRead() {// TODO: Add your control notification handler code hereCString strSection&&&&&&& = "Section1";&& CString strSectionKey&&&& = "Item1";char strBuff[256];CString strValue&&&&&&& = _T("");CString strFileP
strFilePath=GetCurrentDirectory(256,strBuff);&& //获取当前路径strFilePath.Format("%s\\Test.ini",strBuff);
GetPrivateProfileString(strSection,strSectionKey,NULL,strBuff,80,strFilePath); //读取ini文件中相应字段的内容strValue=strBSetDlgItemText(IDC_EDIT_NAME,strValue);
strSectionKey="Item2";GetPrivateProfileString(strSection,strSectionKey,NULL,strBuff,80,strFilePath);strValue=strBSetDlgItemText(IDC_EDIT_PASSWORD,strValue);
UpdateData(FALSE);}
阅读(...) 评论()您所在的位置: &
INI文件的操作
INI文件的操作
机械工业出版社
《网络扫描技术揭秘:原理、实践与扫描器的实现》第2章网络协议和网络编程例程,本章着眼于现在网络,特别是互联网中网络协议的意义,以及如何通过协议进行编程,由浅入深,逐步分析了网络协议的各项技术细节。本节为大家介绍INI文件的操作。
2.2.3&& INI文件的操作
程序开发的早期,数据库的发展还没有那么成熟,所以数据一般都保存在自己定义的文件中,这种自己定义的文件格式由于没有统一的约定,因而不能相互通用。为了解决这一问题,在早期的Windows程序设计中,定义了一种INI(Initial)文件格式,并且可以通过API直接对文件格式进行访问。
INI文件是一种纯文本保存格式,扩展名是“ini”,内容以“行”为单位,即每次操作的时候,可以对其中的一行进行操作。如下面一段,就是一个典型的INI文件格式:[Init] &BeginIP=192.168.0.1 &EndIP=192.168.1.254 &&[List] &Count=3&IP1=192.168.0.1 &Port1=80&IP2=192.168.0.2 &Port2=21&IP3=192.168.0.3 &Port3=23&
在上述INI文件格式中,所有内容都以行为单位。空行通常是为了增加可读性而人为设置的,空行的位置和多少并不影响INI文件的正常使用,在不考虑空行的情况下,每一行的内容格式主要包括以下两种类型:
[段名]:这种行称为段行,段行相当于文章中段的标题。由当前段名开始,到下一个段名之前的内容称为一段(segment)。各段的段名不能重复。
键名=字符串:这种行即是内容行,其中的字符串由等于号之后的第一个字符一直到回车前的全部内容。同一个段的键名不能重复,不同段的键名可以重复。
由此可见,该文件的操作是一个二维的,在程序设计中,段名、键名都是用户自己设定的,即具体使用多少个段名、每个段中使用多少个变量名都由用户自己设定。同时一个程序可以对多个互不相同的INI文件进行操作,对INI文件的操作,主要有包括“读”和“写”两个操作,每一个操作都要同时指定“INI文件名”、“段名”和“键名”,每次操作的时候在文件中显示为一个行,在逻辑上显示为一个由“段名.键名”组成二维值。
在讲这两个操作之前,需要先说明一下在使用过程中的一些约定。因为INI文件是纯文本文件,用户可以直接用记事本等编辑工具直接对其进行修改,因此会使数据的完整性、互异性、正确性遭到破坏。为此特约定如下:
在读写的时候,如果该文件不存在、段名不存在或者变量不存在,则在读、写操作的时候并不报错。如果是读操作,则直接按命令中约定进行操作;如果是写操作,则自动创建这样的文件,然后写入要写的数据。
如果段名出现重复,或同一段中的变量名出现重复,则读写操作时以第一个段的第一个变量名为准。
由于要读取的值由键名后的等号“=”之后开始,到回车之前的所有内容,所以如果要对键名进行注释,则不要把注释写到该行的后面,否则会作为内容被一起读取而导致出错。如果确实要注释,可以另起一行另用一个键名来注释。
如前所述,针对INI文件,主要只有读和写两个操作,考虑到实际使用中的需要,又将读取分为读字符串和读整数两种,共计三个API函数,下面分别介绍。
1. 读字符串DWORD&GetPrivateProfileString( &&&LPCTSTR&&&lpAppName, &&&LPCTSTR&&&lpKeyName,& &&&LPCTSTR&&&lpDefault,& &&&LPTSTR&&&&lpReturnedString, &&&DWORD&nSize, &&&LPCTSTR&&&lpFileName);&
2. 读整数UINT&GetPrivateProfileInt( &&&LPCTSTR&&&lpAppName, &&&LPCTSTR&&&lpKeyName,& &&&INT&&&nDefault,& &&&LPCTSTR&&&lpFileName);&
3. 写字符串BOOL&WritePrivateProfileString( &&&LPCTSTR&&&lpAppName,& &&&LPCTSTR&&&lpKeyName,& &&&LPCTSTR&&&lpString,& &&&LPCTSTR&&&lpFileName);&
以上三个API函数的参数都类似,所以一并如下说明:
lpAppName:要读取或设置的段名。
lpKeyName:要读取或设置的键值。
lpDefault:当要读取一个字符串时,如果所读的INI文件不存在,或要读的段名不存在,或键名不存在时,则将该字符串作为默认字符串返回,所返回的字符串在lpReturnedString中,长度在nSze中。
lpReturnedString:在读取字符串的时候,所读取的字符串返回到该指针所指向的缓冲区中。
nSize:指名lpReturenedString缓冲区的长度,以字节为单。
nDefault:在读整数型数据的时候,如果所读的INI文件不存在,或段名不存在,或键值不存在的时候,则将该值作为默认值返回。
lpString:在写入文件时,要写入的字符串。
lpFileName:INI文件的路径名,该路径名可以是全路径,也可以是相对路径。
由于后面程序中,几乎每个程序都会使用到INI文件,并且各程序所用的风格一致,所以需要在这里统一进行说明。为了方便说明,假设文件的格式如前面例子所示。
首先,程序在运行的时候,通常需要从配置文件中读取一些参数作为系统中各变量的初始值,因此首先假设该文件已经存在,并且文件存在当前目录下,文件名为“Scaner.ini”,下面可以在程序初始化的时候,读取这些默认值:</P
/*由于文件名经常使用,所以可以先用一个宏定义定义要用的文件名。该文件可以放到任何使用以上函数的前面。*/ &
#define&INIFLIENAME&&".\\Scaner.ini" &
#define&MAXLISTCOUNT&1000 &
//假设从INI文件中读取的值保存到下面的变量中。 &
CString&m_strBeginIP,m_strEndIP;&&&&//假设要读到的IP分别存于此变量 &
UINT&m_uC&&//上面列表中,有效个数 &
CString&m_strIP[MAXLISTCOUNT];&&//保存列表中的IP &
UINT&m_uPort[MAXLISTCOUNT]&&//保存端口值 &
//初始化,从INI文件中读取各变量名 &
char&buff[MAX_PATH];&&&&//定一个用于读取的缓冲区。 &
GetPrivateProfileString("Init","BeginIP","192.168.0.1",buff,MAX_PATH,INIFILENAME); &
m_strBeginIP.Format("%s",buff);&//假设读到了BeginIP读到m_strBeginIP中。 &
GetPrivateProfileString("Init","EndIP","192.168.0.254",buff,MAX_PATH,INIFILENAME); &
m_strEndIP.Format("%s",buff);&&&//假设读到了EndIP读到m_strEndIP中。 &
//读取列表 &
UINT&m_uCount&=&GetPrivateProfileInt("List","Count",0,INIFILENAME);//读列表个数 &
if&(m_uCount&=&MAXLISTCOUNT) &
&&&&&m_uCount&=&MAXLISTCOUNT; &
CString&strI &
for&(int&i=0;i&;i++) &
&&&&strItem.Format("IP%d",i+1); &
&&&&GetPrivateProfileString("List",strItem,"",buff,MAX_PATH,INIFILENAME); &
&&&&m_strIP[i].Format("%s",buff); &
&&&&strItem.Format("Port%d",i+1); &
&&&&m_uPort[i]=GetPrivateProfileInt("List",strItem,0,INIFILENAME); &
&&&&if&(m_strIP[i]==""&||&m_uPort[i]==0) &
&&&&&&&&&m_iCount=i; &
其次,要将当前数据保存到INI文件中,只需要按下面方式即可。
//程序退出时,将各变量写入到INI文件中 &WritePrivateProfileString("Init","BeginIP",m_strBeginIP,INIFILENAME); &WritePrivateProfileString("Init","EndIP",m_strEndIP,INIFILENAME); &&//写入列表 &CString&strItem,strV &strValue.Format("%d",m_uCount);//列表个数 &WritePrivateProfileString("List","Count",strValue,INIFILENAME); &for&(int&i=0;i&;i++) &{ &&&&&strItem.Format("IP%d",i+1); &&&&&WritePrivateProfileString("List",strItem,m_strIP[i],INIFILENAME); &&&&&strItem.Format("Port%d",i+1); &&&&&strValue.Format("%d",m_uPort[i]); &&&&&WritePrivateProfileInt("List",strItem,strValue,INIFILENAME); &}&
与用户自己定义的文件格式相比,采用INI格式,并使用系统API进行读写操作时,用户不需要判断文件是否存在,不需要考虑指定的段号或变量名是否存在,而只需要读取即可,这种具有良好容错性的机制大大减少了程序运行中的异常出错等可能,程序执行中,也不会因为上述问题而导致异常,影响程序的正常运行。
但这种方式有时也会带来一些潜在的问题,因为当INI文件不存在或INI文件存在但要读的键名不存在时,函数会在读取不到时返回预设的默认值,因此用户通常不知道自己读取的数据是从INI文件里读取的数据,还是要读的数据是因键名不存在而返回的默认值。
综上所述,可以发现,INI文件只适合于数据量很小,并且不频繁读写的情况下。
【责任编辑: TEL:(010)】&&&&&&
关于&&&&的更多文章
这本书是写给程序员和项目经理的。作者结合自身的丰富成长历程,
本书描述了黑客用默默无闻的行动为数字世界照亮了一条道路的故事。
高效管理SQL Server的提示、技巧和解决方案
不管是创建桌面程序、构建Web应用或是开发自己的Windo
多年来,Imar Spaanjaars一直是ASP.NET相关图书的畅销
SQL(结构化查询语言)是数据库系统的通用语言,利用它可以用几乎同样的语句在不同的数据库系统上执行同样的操作,在数据库系统的
51CTO旗下网站现有Config.ini初始化文件内容如下:
#----------------- message connect info
app.message.connectinfo.device=COM5
app.message.connectinfo.baudrate=9600
app.message.connectinfo.sn=WEIY-DQVO-EVUD-QODU
#----------------- ftp logon info
app..hostip=10.111.0.220
app..port=21
app..username=PSMS/ftp
app..password=ftp
app..filepath=
#----------------- Platform name
mon.sysname=山西公安厅网上督察平台
#----------------- db connection--
connectionUrl=jdbc:oracle:thin:@10.111.0.220:1521:orcl
userName=shanxi
passWord=shanxi
请问我怎么将 db connection 下的属性 数据库地址 用户名和密码 读取出来 然后写入applicationContext.xml文件中
替换内容为中的 地址和用户名 密码
&bean id="dataSource" class="com.mchange.boPooledDataSource" destroy-method="close"&
&property name="driverClass" value="oracle.jdbc.driver.OracleDriver" /&
&property name="jdbcUrl" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl" /&
&property name="user" value="yuncheng" /&
&property name="password" value="yuncheng" /&
&property name="minPoolSize" value="1" /&
&property name="maxPoolSize" value="5" /&
&property name="maxIdleTime" value="180" /&
&/bean&
或者是替换reportConfig.xml文件中的 链接地址 和用户名
&jdbc-ds-configs&
&jdbc-ds-config&
&name&sheng&/name&
&db-type&oracle&/db-type&
&connection-url&jdbc:oracle:thin:@10.111.0.220:1521:orcl&/connection-url&
&driver-class&oracle.jdbc.driver.OracleDriver&/driver-class&
&user-name&shanxi&/user-name&
&password&shanxi&/password&
&db-charset&gbk&/db-charset&
&client-charset&gbk&/client-charset&
&extend-properties&&/extend-properties&
&/jdbc-ds-config&
&/jdbc-ds-configs&
谢谢了 !!先感激下 最好用JAVA解决 就写一个简单的JAVA工程DEMO&&& MAIN方法 实现即可&
解析配置文件,解析xml,修改xml,dom操作啊...不是很多实现么...dom4j,jdom等
已解决问题
未解决问题mW屺惆鸦匾湫丛谏忱铮牙硐肟痰窖沂,be Myself(原创文字,谢绝转载)m.べ_uq★
字号:大 中 小
windows---
Windows.wps.bmp
windows+&&*?\
Visual c++
CFileMFCI/Osocket
HookHookHookDLLDLLHook
ASCII12800-127ASCII0ASCII48
ASCII1281128-255ASCII
GB23122ASCII100111206 167 53671206*256+167ASCIIASCII0011
1.2.3.4.5.
1.定义文件变量
CStdioFile
f1CStdioFile f1;
2.打开指定文件
CStdioFile
CStdioFile(LPCTSTR lpszFileName,UINT nOpenFlags);
lpszFileName
nOpenFlags|
CFile::typeText
CFile::typeBinary
CFile::modeCreateCFile::modeNoTruncate
CFile::modeNoTruncate0
CFile::modeRead
CFile::modeReadWrite
CFile::modeWrite
CFile::shareDenyNone
CFile::shareExclusive
CFile::shareDenyRead
CFile::shareDenyWrite
CStidoFileCStdioFile::Open()Open
BOOL Open(LPCTSTR lpszFileName,UINT nOpenFlags,CFileException* pError=NULL);
AppWizardButton
&&&&&& char * pszFileName="C:\\myfile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(!myFile.Open(pszFileName,CFile::modeCreate|CFile::typeText|CFile::modeRead),&fileException)
&&&&&&&&&&&&& TRACE("Can't open file %s, error = %u\n",pszFileName,fileException.m_cause);
C:\myfile.txt
3.向从文本文件中写入信息
CStdioFileWriteStringWriteString
void WriteString(LPCTSTR lpsz);
WriteStringlpsz”\0”
WriteStringWriteString\n
myFile.WriteString(“1\n”)
&&&&&& char* pszFileName="C:\\myfile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(pszFileName,CFile::typeText|CFile::modeCreate|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& myFile.WriteString("1\n");
&&&&&&&&&&&&& CString strO
&&&&&&&&&&&&& strOrder.Format("%d,%.3f",66,88.88);
&&&&&&&&&&&&& myFile.WriteString(strOrder);
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s,error=%u\n",pszFileName,fileException.m_cause);
C:\myfile.txt
4.从文本文件中读取信息
CStidoFileReadStringReadString
virtual LPTSTR ReadString(LPTSTR lpsz, UINIT nMax);
ReadString
lpsz ”\0”
nMax\0nMax-1
ReadStringLPTSTRNULL
ReadString
BOOL ReadString(CString& rString);
CStringFALSE
ReadString
&&&&&& char* pszFileName="C:\\myfile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(pszFileName,CFile::typeText|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& myFile.SeekToBegin();
&&&&&&&&&&&&& CString str1;
&&&&&&&&&&&&& myFile.ReadString(str1);
&&&&&&&&&&&&& CString str2;
&&&&&&&&&&&&& myFile.ReadString(str2);
&&&&&&&&&&&&& AfxMessageBox(str1+str2);
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s,error=%u\n",pszFileName,fileException.m_cause);
&&&&&& myFile.Close();
5.关闭文件
CStdioFile::Close
myFile.Close();
1.路径错误
&&&&&& char * pszFileName="C:\\Windows\\MyFile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(!myFile.Open(pszFileName,CFile::modeCreate|CFile::typeText|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& //
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s, error = %u\n",pszFileName,fileException.m_cause);
&&&&&& myFile.Close();
&&&&&& windowsMyTextFile.txtC:\WindwosC:\Winnt,
&&&&&&&&&&&&&
&&&&&&&&&&&&& //windows
&&&&&& LPTSTR lpBuffer=new char[MAX_PATH];
&&&&&& ::GetWindowsDirectory(lpBuffer,MAX_PATH);
&&&&&& strcat(lpBuffer,"\\MyFile.txt");
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(lpBuffer,CFile::typeText|CFile::modeCreate|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& //
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s, error = %u\n",pszFileName,fileException.m_cause);
&&&&&& CString strFileTitle="MyFile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(strFileTitle,CFile::typeText|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& //
&&&&&& &&&&&& myFile.WriteString("");
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s, error = %u\n",pszFileName,fileException.m_cause);
&&&&&& myFile.Close();
2.操作文件不存在
MyFile.txtWriteString
&&&&&& CString strFileTitle="MyFile.txt";
&&&&&& CFileF
&&&&&& if(finder.FindFile(strFileTitle))
&&&&&&&&&&&&& CStdioFile myF
&&&&&&&&&&&&& CFileException fileE
&&&&&&&&&&&&& if(myFile.Open(lpBuffer,CFile::typeText|CFile::modeCreate|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&& }
&&&&&&&&&&&&& else
&&&&&&&&&&&&& {
&&&&&&&&&&&&& TRACE("Can't open file %s, error = %u\n",pszFileName,fileException.m_cause);
&&&&&&&&&&&&& }
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't find file %s\n",strFileTitle);
&&&&&& myFile.Close();
3.超越文件权限进行读写操作
&&&&&& CString strFileTitle="MyFile.txt";
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(strFileTitle,CFile::typeText|CFile::modeCreate|CFile::NoTruncate|CFile::modeRead),&fileException)
&&&&&&&&&&&&& //
&&&&&&&&&&&&& myFile.WriteString("!");
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s,error=%u\n",strFileTitle,fileException.m_cause);
&&&&&& myFile.Close();
&&& myFile.Open("MyFile.txt",CFile::modeCreate|CFile::typeText|CFile::modeReadWrite);
&&& TCHAR FilePath[MAX_PATH];
&&& GetModuleFileName(NULL,FilePath,MAX_PATH);
&&&&&& (_tcstchr(FilePath,'\\'))[1]=0;
&&&&&& lstrcat(FilePath,_T("MyFile.txt"));
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open(FilePath,CFile::modeCreate|CFile::typeText|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& //
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file %s,error=%u\n",FilePath,fileException.m_cause);
&&&&&& myFile.Close();
&&&&&& CStdioFile myF
&&&&&& CFileException fileE
&&&&&& if(myFile.Open("MyFile.txt",CFile::modeCreate|CFile::modeNoTruncate|CFile::typeText|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&& CString strC
&&&&&&&&&&&&& int order=1;
&&&&&&&&&&&&& while(myFile.ReadString(strContent))
&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& if(2==order)
&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& AfxMessageBox(strContent);
&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&& &&&&&& order=order+1;
&&&&&&&&&&&&& }
&&&&&& else
&&&&&&&&&&&&& TRACE("Can't open file");
&&&&&& myFile.Close();
客户操作记录实例
DLLHookDLL
2TestHook.h
5CKeyboradHook
HookTestprojectprojectMFC AppWizard(DLL),DLLMFC Extension DLL(using shared MFC DLL)
File-&NewMFC AppWizard(DLL).
project nameHookTestlocationCreate new workspaceplatFormsWin32
OKDLLMFC Extension DLLusing shared MFC DLL.
IDEFileViewHookTest.cppHookTest.hvisual C++6.0TestHook.h
2TestHook.h
FileNewNewfilesC/C++ Header File.
add to projectHookTestlocationfileHookTest.hOKIDEHooktest.h
TestHook.h
#if _MSC_VER&1000
#pragma once
#endif //_MSC_VER&1000
class AFX_EXT_CLASS CHookTest:public CObject
&&&&&& CHookTest();
&&&&&& ~CHookTest();
&&&&&& BOOL StartHook();//StartHook()
&&&&&& BOOL StopHook();//StopHook()
HookTest.cpp
CString cskey[TOTAL_KEYS]=
&&&&&& "BACKSPACE",
&&&&&& "TAB",
&&&&&& ……
&&&&&& "F12",
int nkey[TOTAL_KEYS]=
&&&&&& 0X08, //"BACKSPACE",
&&&&&& 0X09, //"TAB",
&&&&&& 0x7b,//"F12",
#pragma data_seg("mydata")
HHOOK glhTestHook=NULL;
HINSTANCE glhkInstance=NULL;
#pragma data_seg()
&&&&&& if (dwReason == DLL_PROCESS_ATTACH)
&&&&&&&&&&&&& TRACE0("HOOKTEST.DLL Initializing!\n");
&&&&&&&&&&&&& //DLL
&&&&&&&&&&&&& if (!AfxInitExtensionModule(HookTestDLL, hInstance))
&&&&&&&&&&&&&&&&&&&& return 0;
&&&&&&&&&&&&& //DLLMFC
&&&&&&&&&&&&& new CDynLinkLibrary(HookTestDLL);
&&&&&&&&&&&&& //DLL
&&&&&&&&&&&&& glhkInstance=hI
&&&&&& else if (dwReason == DLL_PROCESS_DETACH)
&&&&&&&&&&&&& TRACE0("HOOKTEST.DLL Terminating!\n");
&&&&&&&&&&&&& //
&&&&&&&&&&&&& AfxTermExtensionModule(HookTestDLL);
&&&&&& return 1; &&// ok
5CKeyboradHook
//KeyboradProc
LRESULT WINAPI KeyboradProc(int nCode,WPARAM wParam,LPARAM lParam)
&&&&&& for(int i=0;i&TOTAL_KEYS;i++)
&&&&&&&&&&&&& if(nkey[i]==(int)wParam)
&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& int nKeyStatus=lParam &0x;
&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&& switch(nKeyStatus)
&&&&&&&&&&&&&&&&&&&& case 0://WM_KEYUP
&&&&&&&&&&&&&&&&&&&&&&&&&&& //case 0x://WM_KEYUP
&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& char* pszFileName="C:\\myfile.txt";
&&&&&&&&&&&&&&&&&&&&&&&&&&& CStdioFile myF
&&&&&&&&&&&&&&&&&&&&&&&&&&& CFileException fileE
&&&&&&&&&&&&&&&&&&&& &&&&&& if(myFile.Open(pszFileName,CFile::typeText|CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite),&fileException)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& myFile.SeekToEnd();
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& myFile.WriteString(cskey[i]);
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& TRACE("Can't open file %s,error=%u\n",pszFileName,fileException.m_cause);
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&& }
&&&&&& //CallNextHookEx
&&&&&& return CallNextHookEx(glhTestHook,nCode,wParam,lParam);
//****************************
BOOL CHookTest::StartHook()
&&&&&& glhTestHook=SetWindowsHookEx(WH_KEYBOARD,KeyboradProc,glhkInstance,0);
&&&&&& if(glhTestHook!=NULL)
&&&&&&&&&&&&& return TRUE;
&&&&&& return FALSE;
//****************************
HHOOK SetWindowsHookEx(int idHook,HOOKPROC lpfn,INSTANCE hMod,DWORD dwThreadId)
idHook:WH_KEYBOARDWH_MOUSE
hMod:NULLDLL
dwThreadId:NULL.
SetWindowsHookEx
StartHookKeyboradProcnkeywParamIParam
//****************************
BOOL CHookTest::StopHook()
&&&&&& BOOL bResult=FALSE;
&&&&&& if(glhTestHook)
&&&&&&&&&&&&& bResult=UnhookWindowsHookEx(glhTestHook);
&&&&&&&&&&&&& if(bResult)
&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& glhTestHook=NULL;
&&&&&&&&&&&&& }
&&&&&& return bR
//****************************
Windowswin.ini
INIwindowsASCIIiniinitialization fileprofile
windowswindowswin.iniWM_WININICHANGEwin.ini
-entry-value pairsINI
INI=3INI10
Windows6API
GetPrivateProfileInt: INI
GetPrivateProfileString:
GetProfileIntwin.ini
WritPrivateProfileString
WriteProfileStringwin.ini
3---GetPrivateProfileStringGetPrivateProfileIntWritePrivateProfileString
1. INI文件的写过程
BOOL WritePrivateProfileString(LPCTSTR lpAppName,LPCTSTR lpKeyName,LPCTSTR lpString,LPCTSTR lpString,LPCTSTR lpFileName);
lpAppNameINI
lpKeyNamelpAppName
lpStringLPCTSTRCString
lpFileNameINI
C:\student.ini
&&&&&& CString strName,strT
&&&&&& int nA
&&&&&& strName="";
&&&&&& nAge=12;
&&&&&& ::WritePrivateProfileString("Info","Name",strName,"C:\\student.ini");
&&&&&& strTemp.Format("%d",nAge);
&&&&&& ::WritePrivateProfileString("Info","Age",strTemp,"C:\\student.ini");
Cstudent.ini
2. INI文件的读过程
DWORD GetPrivateProfileString(LPCTSTR lpAppName,LPCTSTR lpKeyName,LPCTSTR lpDefault,LPTSTR lpReturnedString,DWORD nSize,LPCTSTR lpFileName);
WritePrivateProfileString
lpDefaultINI
lpReturnedStringINI
lpReturnedStringINICString
lpFileNameINI
C:\student.ini
&&&&&& CString strStudN
&&&&&& int nStudA
&&&&&& GetPrivateProfileString("Info","Name","",strStudName.GetBuffer(MAX_PATH),MAX_PATH,"C:\\student.ini");
&&&&&& //UINT GetPrivateProfileInt(LPCTSTR lpAppName,LPCTSTR lpKeyName,INT nDefault,LPCTSTR lpFileName);
&&&&&& nStudAge=GetPrivateProfileInt("Info","Age",10,"C:\\student.ini");
strStudNamenStudAge
CString strName,strT
strName=””;
::WritePrivateProfileString(“Info”,”Name”,strName,”c:\\Info\student.ini”);
C:\InfoINI
WIN32_FIND_DATA
HANDLE hFind=FindFirstFile(“C:\\Info”,&fd);
If((hFind!=INVALID_HANDLE_VALUE)&&(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
AfxMessageBox(“”)
AfxMessageBox(“”)
FindClose(hFind);
C:\Infovisual C++\\visual C++\\\C:\\Info.
INIINIlpFileNamestudent.iniINIINIwindows
lpFileName.\\student.ini
CString strTemp,strTempA;
int nCount=6;
for(i=0;i&nCi++)
strTemp.Format(“%d”,i);
strTemp.Format(“%s%d%s”,”File”,i,”.txt”);//
::WritePrivateProfileStirng(“UseFileName”,”FileName”+strTemp,strTempA,”c:\\usefile.ini”);
strTemp.Format(“%d”,nCount);
::WritePrivateProfileString(“FileCount”,”Count”,strTemp,”C:\\usefile.ini”);
Cuserfile.ini
&&&&&& CString strTemp,strTempA;
&&&&&& int nCount=6;
&&&&&& for(i=0;i&nCi++)
&&&&&&&&&&&&& strTemp.Format("%d",i);
&&&&&&&&&&&&& strTempA.Format("%s%d%s","File",i,".txt");//
&&&&&&&&&&&&& ::WritePrivateProfileString("UseFileName","FileName"+strTemp,strTempA,"c:\\usefile.ini");
&&&&&& strTemp.Format("%d",nCount);
&&&&&& ::WritePrivateProfileString("FileCount","Count",strTemp,"C:\\usefile.ini");
Cusefile.ini
[UseFileName]
FileName0=File0.txt
FileName1=File1.txt
FileName2=File2.txt
FileName3=File3.txt
FileName4=File4.txt
FileName5=File5.txt
[FileCount]
C:\student.ini
&&&&&& CString strTemp,strTempA;
&&&&&& int nC
&&&&&& nCount=::GetPrivateProfileInt("FileCount","Count",0,"c:\\usefile.ini");
&&&&&& for(i=0;i&nCi++)
&&&&&&&&&&&&& strTemp.Format("%d",i);
&&&&&&&&&&&&& strTemp="FileName"+strT
&&&&&& &&&&&& ::GetPrivateProfileString("UseFileName",strTemp,"default.txt",strTempA.GetBuffer(MAX_PATH),MAX_PATH,"c:\\usefile.ini");
&&&&&&&&&&&&& //strTempA
strTempstrTempA
function open_phone(e) {
var context = document.title.replace(/%/g, '%');
var url = document.location.
open("/ishare.do?m=t&u=" + encodeURIComponent(url) + "&t=" + encodeURIComponent(context) + "&sid=70cd6ed4a0");
!觉得精彩就顶一下,顶的多了,文章将出现在更重要的位置上。
大 名:&&[]&&[注册成为和讯用户]
(不填写则显示为匿名者)
(您的网址,可以不填)
请根据下图中的字符输入验证码:
(您的评论将有可能审核后才能发表)
已成功添加“”到
请不要超过6个字

我要回帖

更多关于 6666是什么意思 的文章

 

随机推荐