Jump to content

Recommended Posts

Posted

I want this program to run in the background all the time. What it does is when you click the middle mouse button it brings up the Win7 task switcher.

When my program runs it runs at about 24% cpu utilization

#include <misc.au3>
While 1
If _IsPressed(04) Then
     Run(@ComSpec & " /c " & "C:\Windows\System32\rundll32.exe DwmApi #105")
         Sleep(3000)
EndIf
WEnd

Does anyone have any ideas?

For a different approach, I was also trying to get the hotkeyset to work but could not get it to work with the middle mouse button. HotKeySet("_IsPressed(04)","function") does nothing.

Thx for your time

Posted

Try adding a sleep in the while loop e.g.

While Sleep(35)
WEnd

You might also want to reconsider how you monitor the middle button.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

  On 2/20/2013 at 7:21 PM, 'Jos said:

Put an sleep(10) in your loop outside of your If, so the line just before the Wend.

  On 2/20/2013 at 7:21 PM, 'guinness said:

Try adding a sleep in the while loop e.g.

While Sleep(35)
WEnd

You might also want to reconsider how you monitor the middle button.

That did it, thank you both very much
Posted

  On 2/20/2013 at 7:21 PM, 'guinness said:

You might also want to reconsider how you monitor the middle button.

Any suggestions?

By the way I changed to shellexecute, the other was popping up a black box on me before it ran

#include <misc.au3>
While 1
If _IsPressed(04) Then
ShellExecute("rundll32.exe","DwmApi #105")
   Sleep(3000)
  EndIf
sleep(35)
WEnd

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...