mIRC Home    About    Download    Register    News    Help

Print Thread
mIRC ctrl+break wrongly tracked #236633 14/03/12 02:57 AM
Joined: Oct 2005
Posts: 17
B
baa Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2005
Posts: 17
it's tricky to press ctrl+break. mIRC register this hotkey in system wide instead of app wide, when i press ctrl+break, it also break. this is fine. however the key press it is wrongly tracked

case a is fine
step 1. ctrl-down, break-down => keep showing "* Break: command halted" whenever an event trigger the script execution
step 2. break-up, ctrl-up. => restore to normal


case b is buggy
step 1. ctrl-down, break-down => keep showing "* Break: command halted" whenever an event trigger the script execution
step 2. ctrl-up, break-up => still show "* Break: command halted" whenever an event trigger the script execution

Re: mIRC ctrl+break wrongly tracked [Re: baa] #236634 14/03/12 03:17 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
This might explain why users occasionally report that Ctrl+Break "sticks" and they get stuck in a Break loop.

But on the other hand, I don't see why case b is buggy. If you're saying mIRC is tracking Ctrl+break on keyup, I don't see that big a problem with this. Is that what is happening here?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: mIRC ctrl+break wrongly tracked [Re: argv0] #236635 14/03/12 03:52 AM
Joined: Dec 2002
Posts: 339
D
drum Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
OP is saying that if you release the CTRL key before you release the PAUSE/BREAK key, scripts will continue to break as if you are still holding both keys down.

I haven't personally tested this. I'm just clarifying what the OP meant.

Re: mIRC ctrl+break wrongly tracked [Re: baa] #236636 14/03/12 05:13 AM
Joined: Nov 2004
Posts: 804
Jigsy Offline
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 804
Hmm...

Whenever I get stuck in a loop, CTRL+Break doesn't actually seem to do anything.

The loop continues, no break notifications, and I have to kill the process.

I wonder if it's related... (and this has been going on for years...)


What do you do at the end of the world? Are you busy? Will you save us?
Re: mIRC ctrl+break wrongly tracked [Re: Jigsy] #236637 14/03/12 12:52 PM
Joined: Jun 2003
Posts: 81
T
TRT Offline
Babel fish
Offline
Babel fish
T
Joined: Jun 2003
Posts: 81
You should provide additional details and code when making such a claim.

I never had trouble breaking out of a loop on a clean install, starting from 6.1x and XP to 7.22 and Windows 7.

Re: mIRC ctrl+break wrongly tracked [Re: Jigsy] #236640 14/03/12 01:48 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Sometimes you need to press Break more then one time, but it always have been working for me.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: mIRC ctrl+break wrongly tracked [Re: baa] #236683 18/03/12 11:51 PM
Joined: Dec 2002
Posts: 4,727
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,727
Thanks, I can reproduce this issue. mIRC uses a standard API to ask Windows if the Control+Break key combination has been pressed. If you release the Control key first, Windows seems to think the break key is still pressed. If you press Control+Break, release Control and then Break, and then run mIRC, the same issue appears, so it looks like a Windows issue. Unfortunately I have not been able to find a way around this.

Re: mIRC ctrl+break wrongly tracked [Re: Khaled] #236685 19/03/12 01:44 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
While we're on the subject, can we get another hotkey for this? Many keyboards (mine being one of them) no longer have the break/pause key, so this functionality is simply not available to those users. I imagine if you used a standard keyboard shortcut for regular keys you would have the ability to make it work better, at least for the alternate hotkey.

Note that threads in the google results above citing alternatives to the break key often talk about Ctrl+Alt+Esc. Perhaps that would be a good alternate shortcut to support.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: mIRC ctrl+break wrongly tracked [Re: argv0] #236695 19/03/12 10:16 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'm not sure about Ctrl-Alt-Esc. That's sometimes a direct link to the Task Manager. I haven't seen that on newer computers/operating systems, but if mIRC is going to support older systems, then that needs to be considered when making the decision.

