PcExpert Posted July 7, 2006 Share Posted July 7, 2006 Hi all, Is it possible to let a Traytip appear when users are trying to close a window by clicking on the X sign of the program. It's another thing for that security program where I told you guys about. Thanks, PcExpert Link to comment Share on other sites More sharing options...
BigDod Posted July 7, 2006 Share Posted July 7, 2006 #include <GUIConstants.au3> ; == GUI generated with Koda ==); $Form1 = GUICreate("AForm1", 253, 198, 192, 125) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE TrayTip("I'm a title", "I'm the message", 5, 1) Case Else ;;;;;;; EndSelect WEnd 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...
PcExpert Posted July 7, 2006 Author Share Posted July 7, 2006 Thats for my program. But If they have to leave another window open how do I do that then? Link to comment Share on other sites More sharing options...
BigDod Posted July 7, 2006 Share Posted July 7, 2006 Thats for my program. But If they have to leave another window open how do I do that then?I am sorry but I do not understand what you want. 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...
PcExpert Posted July 7, 2006 Author Share Posted July 7, 2006 Ooh, sorry. What I want is the same as what you discribe, but then with a program for example notepad, Firefox or IE Link to comment Share on other sites More sharing options...
i542 Posted July 7, 2006 Share Posted July 7, 2006 If you want to some else window stay open: ;BigDod's code start #include <GUIConstants.au3> ; == GUI generated with Koda ==); $Form1 = GUICreate("AForm1", 253, 198, 192, 125) GUISetState(@SW_SHOW) ;BigDod code end ;My modified code While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE TrayTip("I'm a title", "I'm the message", 5, 1) GuiDelete($Form1) ;This deletes only that window Case Else ;;;;;;; EndSelect WEnd Not tested. i542 I can do signature me. Link to comment Share on other sites More sharing options...
PcExpert Posted July 7, 2006 Author Share Posted July 7, 2006 (edited) Sorry, that's not what I mean. (maybe I'm giving you to little information) What I mean is for Example: Open Firefox. When you're trying to close it with the X presented at the upper right corner of the program, it will not close. Instead of closing the program it displays a tooltip. So the user will not be able to close it. Edited July 7, 2006 by PcExpert Link to comment Share on other sites More sharing options...
marfdaman Posted July 7, 2006 Share Posted July 7, 2006 Ooh, sorry. What I want is the same as what you discribe, but then with a program for example notepad, Firefox or IEYou could create a small window in the topright corner which covers the x-button and captures the press, displays the tooltip and does any other thing you like. And if you want to close the window anyway, just Send alt+F4.Alzo Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link to comment Share on other sites More sharing options...
PcExpert Posted July 7, 2006 Author Share Posted July 7, 2006 OK, thanks! That's an option too. Does somebody know a method to do that without a GUI? Link to comment Share on other sites More sharing options...
/dev/null Posted July 7, 2006 Share Posted July 7, 2006 OK, thanks! That's an option too. Does somebody know a method to do that without a GUI?Take a closer look at the Windows API functions SetWindowsHookEx (WH_CALLWNDPRO) and CallWndProc.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 I have been searching in the helpfile, but I can't find it. Can somebody tell me were I can find that? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2006 Moderators Share Posted July 8, 2006 http://msdn.microsoft.com/library/default....ndowshookex.asp 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...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 (edited) OK, thanks. I tried something with Pixel get color, but that didn't seem to work the way I wanted. So I understand that there's no other way in autoit then do it with the functions discribed in the post of /dev/null Edited July 8, 2006 by PcExpert Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2006 Moderators Share Posted July 8, 2006 OK, thanks. I tried something with Pixel get color, but that didn't seem to work the way I wanted. So I understand that there's no other way in autoit then do it with the functions discribed in the post of /dev/nullThat definately looks like the way to do it to me for an outside process/window, but I remember someone else several months ago asking the same question... Unfortunately, I can't for the life of me remember the title or the person that made the question 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...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 OK, but thank for your help. Link to comment Share on other sites More sharing options...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 OK, now I got it working with the code from i542, but if I activeate the firefox window then the titlebar from my program disappears behind firefox. Is there a way to let it always be active, even if you activate another window, so the titlebar will allways be visible? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2006 Moderators Share Posted July 8, 2006 WinSetOnTop()? 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...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 OK, thanks. I putted that in the script, but it doesn't work: #include <GUIConstants.au3> HotKeySet("!{F4}", "ALT") WinSetOnTop ( "Habbo ~ Habbo Hotel - Mozilla Firefox", "", 1) GUICreate("Habbo ~ Habbo Hotel - Mozilla Firefox", @DesktopWidth, 1, 0, 0) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then MyFunction() Wend WinSetOnTop ( "Habbo ~ Habbo Hotel - Mozilla Firefox", "", 1) Func alt() TrayTip("Beveiliging", "Handig he, zo'n beveiliging tegen lastige zusjes", "", 2) Sleep(3000) TrayTip("", "", "") EndFunc Func MyFunction() TrayTip("Beveiliging", "Handig he, zo'n beveiliging tegen lastige zusjes", "") Sleep(3000) TrayTip("", "", "") EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2006 Moderators Share Posted July 8, 2006 Try putting WinSetOnTop() after GUISetState(@SW_SHOW), because the window doesn't exist yet the way you have it. Example:#include <GUIConstants.au3> HotKeySet("!{F4}", "ALT") $GUI = GUICreate("Habbo ~ Habbo Hotel - Mozilla Firefox", @DesktopWidth, 1, 0, 0) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box WinSetOnTop ($GUI, "", 1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then MyFunction() Wend Func alt() TrayTip("Beveiliging", "Handig he, zo'n beveiliging tegen lastige zusjes", "", 2) Sleep(3000) TrayTip("", "", "") EndFunc Func MyFunction() TrayTip("Beveiliging", "Handig he, zo'n beveiliging tegen lastige zusjes", "") Sleep(3000) TrayTip("", "", "") EndFunc 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...
PcExpert Posted July 8, 2006 Author Share Posted July 8, 2006 If I click somewhere in another window it still disappears 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