| |

Fortgeschrittene ProgrammierungLösung! | |  | Autor: Ronny42DAch | Datum: 03.12.01 01:51 |
| Label1 und Label2 benötigt - dürft auch nen Tip draus machen als aufmuterung für den Lord so als Opfergabe.
sorry nochmal
Option Explicit
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetFocus Lib "user32" () As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
' User defined types.
Private Type tActiveCtrInfo
lnghWnd As Long
strClassName As String
End Type
Private Sub tmrTimer_Timer()
Dim aciActCtr As tActiveCtrInfo
aciActCtr = GetActiveControl
Label1.Caption = aciActCtr.lnghWnd
Label2.Caption = aciActCtr.strClassName
End Sub
Private Function GetActiveControl() As tActiveCtrInfo
Dim strBuffer As String, lngResult As Long, lngOtherThreadID As Long
Dim lngThread1 As Long, lngThread2 As Long, lngGetCurrentThreadID As Long
Dim blnReminder As Boolean, lnghWndControl As Long
lngThread1 = GetWindowThreadProcessId(Me.hWnd, lngGetCurrentThreadID)
lngThread2 = GetWindowThreadProcessId(GetForegroundWindow, lngOtherThreadID)
If lngThread1 <> lngThread2 Then blnReminder = AttachThreadInput(lngThread2, lngThread1, True)
lngResult = GetFocus()
lnghWndControl = lngResult
GetActiveControl.lnghWnd = lngResult
If blnReminder Then blnReminder = AttachThreadInput(lngThread2, lngThread1, False)
strBuffer = Space(255)
Call GetClassName(lnghWndControl, strBuffer, Len(strBuffer))
GetActiveControl.strClassName = strBuffer
End Function |  |
 | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
  |
|
sevWizard für VB5/6 
Professionelle Assistenten im Handumdrehen
Erstellen Sie eigene Assistenten (Wizards) im Look & Feel von Windows 2000/XP - mit allem Komfort und zwar in Windeseile :-) Weitere InfosTipp des Monats Oktober 2025 Matthias KozlowskiUmlaute konvertierenErsetzt die Umlaute in einer Zeichenkette durch die entsprechenden Doppelbuchstaben (aus ä wird ae, usw.) TOP Entwickler-Paket 
TOP-Preis!!
Mit der Developer CD erhalten Sie insgesamt 24 Entwickler- komponenten und Windows-DLLs. Die Einzelkomponenten haben einen Gesamtwert von 1866.50 EUR...
Jetzt nur 979,00 EURWeitere Infos
|
|
|
Copyright ©2000-2025 vb@rchiv Dieter Otter Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.
Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel
|
|