TFileName is a string that represents a file name.UnitSysUtilsDelphi syntax:type TFileName = type string;C++ syntax:typedef AnsiString TFileName;DescriptionUse TFileName to represent strings that are only used for file names.是帮助里的
str := FileName这行可以解释一下吗 比如我要载入test.doc这个文件 要如何写代码 type TFileName = type string;写在type定义里 事件中写str:='test.doc' OleContainer1.CreateObjectFromFile(str,False); 这样出错!!!!!
不行啊 OleContainer1.CreateObjectFromFile(str,False); 这样写会出错 如果加个OpenDialog if OpenDialog1.Execute then OleContainer1.CreateObjectFromFile(OpenDialog1.FileName,False); 这样就可以了 看来还是要用TFileName类型
看SysUtil中的定义就知道了{ Generic filename type } TFileName = type string;
比如我要载入test.doc这个文件
要如何写代码
type TFileName = type string;写在type定义里
事件中写str:='test.doc'
OleContainer1.CreateObjectFromFile(str,False);
这样出错!!!!!
不需要定义,直接用就行.
str := 'test.doc';
CreateObjectFromFile(str,False);
OleContainer1.CreateObjectFromFile(str,False);
OleContainer1.CreateObjectFromFile(str,False);
这样写会出错
如果加个OpenDialog
if OpenDialog1.Execute then
OleContainer1.CreateObjectFromFile(OpenDialog1.FileName,False);
这样就可以了
看来还是要用TFileName类型