Iwan Posted February 6, 2006 Share Posted February 6, 2006 Cheers, I would like to make a program that prevents a program to close when a user hits the X mark on the top right of the window is this at al possible using AutoIt? And if possible how to accomplish this. :"> Greetz, Iwan Link to comment Share on other sites More sharing options...
Valuater Posted February 6, 2006 Share Posted February 6, 2006 Welcome to Autoit we dont like to help malicious programing.... so give us more info because you are starting off with a seemingly negative script 8) Link to comment Share on other sites More sharing options...
Iwan Posted February 6, 2006 Author Share Posted February 6, 2006 I can understand why this seems to be a malicious coding script But at my work we use citrix sessions all the time but users keep closing these sessions using the X button. I would like them to logoff and not leaving their sessions opent (this saves resources on the servers). I thought of something like capturing the WM_CLOSE message send to the ica client and not forwarding it to the client. But is this possible? Cheers, iwan Link to comment Share on other sites More sharing options...
Valuater Posted February 6, 2006 Share Posted February 6, 2006 i think there is a way... not completely sure how Intricate your program is.. network etc everyone has their respective "specialties" here there are others here, whom possibly could help you better if i can think of something, i will let you know ( i did find your WM_ClOSE in the help file) 8) Link to comment Share on other sites More sharing options...
Iwan Posted February 6, 2006 Author Share Posted February 6, 2006 i think there is a way... not completely sure how Intricate your program is.. network etceveryone has their respective "specialties" herethere are others here, whom possibly could help you betterif i can think of something, i will let you know( i did find your WM_ClOSE in the help file)8)I hope there is a way to solve this It is not meant to be executed via network. Running itlocal on the fat-client will be sufficient. Anybody got an idea how to peek in the message queue of a different program or intercept a message send to the citrix client?! Regards Link to comment Share on other sites More sharing options...
w0uter Posted February 6, 2006 Share Posted February 6, 2006 search the board there are scripts somewhere that disable the X using some dllcalling. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
jaenster Posted February 6, 2006 Share Posted February 6, 2006 winkill("title") This ? ^^ -jaenster Link to comment Share on other sites More sharing options...
w0uter Posted February 6, 2006 Share Posted February 6, 2006 (edited) he wants to prevent it. Edited February 6, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
jaenster Posted February 6, 2006 Share Posted February 6, 2006 oh sorry .. Make an new progam that detect if it is close , if its closed restart your progam with the other ? -jaenster Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 6, 2006 Moderators Share Posted February 6, 2006 oh sorry .. Make an new progam that detect if it is close , if its closed restart your progam with the other ?The whole point is to make sure it 'Doesn't' close without logging off first I believe. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jaenster Posted February 6, 2006 Share Posted February 6, 2006 Hmm its tcp ip is it ? You can it allways .. you cant block a kill or close event And if you got it , you got always a restet knop on your pc if its tcp ip you can make a server that checks if anyone is dropedout -jaenster Link to comment Share on other sites More sharing options...
MuffinMan Posted February 6, 2006 Share Posted February 6, 2006 A friend of mine was looking for a similar function at his job long before I knoew abot AutoIT (which was last week) and he used a product called WinTopMost to get the job done. It would be great if you could do it through AutoIT though. Link to comment Share on other sites More sharing options...
BigDod Posted February 6, 2006 Share Posted February 6, 2006 Checkout This topic Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2006 Share Posted February 6, 2006 Checkout This topicPretty nice, but ALT+F4 will still work I think.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
seandisanti Posted February 6, 2006 Share Posted February 6, 2006 how about just using MouseTrap() to confine the mouse to the workable window area, and using this: #include<file.au3> Opt("WinTitleMatchMode",4) HotKeySet("!{F4}","DoNotCloseYourCitrixWindowWithHotkeysYouBastard") Func DoNotCloseYourCitrixWindowWithHotkeysYouBastard() If WinGetTitle("active") = "Citrix Title") Then msgbox(0,"Stop it!!!","Log out of your citrix connection correctly.") _FileWriteLog("l:\RandomShare\Log.txt",@UserName & " tried to close citrix with a hotkey, fire them as soon as possible to keep the others in line.") EndIf EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2006 Share Posted February 6, 2006 how about just using MouseTrap() to confine the mouse to the workable window area, and using this: #include<file.au3> Opt("WinTitleMatchMode",4) HotKeySet("!{F4}","DoNotCloseYourCitrixWindowWithHotkeysYouBastard") Func DoNotCloseYourCitrixWindowWithHotkeysYouBastard() If WinGetTitle("active") = "Citrix Title") Then msgbox(0,"Stop it!!!","Log out of your citrix connection correctly.") _FileWriteLog("l:\RandomShare\Log.txt",@UserName & " tried to close citrix with a hotkey, fire them as soon as possible to keep the others in line.") EndIf EndFunc *muhahaha* that might help. I like your function name and reading the log.txt will be fun every noon. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
herewasplato Posted February 6, 2006 Share Posted February 6, 2006 (edited) ...but ALT+F4 will still work I think...AutoItSetOption("WinTitleMatchMode", 4) Run("calc") WinWait("Calculator") $calcHwnd = WinGetHandle("Calculator") $menu = DllCall("user32.dll", "hwnd", _ "GetSystemMenu", "hwnd", _ $calcHwnd, "int", 0) DllCall("user32.dll", "int", _ "RemoveMenu", "hwnd", _ $menu[0], "int", _ 0xF060, "int", 0x0);SC_CLOSE While 1 If WinActive($calcHwnd) Then HotKeySet("!{F4}", "trap") Else HotKeySet("!{F4}") EndIf Sleep(30) WEnd Func trap() EndFunc ;==>trapDllCall courtesy of CyberSlug. Edit1: The Alt-F4 won't get passed to the app. Edit2: Changed code to let Alt-F4 work for other apps... Edited February 6, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
seandisanti Posted February 6, 2006 Share Posted February 6, 2006 *muhahaha* that might help. I like your function name and reading the log.txt will be fun every noon. So long,Megawith the mousetrap() keeping the mouse off of the X, that should about do it. unless they really want to be defiant and use the task manager, but they'd probably have already tried alt-f4 by that point, so it's ok to let them think they've defeated your scheme until they're fired. Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2006 Share Posted February 6, 2006 @herewasplato: That´s cool. Maybe I can use something like that for playing a joke on my friends. @cameronsdad: So, schadenfreude seems to be the same all over the world. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
herewasplato Posted February 6, 2006 Share Posted February 6, 2006 I changed the code in the post above a bit to allow Atl-F4 to work on other windows/apps... ...but I have a somewhat related question: Is this loop better than using one If/Else/EndIf? While 1 If WinActive($calcHwnd) Then HotKeySet("!{F4}", "trap") If Not WinActive($calcHwnd) Then HotKeySet("!{F4}") Sleep(30) WEndThe help files states:This version of the If statement is used to execute a single statement without the overhead of an EndIf.@Mega: "schadenfreude" - I had to go look that one up. Yes, it seems to be the same the world over. :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now