I know the form is there but my hot key doesn't work.

Trying to create an Stealth Mode kinda effect.

Page 1 of 1

3 Replies - 1013 Views - Last Post: 09 October 2008 - 09:49 AM Rate Topic: -----

#1 EvolutionMedia  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 125
  • Joined: 11-August 08

I know the form is there but my hot key doesn't work.

Post icon  Posted 08 October 2008 - 11:15 PM

Okay,

so when the form loads it detects if the user have previously detects if the set the Stealth Mode on or not. If it is on then the notify icon is hidden then the form turns it's opacity to 0.0 and the form because not visible. Now, i not the form is still there but why isn't it registering my hot key. I did a simple test with GetAsyncKeyState

Here's the code just to make it undestandable. Let's start when the form loads up.


terminate_app = 0
		fadeIncrement = 0.0
		fadeDecrement = 1.0




		My.Settings.Reload()
		LoadAppSettings()
		Me.Icon = My.Resources.prnk.prankzter
		NotifyIcon1.Icon = My.Resources.prnk.prankzter





		GoStep(0)

		soundcustomselected = False
		imagecustomselected = False

		If My.Settings.StealthEnabled = True Then
			StealtMode = True

			StealthModeNow()


		ElseIf My.Settings.LockEnabled = True Then
			LockDownMode = True

			LockDownNow()


		Else
			Timer1.Enabled = True

		End If




So if it detects that the settings.stealth enabled is turned to true then it goes to this funciton called StealthModeNow() which before the command there has to be StealthModeEnabled = true or else that sub routine won't work.

So here's the routine of StealthMode Now.


 Public Sub StealthModeNow()
		If Form1.StealtMode = True Then
			Form1.fadeDecrement = 1.0
			Form1.Timer2.Enabled = True
			Form1.NotifyIcon1.Visible = False


		Else
			Form1.fadeIncrement = 0.0
			Form1.Timer1.Enabled = True
			Form1.NotifyIcon1.Visible = True



		End If
	End Sub




So, if the stealth mode is triggered it puts in the fade out effect.

So let's look at the timer2_tick and basically it just renderes it to look like it's fading out.



	If Me.Opacity = 0.0 Then
			Me.Opacity = 0.0



			Me.Visible = False
			Timer2.Enabled = False

		Else
			fadeDecrement = Val(fadeDecrement) - Val(0.1)
			Me.Opacity = fadeDecrement


		End If




So I know it's hidden it's self in the background like I want it to. But now when it comes to Form1_KeyDown it's not registering it.

I just have a simple test to make sure the hot key is being triggered or not.

  
		If GetAsyncKeyState(Keys.ControlKey) And GetAsyncKeyState(Keys.ShiftKey) And GetAsyncKeyState(Keys.S) Then
			StealtMode = False

			Me.Opacity = 1.0
			Me.Visible = True

			Me.Show()
			My.Settings.StealthEnabled = False


		End If



Any help guys would be greatly appreciated! Thanks for the support!

-Paul

Is This A Good Question/Topic? 0
  • +

Replies To: I know the form is there but my hot key doesn't work.

#2 DeCompile  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 301
  • Joined: 20-July 08

Re: I know the form is there but my hot key doesn't work.

Posted 08 October 2008 - 11:36 PM

Could it be as simple as the form does not have focus, therefore the keydown event will not fire?
Was This Post Helpful? 0
  • +
  • -

#3 jg007  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 26
  • Joined: 23-March 08

Re: I know the form is there but my hot key doesn't work.

Posted 09 October 2008 - 02:11 AM

I believe that as the form does not have focus the only way you can do this is to hook the keyboard

try looking at this page - http://www.developer...cle.php/2193301

you will need to be careful when doing this, also some virus scanners may see your app as malware as it is monitoring the keyboard and their is a thin line between joke programs and malware

This post has been edited by jg007: 09 October 2008 - 02:13 AM

Was This Post Helpful? 0
  • +
  • -

#4 EvolutionMedia  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 125
  • Joined: 11-August 08

Re: I know the form is there but my hot key doesn't work.

Posted 09 October 2008 - 09:49 AM

View Postjg007, on 9 Oct, 2008 - 02:11 AM, said:

I believe that as the form does not have focus the only way you can do this is to hook the keyboard

try looking at this page - http://www.developer...cle.php/2193301

you will need to be careful when doing this, also some virus scanners may see your app as malware as it is monitoring the keyboard and their is a thin line between joke programs and malware


What I've manageded to do is make a timer that constantly puts the form in focused. Then when out of focus it will detect any keys pressed. Which works well, and doesn't use alot of Resources :) So that's good. Also, with the progrma's update timer that constantly saves settings the reload them gave me great ability to save the program in real time.

I could see why a antivirius would think that detect the joke program as a virius because the KeyHook is kinda like a key logger program. But then again - pretty much any kinda of Logger that records keystroke for a program function is considered a KeyLogger.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1