指定のデバイスコンテキストの原点を取得する
Declare Function GetDCOrgEx Lib "gdi32.dll" _
(ByVal hdc As Long, lpPoint As POINTAPI) As Long
Declare Function GetDCOrgEx Lib "gdi32.dll" _
(ByVal hdc As Integer, lpPoint As POINTAPI) As Integer
BOOL GetDCOrgEx(
HDC hdc,
LPPOINT lpPoint
);
引数
hdc
デバイスコンテキストのハンドルlpPoint
(戻り値)座標値を格納するためのPOINTAPI構造体戻り値
成功したとき 0以外備考
失敗したとき 0
不要になった時点でReleaseDC()関数を使って解放するサンプル

ダウンロード(GetDCOrgEx.lzh 1.21KB)Private Type POINTAPI
x As Long 'x座標
y As Long 'y座標
End Type
'デバイスコンテキストのハンドルを取得する
Private Declare Function GetDCOrgEx Lib "gdi32.dll" _
(ByVal hdc As Long, lpPoint As POINTAPI) As Long
Private Sub Command1_Click()
Dim lpPos As POINTAPI
'関数の実行
Call GetDCOrgEx(Me.hdc, lpPos)
MsgBox "x座標:" + Str(lpPos.x) + Chr(13) + Chr(10) + _
"y座標:" + Str(lpPos.y), , Me.Caption + "のデバイスコンテキストの原点の座標"
End Sub