Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Fix] Fixing input
#1
Wrote this up for RootSource on OGC, figured you guys could benefit from it?

Nean Wrote:I just spent the last two and a half hours working on this, so somebody better appreciate it. For spending so long, it's a very few lines of code. Anyways here goes

Add:
Code:
Public Declare Function GetForegroundWindow Lib "user32" () As Long
in ModInput

Then replace:
Code:
Call CheckInputKeys ' Check which keys were pressed

With:
Code:
If GetForegroundWindow() = frmMainGame.hwnd Then
            Call CheckInputKeys ' Check which keys were pressed
        End If

Voila, done. Now it only responds if the current window is RootSource
Reply
#2
I rated this topic:

[Image: icon_topic_rating.gif] [Image: icon_topic_rating.gif] [Image: icon_topic_rating.gif] [Image: icon_topic_rating.gif] [Image: icon_topic_rating.gif]

Good job.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#3
DFA Wrote:fully tested? wow if it works right
the best thing i've found was a pretty lengthy module that checks if a window has focus

Haha yeah, I spent two hours alternating writing functions/using booleans trying to determine if the window had focus, and then I stumbled across a GetActiveWindow API, but that didn't work. Another thirty minutes of research, trying to figure it out lead me to the GetForeGroundWindow API which worked flawlessly.
Reply
#4
James Wrote:Fail how? it works with only a few lines of code to fix a mistake you made.

lol, Dmitry got burned.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
Wait, so this is unsatisfactory? Elaborate.
Reply
#6
Lol. DFA was kidding, he was just mad you fixed something he broke. Tongue
Reply
#7
Damn, I need to stop posting drunk. I don't figure these things out.
Reply
#8
Nean Wrote:Damn, I need to stop posting drunk. I don't figure these things out.

Dmitry is high on crack. I never understands anything.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#9
Added it to Silverdale. Modded it a bit to allow game input on several forms, but it works like a charm.

+1 rep.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)