欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基 礎(chǔ) 函 數(shù) 參 考


DllStructGetPtr

返回數(shù)據(jù)結(jié)構(gòu)指針,或者數(shù)據(jù)結(jié)構(gòu)的一個元素.

DllStructGetPtr ( 結(jié)構(gòu) [,元素])

參 數(shù)

結(jié)構(gòu) DllStructCreate 返回的數(shù)據(jù)結(jié)構(gòu).
元素 [可選參數(shù)] 數(shù)據(jù)結(jié)構(gòu)元素基于 1 的指針, 或者由 DllStructCreate 函數(shù)定義的元素名.

返 回 值

成功: 返回數(shù)據(jù)結(jié)構(gòu)的指針.
失敗: 返回 0.
@Error: 0 = 無錯誤.
1 = DllStructCreate 函數(shù)返回的數(shù)據(jù)結(jié)構(gòu)不正確.
2 = 元素值超出范圍.

備 注

在 DllCall 函數(shù)內(nèi)使用.

相 關(guān) 函 數(shù)

DllCall, DllStructCreate

函 數(shù) 示 例


;示例 1
;獲取窗口句柄并使用 WinGetPos 獲取窗口矩形
Local $hwnd = WinGetHandle("")
Local $coor = WinGetPos($hwnd)

;創(chuàng)建數(shù)據(jù)結(jié)構(gòu)
Local $rect = DllStructCreate("int;int;int;int")

;生成 DllCall
DllCall("user32.dll", "int", "GetWindowRect", _
        "hwnd", $hwnd, _
        "ptr", DllStructGetPtr($rect)) ; 調(diào)用 DllCall 時使用 DllStructGetPtr

;獲取返回的矩形
Local $l = DllStructGetData($rect, 1)
Local $t = DllStructGetData($rect, 2)
Local $r = DllStructGetData($rect, 3)
Local $b = DllStructGetData($rect, 4)

;釋放數(shù)據(jù)結(jié)構(gòu)
$rect = 0

;顯示 WinGetPos 的結(jié)果和返回的矩形
MsgBox(0, "測試 :)", "WinGetPos(): (" & $coor[0] & "," & $coor[1] & _
        ") (" & $coor[2] + $coor[0] & "," & $coor[3] + $coor[1] & ")" & @CRLF & _
        "GetWindowRect(): (" & $l & "," & $t & ") (" & $r & "," & $b & ")")

;示例 2
; DllStructGetPtr 參考項目
Local $a = DllStructCreate("int")
If @error Then
    MsgBox(0, "", "DllStructCreate 發(fā)生錯誤 " & @error);
    Exit
EndIf

$b = DllStructCreate("uint", DllStructGetPtr($a, 1))
If @error Then
    MsgBox(0, "", "DllStructCreate 發(fā)生錯誤 " & @error);
    Exit
EndIf

Local $c = DllStructCreate("float", DllStructGetPtr($a, 1))
If @error Then
    MsgBox(0, "", "DllStructCreate 發(fā)生錯誤 " & @error);
    Exit
EndIf

;設(shè)置數(shù)據(jù)
DllStructSetData($a, 1, -1)

;=========================================================
;   顯示相同數(shù)據(jù)的不同類型
;=========================================================
MsgBox(0, "DllStruct", _
        "int: " & DllStructGetData($a, 1) & @CRLF & _
        "uint: " & DllStructGetData($b, 1) & @CRLF & _
        "float: " & DllStructGetData($c, 1) & @CRLF & _
        "")

; 釋放分配的內(nèi)存
$a = 0

provider with jb51.net (unicode)