mIRC Home    About    Download    Register    News    Help

Print Thread
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

Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Dec 2002
Posts: 344
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
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.

Joined: Nov 2004
Posts: 842
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
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?
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.

Joined: Feb 2003
Posts: 3,432
S
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,.) }
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
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.

Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Oct 2004
Posts: 8,330
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
Joined: Sep 2005
Posts: 2,881
H
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.

Joined: Oct 2004
Posts: 8,330
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
Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
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.


Link Copied to Clipboard