用vb 6.0寫程式 ,要如何才能得知某程式四個角的座標阿?
http://photo.pchome.com.tw/_manage/my_pic.html?s=s07&n=windtraces&b=4&p=114404497618
請各位前輩指導一下
2006-04-03 10:17:51 · 3 個解答 · 發問者 Nick 5 in 電腦與網際網路 ➔ 程式設計
Private Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Sub Command1_Click()Dim H As Long, R As RECT'先找出小算盤的hWndH = FindWindow(vbNullString, "小算盤")If H <> 0 Then '取得其位置(單位:像素) If GetWindowRect(H, R) <> 0 Then Print "左上("; R.Left; ","; R.Top; ")" Print "右上("; R.Right; ","; R.Top; ")" Print "左下("; R.Left; ","; R.Bottom; ")" Print "右下("; R.Right; ","; R.Bottom; ")" End IfEnd If End Sub
2006-04-03 14:23:56 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
我不太會用API , 如果有簡單範例我會更感激你
2006-04-03 13:02:18 · answer #2 · answered by Nick 5 · 0⤊ 0⤋
如果你對如何在 VB6 裡面呼叫 API 這方面有經驗的話
你可以用 FindWindow 找到那個「某程式」然後再用 GetWindowRect 取得該程式的座標
2006-04-03 11:05:45 · answer #3 · answered by Luke 4 · 0⤊ 0⤋