exit

cocoa how to block the “Quit” menu item on dock menu

爷,独闯天下 提交于 2019-12-08 07:37:36
问题 my dock menu always be added "Quit" and other 2 menu items automatically, how may I block / modify them? updated: really NO way to delete/block/redirect the "Quit" menu item. used Peter's recommendation at last like blow hope helpful to others -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { if (needPassword) { [self checkPassword:self]; return NSTerminateCancel; } else { return NSTerminateNow; } } -(void)checkPassword:(id)sender { if(passwordCorrect) {

Batch run script when closed

﹥>﹥吖頭↗ 提交于 2019-12-08 06:56:26
问题 My question is how would I make a batch script instead of closing when the X in the top right is pressed to execute a file called exit.exe. 回答1: the [X] is "out of reach" for cmd . Only way, I can think of is: create another cmd to watch the presence of the current window: @echo off title WatchMe more +7 %~f0 >t2.bat start "watcher" t2.bat exit /b @echo off :running tasklist /v|find "WatchMe" >nul &&echo waiting || goto finished timeout 1 >nul goto running :finished echo "the process has

How to finish all activity when exit from child activity

微笑、不失礼 提交于 2019-12-08 06:23:55
问题 Example : I have 3 Activities, A,B, and C. from Activity A I open Activity B then From B open Activity C. Then I exit application by code : Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); System.exit(0); I use this code for exit app. But when restart app, back again to recent Activity. My question, How to finish all Activities when exit from app? 回答1: You must be back to

Errors when calling exit() function for fastCGI?

冷暖自知 提交于 2019-12-08 05:26:54
问题 I've been reading that people face problems when using the exit function in their php script while running fastCGI https://serverfault.com/questions/84962/php-via-fastcgi-terminated-by-calling-exit http://php.net/manual/en/function.exit.php "It should be noted that if building a site that runs on FastCGI, calling exit will generate an error in the server's log file. This can quickly fill up." However my error log isn't reporting this problem after running this simple script even though I have

How to exit current activity to homescreen (without using “Home” button)?

≯℡__Kan透↙ 提交于 2019-12-08 03:34:29
I am sure this will have been answered but I proved unable to find it. So please excuse my redundancy. What I am trying to do is emulating the "Home" button which takes one back to Android's homescreen. So here is what causes me problems: I have 3 launcher activities. The first one (which is connected to the homescreen icon) is just a (password protected) configuration activity. It will not be used by the user (just admin) One of the other 2 (both accessed via an app widget) is a questionnaire app. I'm allowing to jump back between questions via the Back button or a GUI back button as well.

The C++ program should exit as soon as he presses 'esc'

白昼怎懂夜的黑 提交于 2019-12-07 22:24:04
问题 I have a program in which there is a code which looks something like this: int Element[15]; cout << "Enter name/symbol of the Element: "; cin >> Element; and I want the program to exit as soon as he presses 'esc' key. And also the user should not have to press the 'enter' key after pressing the 'esc' key. So how to do that?? 回答1: In Windows you can do it using Windows API. GetAsyncKeyState(VK_ESCAPE) helps you to check if Escape is pressed. You can try something like this: #include <windows.h

Is there a way to set windows to leave console windows open?

心不动则不痛 提交于 2019-12-07 20:58:53
问题 Is there some way to get it to stop closing as soon as the code finishes so I can actually read the error messages in termination scripts? I know that various commands in different languages can be used to make it wait for the user to enter a character. I am asking if there is a way to set windows itself to leave the window open either universally or for specific types of programs so that error messages can be read without any special usage conditions (such as calling from inside CMD) or

wpf cancel backgroundworker on application exits

流过昼夜 提交于 2019-12-07 18:57:04
问题 In my application I have a main windows and into it, in a frame I load a page. This page do a long time task when the user press a button. My problem is that when long task is being doing and the user presses the close button of the main window, the application seems to not finish because I am debugging it in VS2008 and I can see the stop button highlighted. If I want to finish I have to press stop button, the application doesn't stop the debugging automatically on application exit. I thought

Auto exit Telnet command back to prompt without human intervention ^] quit close exit code 1

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 14:52:05
问题 I'm running telnet command on a host for a given port (which is open), it returns 0 (success). For trying telnet manually, I type the following command, then I press control+bracket i.e. ^] , then press Enter key, then I get to telnet> prompt, where if I type close or quit , it comes back to the $ prompt and seeing exit status of last command shows 0 for (success) as port 2878 is open (as per the telnet command's output). [vagrant@myvagrant /tmp] $ telnet `hostname` 2878 Trying 127.0.0.1...

Might a finally block not get executed when a thread is interrupted/killed?

喜欢而已 提交于 2019-12-07 14:18:25
问题 In the Java tutorial it says about try { ... } finally { ... } : Note: If the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed , the finally block may not execute even though the application as a whole continues . Is it true that a thread can be interrupted or killed (I thought that was impossible?) such that the finally block will not be executed while the JVM