IsFunc
检查变量或表达式是否为函数类型
IsFunc ( expression )
参数
返回值
成功:
|
返回 1 = 变量是一个用户定义的函数, 2 = 变量是一个本地函数
|
失败:
|
返回 0, 表达式不是函数类型
|
备注
详细说明参考 语言参考-数据类型.
相关
Binary, BinaryToString, IsArray, IsBool, IsFloat, IsHWnd, IsInt, IsNumber, IsString, StringToBinary, VarGetType
函数示例
示例 1
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Create a first class object of MsgBox and assign to a Local variable.
Local $hMsgBox = MsgBox
; Display a MsgBox using the previously assigned variable.
$hMsgBox($MB_SYSTEMMODAL, "", "This is a sentence with whitespace.")
; Display a MsgBox that shows $hMsgBox is a native function.
$hMsgBox($MB_SYSTEMMODAL, "", "Check if $hMsgBox is a function or not." & @CRLF & _
@CRLF & _
"This will return 2 as the function is native: " & IsFunc($hMsgBox))
EndFunc ;==>Example
示例 2
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Create a first class object of MsgBox and assign to a Local variable.
Local $hMsgBox = MsgBox
; Display a MsgBox using the previously assigned variable.
$hMsgBox($MB_SYSTEMMODAL, "", "This is a sentence with whitespace.")
; Re-assign the variable $hMsgBox with our user-defined message box function.
$hMsgBox = MyMsgBox
; Display a MsgBox that shows $hMsgBox is a function.
$hMsgBox($MB_SYSTEMMODAL, "", "Check if $hMsgBox is a function or not." & @CRLF & _
@CRLF & _
"This will return 1 as the function is a user function: " & IsFunc($hMsgBox))
EndFunc ;==>Example
; User-defined message box function.
Func MyMsgBox($iFlag, $sTitle, $sText = "")
Return MsgBox($iFlag, $sTitle, $sText)
EndFunc ;==>MyMsgBox
----------------------------------------
|