I'm surprised there isn't a Break key somewhere on the keyboard. I've seen ones where it wasn't clearly labeled or needed the Fn key (for Laptops), but I haven't yet seen any where it wasn't there at all. Of course, I mostly only see US keyboard layouts here. If you were to check information on your keyboard, does it list an alternative Break key even if it's not displayed on the keyboard? I'd imagine there is still a key that handles that. Looking at that search link you provided, they did say that the keyboards themselves offered the alternative without requiring software to provide that support. Ctrl-Alt-Esc was mentioned as well as Ctrl-Fn-F12 or Ctrl-Fn-Delete depending on the keyboard. I think that if the keyboard still offers an alternative, then users probably need to use that rather than trying to implement something in the software. I'm not sure it's even possible to implement your own Break key in the software if the software is locked up from a loop. I'd think that any software solution would also be locked up. Maybe I'm wrong?

It's too bad that the original alternative to Ctrl-Break (Ctrl-C) isn't an option anymore. Now that it's used to copy text, it has lost its usefulness anywhere but command prompts and a few other locations where copying text isn't an option, or where you use another method to copy text.

Last edited by Riamus2; 19/03/12 10:21 AM.

Invision Support
#Invision on irc.irchighway.net
Re: mIRC ctrl+break wrongly tracked [Re: Riamus2] #236696 19/03/12 04:16 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Ctrl+Shift+Esc is the direct link to the task manager; I've never seen Ctrl+Alt+Esc being used for that.

Re: mIRC ctrl+break wrongly tracked [Re: hixxy] #236702 19/03/12 09:01 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ah, right. Been too long since I saw/used it that I had the wrong thing in mind.


Invision Support
#Invision on irc.irchighway.net
Re: mIRC ctrl+break wrongly tracked [Re: Riamus2] #236704 19/03/12 10:12 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
I'm certain this keyboard has no Break/Pause key. And it is US-layout. I would use an alternative if my keyboard supported it, but it doesn't. For what it's worth, it's an Apple keyboard (http://www.apple.com/keyboard/), but many other new keyboards lack the button as well-- see the threads in the search results about Dell laptops. Here are just a few I found on Logitech's site:

http://www.logitech.com/en-us/keyboards/keyboard/devices/wireless-solar-keyboard-k750-mac
http://www.logitech.com/en-us/keyboards/keyboard/devices/tablet-keyboard-android

Since form factors are becoming smaller, keyboard manufacturers are making smaller keyboards as well and shedding some archaic buttons like PrnScrn and Break which have no meaning in modern software. Laptops are doing the same, and I'd bet this is especially true for netbooks.

It should be possible to implement Ctrl+Break with any key combination. Presumably mIRC is just checking the key state at iterations of script execution-- there's no reason it couldn't just check for another key combination at the same time.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: mIRC ctrl+break wrongly tracked [Re: Khaled] #236705 19/03/12 11:54 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
What API is mIRC using to check Ctrl+Break? Is it using GetAsyncKeyState(VK_CANCEL)?

If so, perhaps a better way to do this would be to just check the individual keys directly. I tested the following and it seems to work just fine for me:

Code:
short down = 0x8000;
if (GetAsyncKeyState(VK_CONTROL) & down && GetAsyncKeyState(VK_PAUSE) & down) {
  /* break out of loop */
}


This would fix any bugs windows has with checking the VK_CANCEL vkey directly (w.r.t. letting go of control after break).

Also, this would allow you to check for an alternate key combination in the process (like Ctrl+Alt+Esc) for users without the Pause/Break key (you could do this regardless, of course).


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: mIRC ctrl+break wrongly tracked [Re: argv0] #236723 20/03/12 08:40 PM
Joined: Dec 2002
Posts: 4,727
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,727
Thanks, unfortunately that key combination does not seem to work here (Windows XP SP3). The combination of Control and Break only generates a VK_CANCEL here.

Update: I have found a way of resetting the status of VK_CANCEL in the case where the Control key is released first, which resolves the issue, however I still need to perform some tests to see whether it works in different versions of Windows and with different keyboards.