mIRC Homepage

mIRC ctrl+break wrongly tracked

Posted By: baa

mIRC ctrl+break wrongly tracked - 14/03/12 02:57 AM

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
Posted By: argv0

Re: mIRC ctrl+break wrongly tracked - 14/03/12 03:17 AM

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?
Posted By: drum

Re: mIRC ctrl+break wrongly tracked - 14/03/12 03:52 AM

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.
Posted By: Jigsy

Re: mIRC ctrl+break wrongly tracked - 14/03/12 05:13 AM

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...)
Posted By: TRT

Re: mIRC ctrl+break wrongly tracked - 14/03/12 12:52 PM

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.
Posted By: sparta

Re: mIRC ctrl+break wrongly tracked - 14/03/12 01:48 PM

Sometimes you need to press Break more then one time, but it always have been working for me.
Posted By: Khaled

Re: mIRC ctrl+break wrongly tracked - 18/03/12 11:51 PM

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.
Posted By: argv0

Re: mIRC ctrl+break wrongly tracked - 19/03/12 01:44 AM

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.
Posted By: Riamus2

Re: mIRC ctrl+break wrongly tracked - 19/03/12 10:16 AM

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.
Posted By: hixxy

Re: mIRC ctrl+break wrongly tracked - 19/03/12 04:16 PM

Ctrl+Shift+Esc is the direct link to the task manager; I've never seen Ctrl+Alt+Esc being used for that.
Posted By: Riamus2

Re: mIRC ctrl+break wrongly tracked - 19/03/12 09:01 PM

Ah, right. Been too long since I saw/used it that I had the wrong thing in mind.
Posted By: argv0

Re: mIRC ctrl+break wrongly tracked - 19/03/12 10:12 PM

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.
Posted By: argv0

Re: mIRC ctrl+break wrongly tracked - 19/03/12 11:54 PM

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).
Posted By: Khaled

Re: mIRC ctrl+break wrongly tracked - 20/03/12 08:40 PM

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.
© 2021 mIRC Discussion Forums