no-possible-to-close-window
Blitz3D Forums/Blitz3D Programming/no-possible-to-close-window
| ||
Could anyone help me to set privileges to a window, so that the user wont close it(not with task menager, not with other ways,...)? |
| ||
Are you writing a virus? |
| ||
No, but if the user will close the apps, windows will probably crash: the program i'm making will help the user using windows, so, if he/she will close the apps some applications of windows could not work very well. |
| ||
I don't think Blitz is your language of choice. You should try C++. |
| ||
Why? With dll Blitz can do anything. |
| ||
You are so right. www.melog.ch/dl/blitzclose.zip will do it for you :) |
| ||
Good program, but if you use task menager it doesn't work. |
| ||
You could have two programs going, and if the other one is closed the one that still exists replaces it. If you feel like doing that, you maybe able to do what you want under Blitz... From User32.decls (my favourite userlib): api_IsWindow% (hwnd%) : "IsWindow" |
| ||
How does "api_iswindow(hwnd)" works? Return 1 if the window app(specified with hwnd) is active? |
| ||
Yup. Um... Getting the window handle is the tricky part, but there's lots of ways to do it. |
| ||
Yes, but in wich way can i use that command? |
| ||
There is a very simple solution: Recreate the window if it is closed. |
| ||
In wich way? |
| ||
Sorry, I was thinking Blitz+ It would not help the task manager situation anyway. |
| ||
I need help. |
| ||
Mr. Picklesworths suggestion is good. Wont help much if somebody closes the monitoring program though...:) |
| ||
You could have the program check to see if another copy is already running, and if not, run a second copy. Also so that the programs won't argue over who should be doing the work, pass a command line parameter that says "I was copened by another copy of this program", and set a boolean variable of the same name to true. Then if that boolean variable is set, have that copy of the program do nothing but check to see if another copy of the program needs to be loaded. If another copy does need to be loaded, load it with that same command line parameter, and set your own boolean variable to false, so you know to start doing the main load of work in place of the copy the user just shut down that you had to replace. |
| ||
Here is what I was thinking: Main program doing the work scans every loop for the little program. If the little program is not there, then the main program executes it again (passing it its own window handle as a command line too) The little program does the same thing, except the other way around - also passing the main program its handle via the command line. Um... Getting the command lines on the first run is a bit more tricky... This is the method I use: Main program executes child program, passing it its command line. Child program sets its window as a child window of the main program's. Main program then uses api_GetWindow hWnd,5 (5 is the GW_CHILD flag, meaning that it is getting its child window. hWnd is the main program's window handle) Then you're set to do whatever. It's not the greatest solution, since a person could still kill the program if they did it really fast... and the process of whatever it was doing would need to be interrupted... but it may work. |
| ||
Yes, but some code? |