|
-
Mar 3rd, 2004, 06:09 PM
#1
-
Mar 3rd, 2004, 06:42 PM
#2
Frenzied Member
I can't think of an answer right now, but I did find this on Google. It's to a thread that [I'm supposing] asks the same question, but you have to register for the site. I don't wanna do that.
http://www.vbcity.com/forums/topic.asp?tid=31361
-
Mar 3rd, 2004, 06:55 PM
#3
-
Mar 3rd, 2004, 07:14 PM
#4
-
Mar 3rd, 2004, 07:24 PM
#5
This may work: Form1.ActiveControl
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 3rd, 2004, 07:42 PM
#6
-
Mar 3rd, 2004, 07:48 PM
#7
That's what I was afraid of 
Well, time to hunt through the API guide again
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 3rd, 2004, 08:02 PM
#8
Here's a C++ version that may work: http://www.experts-exchange.com/Prog..._10302522.html. It uses threads, so you never know how it would do in VB.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 3rd, 2004, 08:03 PM
#9
-
Mar 3rd, 2004, 08:08 PM
#10
Try this...
VB Code:
Option Explicit
Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, _
ByVal idAttachTo As Long, _
ByVal fAttach As Long) _
As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetFocus Lib "user32" () As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, _
lpdwProcessId As Long) _
As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Sub Timer1_Timer()
Dim hFore As Long, hFocus As Long
hFocus = GetFocus
If hFocus = 0 Then
hFore = GetForegroundWindow()
Call AttachThreadInput(GetWindowThreadProcessId(hFore, 0&), GetCurrentThreadId, True)
hFocus = GetFocus
Call AttachThreadInput(GetWindowThreadProcessId(hFore, 0&), GetCurrentThreadId, False)
End If
Me.Caption = hFocus
End Sub
I put it in a timer to make sure it actually worked. It seems to.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 3rd, 2004, 08:24 PM
#11
-
Mar 3rd, 2004, 08:31 PM
#12
Frenzied Member
Originally posted by crptcblade
VB Code:
Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, _
ByVal idAttachTo As Long, _
ByVal fAttach As Long) _
As Long
I wonder what else this could get accomplished. Cool function...jeez, I'm a geek.
-
Mar 3rd, 2004, 08:36 PM
#13
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|