Function Reference

首页  后退  前进

IsPtr

 

检查变量是否为指针类型.

 

IsPtr ( variable )

参数

variable

要检查的变量/表达式.

返回值

成功:

返回 1, 变量是指针类型.

失败:

返回 0, 变量不是指针类型.

备注

详细说明参考 语言参考-数据类型.

 

该函数可以通过exect命令调用.

 

相关

IsArray, IsBool, IsFloat, IsHWnd, IsInt, IsNumber, IsString, Ptr

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    ; Run Notepad
    Run("notepad.exe")
    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ; Test if $hWnd is a valid pointer and display the results.
    If IsPtr($hWnd) Then
        MsgBox($MB_SYSTEMMODAL, "", "It's a valid Ptr")
    Else
        MsgBox($MB_SYSTEMMODAL, "", "It's not a valid Ptr")
    EndIf
    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

----------------------------------------

 

"exect=$var_h=WinGetHandle('[CLASS:TTOTAL_CMD]')||$var_i=IsPtr(Eval('var_h'))||_ViewValues($var_i)" - 验证Ptr指针的有效性

 

"exect=$var_h=Ptr(-1)||$var_i=IsPtr(Eval('var_h'))||_ViewValues($var_i)" - 将-1转换为指针