Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Very very strange bug


  • Please log in to reply
4 replies to this topic
David Andersen
  • Members
  • 140 posts
  • Last active: Jun 28 2011 04:54 PM
  • Joined: 15 Jul 2005
Hi,

Open notepad and run the following code (it assumes you are using english windows and looks for the window title "Untitled").
loop
	{
		winget, pid, PID, Untitled
		ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt") 
		tooltip, %ProcessHandle%, 1, 1
		DllCall( "CloseHandle", "uint", ProcessHandle )
		sleep, 1000
		HotKey  *5,   KeyPress

	}

Notice that it prints one number, then waits for a second and writes another number. The numbers should be equal and are equal if you remove the following line:
HotKey  *5,   KeyPress


TheIrishThug
  • Members
  • 419 posts
  • Last active: Jan 18 2012 02:51 PM
  • Joined: 19 Mar 2006
Why are you creating the hotkey in the loop. Once you create it, it will persist unless you turn it off. Are you trying to trigger a hotkey?

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008
We'd also need the rest of the code in order for what you posted to work...
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.

David Andersen
  • Members
  • 140 posts
  • Last active: Jun 28 2011 04:54 PM
  • Joined: 15 Jul 2005
Hi,

It would not make it simpler if you saw the whole code. This snipplet does not make much sence, but isolates the issue.

I have moved around this peculiar issue in my code, and I have started to think that actually getting a handle with a new address (if it can be called an address) every time, might be reasonable after all. What do you think? Should it be identical?

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008

Hi,

It would not make it simpler if you saw the whole code. This snipplet does not make much sence, but isolates the issue.

The code doesn't run in it's current state... In order to make it run we'd need to remove the line you said was the problem. In short, no it does not isolate the issue.

I tried the following and got the same number every time.
loop
   {
      winget, pid, PID, Untitled
      ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, 

"UInt", pid, "UInt")
      tooltip, %ProcessHandle%, 1, 1
      DllCall( "CloseHandle", "uint", ProcessHandle )
      sleep, 1000
      HotKey  *5,   KeyPress

   }

KeyPress:
Return

Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.