关于异常的问题(100)

  • 主题发起人 主题发起人 爱上猫的鱼
  • 开始时间 开始时间

爱上猫的鱼

Unregistered / Unconfirmed
GUEST, unregistred user!
function Format(const Format: string; const Args: array of const): string;里边的参数给解释一下begin try result := Sysutils.Format(Format, args);//解释 except on e: Exception do //解释 raise exception.CreateFmt('在格式串“%s”时出错:'#13#10'%s 。%d', [Format, e.message, e.helpcontext]); end;end;帮忙给解释一下,由其是exception.CreateFmt('在格式串“%s”时出错:'#13#10'%s 。%d', [Format, e.message, e.helpcontext]);exception.CreateFmt的意思'#13#10'%s 。%d', [Format, e.message, e.helpcontext];所代表的意思# %是什么个意思,e.message,e.helpcontext什么意思ShellExecute()的用法我是新手,请多帮忙
 
ShellExecute(Handle,'open','ping.exe',PChar(Format('%s -t',[E_UpdateIP.Text])),nil,SW_NORMAL)里边的%s -t 是什么意思
 
Format strings specify required formats to formatting routines.Categorystring formatting routinesDescriptionFormat strings passed to the string formatting routines contain two types of objects -- literal characters and format specifiers. Literal characters are copied verbatim to the resulting string. Format specifiers fetch arguments from the argument list and apply formatting to them.Format specifiers have the following form:"%" [index ":"] ["-"] [width] ["." prec] typeA format specifier begins with a % character. After the % come the following, in this order:An optional argument index specifier, [index ":"] An optional left justification indicator, ["-"] An optional width specifier, [width] An optional precision specifier, ["." prec] The conversion type character, typeThe following table summarizes the possible values for type:d Decimal. The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.u Unsigned decimal. Similar to 'd' but no sign is output.e Scientific. The argument must be a floating-point value. The value is converted to a string of the form "-d.ddd...E+ddd". The resulting string starts with a minus sign if the number is negative. One digit always precedes the decimal point.The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string梐 default precision of 15 is assumed if no precision specifier is present. The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.f Fixed. The argument must be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative.The number of digits after the decimal point is given by the precision specifier in the format string梐 default of 2 decimal digits is assumed if no precision specifier is present.g General. The argument must be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string梐 default precision of 15 is assumed if no precision specifier is present.Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses fixed point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.n Number. The argument must be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The "n" format corresponds to the "f" format, except that the resulting string contains thousand separators.m Money. The argument must be a floating-point value. The value is converted to a string that represents a currency amount. The conversion is controlled by the CurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator, DecimalSeparator, and CurrencyDecimals global variables, all of which are initialized from the Currency Format in the International section of the Windows Control Panel. If the format string contains a precision specifier, it overrides the value given by the CurrencyDecimals global variable.p Pointer. The argument must be a pointer value. The value is converted to an 8 character string that represents the pointers value in hexadecimal.s String. The argument must be a character, a string, or a PChar value. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.x Hexadecimal. The argument must be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.Conversion characters may be specified in uppercase as well as in lowercase梑oth produce the same results.For all floating-point formats, the actual characters used as decimal and thousand separators are obtained from the DecimalSeparator and ThousandSeparator global variables.Index, width, and precision specifiers can be specified directly using decimal digit string (for example "%10d"), or indirectly using an asterisk character (for example "%*.*f"). When using an asterisk, the next argument in the argument list (which must be an integer value) becomes the value that is actually used. For example, Format('%*.*f', [8, 2, 123.456]) is the same as Format('%8.2f', [123.456]).A width specifier sets the minimum field width for a conversion. If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width. The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (a "-" character preceding the width specifier), the result is left-justified by adding blanks after the value.An index specifier sets the current argument list index to the specified value. The index of the first argument in the argument list is 0. Using index specifiers, it is possible to format the same argument multiple times. For example "Format('%d %d %0:d %1:d', [10, 20])" produces the string '10 20 10 20'.The format strings are used by the following routines:Format function FormatBuf function FmtStr procedure StrFmt function StrLFmt function
 
英语,看不懂
 
exception.CreateFmt 弹出一个显示异常的窗体 '#13#10'%s 。%d', [Format, e.message, e.helpcontext];格式化字符串 用 e.message 的内容替代 %s, 用 e.helpcontext的内容替代 %d,%s 表示是字符串 %d表示是整数#13#10 是 回车换行 e.message 异常的消息内容e.helpcontext 上下文帮助ShellExecute(Handle,'open','ping.exe',PChar(Format('%s -t',[E_UpdateIP.Text])),nil,SW_NORMAL)里边的%s -t 用E_UpdateIP.Text的内容替代%s -t 是命令行参数 当使用ping 命令时 加上-t 就会持续的发送数据包给目的主机简单的解释
 
虽然知道说了也是白说。但是还是说一下。这样才能理直气壮的骂一句:你Y真蠢!exception.CreateFmt('在格式串“%s”时出错:'#13#10'%s 。%d', [Format, e.message, e.helpcontext]);相当于Exception.Create(Format('在格式串“%s”时出错:'#13#10'%s 。%d',[Format, e.message, e.helpcontext]));'在格式串“%s”时出错:'#13#10'%s 。%d'应该拆分成'在格式串“%s”时出错:' #13#10和'%s 。%d'三段,而不是分割出'#13#10'%s 。%d'这样。单引号包围的是字符串表示。#后接字符的编码表示字符,#13#10表示回车(#13)换行(#10)。e.message,e.helpcontext这种写法是访问对象e的两个属性
 
接受答案了.
 
对新手要有宽容的心态,谁天生是高手呢?
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
911
SUNSTONE的Delphi笔记
S
I
回复
0
查看
754
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部