منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
قراءة عنوان النافذة المفتوحة - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90)
+--- قسم : مكتبة أكواد المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=111)
+---- قسم : مكتبة أكواد الفيجوال بيسك 6 (http://vb4arb.com/vb/forumdisplay.php?fid=116)
+---- الموضوع : قراءة عنوان النافذة المفتوحة (/showthread.php?tid=6052)



قراءة عنوان النافذة المفتوحة - RaggiTech - 17-10-12

كاتب الموضوع : sniperser

كود لجلب إسم النافذة النشطة
ضع تكست و زر

كود :
'Author: Sniperser
'Date Submitted: 10/07/2007
'Compatibility: VB 6
'Task: جلب إسم النافذة
'Declarations

Dim blnChoose As Boolean
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As
Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As
Long, ByVal yPoint As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long,
lpPoint As POINTAPI) As Long
ضع هذا في الموديل

كود :
Type POINTAPI
x As Long
y As Long
End Type
في الفورم

كود :
Private Sub Command1_Click()
blnChoose = True
intRetVal = SetCapture(hwnd)
End Sub
Private Sub Form_Load()
blnChoose = False
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim window As Long
Dim buffer As String * 1024
Dim ptPoint As POINTAPI
If blnChoose Then
ptPoint.x = x
ptPoint.y = y
retval = ClientToScreen(hwnd, ptPoint)
window = WindowFromPoint(ptPoint.x, ptPoint.y)
lngRetVal = GetWindowText(window, buffer, 1024)
Text1.Text = buffer
End If
End Sub