psynegy Posted February 13, 2009 Share Posted February 13, 2009 I'm working on a notification script, but I don't like that every time a notification pops up it takes the computers focus. Any ideas how to make a GUI that exists only as a notification (always on top, but no focus) Link to comment Share on other sites More sharing options...
Yashied Posted February 13, 2009 Share Posted February 13, 2009 I'm working on a notification script, but I don't like that every time a notification pops up it takes the computers focus. Any ideas how to make a GUI that exists only as a notification (always on top, but no focus) Try this. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $hWnd = DllCall('user32.dll', 'hwnd', 'GetForegroundWindow') GUICreate('', 400, 200, -1, -1, BitOR($WS_POPUP, $WS_OVERLAPPEDWINDOW), $WS_EX_TOPMOST) GUISetState() DllCall('user32.dll', 'hwnd', 'SetForegroundWindow', 'hwnd', $hWnd[0]) do Sleep(10) until GUIGetMsg() = $GUI_EVENT_CLOSE My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
weirddave Posted February 13, 2009 Share Posted February 13, 2009 Try this. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $hWnd = DllCall('user32.dll', 'hwnd', 'GetForegroundWindow') GUICreate('', 400, 200, -1, -1, BitOR($WS_POPUP, $WS_OVERLAPPEDWINDOW), $WS_EX_TOPMOST) GUISetState() DllCall('user32.dll', 'hwnd', 'SetForegroundWindow', 'hwnd', $hWnd[0]) do Sleep(10) until GUIGetMsg() = $GUI_EVENT_CLOSEI wish more devs thought like this, focus stealing is the biggest pain in the @rse I added a sleep(1000) st the start so I could activate something else before it kicked in, works lovely How many times have I hit enter at the end of my sentence to then wonder why my pc is rebooting or some other such nonsense! Link to comment Share on other sites More sharing options...
Yashied Posted February 13, 2009 Share Posted February 13, 2009 This is better. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $Form = GUICreate('', 400, 200, -1, -1, BitOR($WS_POPUP, $WS_OVERLAPPEDWINDOW), $WS_EX_TOPMOST) _WinAPI_ShowWindow($Form, @SW_SHOWNOACTIVATE) do Sleep(10) until GUIGetMsg() = $GUI_EVENT_CLOSE My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
psynegy Posted February 13, 2009 Author Share Posted February 13, 2009 This is better. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $Form = GUICreate('', 400, 200, -1, -1, BitOR($WS_POPUP, $WS_OVERLAPPEDWINDOW), $WS_EX_TOPMOST) _WinAPI_ShowWindow($Form, @SW_SHOWNOACTIVATE) do Sleep(10) until GUIGetMsg() = $GUI_EVENT_CLOSE Thanks very much! But there is an even easier way, without having to use the WinApi just GUISetState(@SW_SHOWNOACTIVATE) Thanks again for your help! 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