timmalos Posted August 23, 2011 Share Posted August 23, 2011 (edited) hi guys. i cound't found an answer in the forum so i create a new topic. My questioin is quite simple : I wante to create a TopMost Windows that doesn't take focus. In fact, i create an application which runs in background and displays answer like a notification, ie 'Windows Live Messenger', as shown below: http://usb-online.fr/file-download-c30MTA0Mg.html (Direct link image) The fast is i want this window to be 'Always on top', but i don't want her to take the focus. If would be quite simple if i had no controls in my GUI. Using this code : If i add GUISetState(@SW_SHOW) , then i can use my controls but the GUI take the focus when created. If i delete this line, then it's perfect, GUI is shown 'top most', doesn't take the focus, but I CAN't INTERACT with my controls. DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($gui), "int", 600+4*$h, "long", 0x00040008);Slide In Bottom GUISetState(@SW_SHOW) $t = TimerInit() While (TimerDiff($t) <= $duration*1000) ANd (Not $ExitGui) Sleep(10) WEnd DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($gui), "int", 1000, "long", 0x00050004);Slide Out Bottom GUIDelete($gui) Is someone has an idea? Thx a lot for help, Tim There is the full function : expandcollapse popupFunc Tip($title,$msg,$duration = 8,$icone = 1) ;duration in seconds Global $total_width,$total_height,$ExitGui = FALSE Local $h = 70, $w = 400 ;Hauteur et Largeur ;Maintenant on trouve la hauteur de la barre des taches $hMonitor = GetMonitorFromPoint(0, 0) If $hMonitor <> 0 Then GetMonitorInfos($hMonitor) EndIf $Nb = StringSplit($msg,@CRLF) $h = $h+$Nb[0]*8 ;On demarre notre fonction $gui=GUICreate("",$w,$h,$total_width-$w-4,$total_height-$h+4,0x80880000,$WS_EX_TOPMOST) $n2 = GUICtrlCreateIcon("shell32.dll", -28, $w-18, 2, 16, 16) GUICtrlSetCursor(-1,3) GUICtrlSetOnEvent(-1,"ExitGui") If $icone = 3 Then $icon = GUICtrlCreateIcon("ieframe.dll", -88, 10, 6) Else $icon = GUICtrlCreateIcon("ieframe.dll", -89, 10, 6) EndIf GUICtrlCreateLabel($title,50,10,$w-70,20) GUICtrlSetFont(-1, 14, -1, -1, "Trebuchet MS") ;$label = _GuiCtrlTexte_Create(50,40,$w-50,$h-40-20,"white","black","Arial",8) ;_GuiCtrlTexte_Write($label,$msg) $label=GUICtrlCreateLabel($msg,50,40,$w-50,$h-40-20) GUICtrlSetFont(-1, 8, -1, -1, "Arial") Global $link=GUICtrlCreateLabel("Cliquez ici pour plus de détails",50,$h-20,$w-50,20) GUICtrlSetOnEvent($link,"PlusDeDetails") GUICtrlSetCursor($link,5) GUICtrlSetColor($link, 0x0000FF) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($gui), "int", 600+4*$h, "long", 0x00040008);Slide In Bottom GUISetState(@SW_SHOW) $t = TimerInit() While (TimerDiff($t) <= $duration*1000) ANd (Not $ExitGui) Sleep(10) WEnd DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($gui), "int", 1000, "long", 0x00050004);Slide Out Bottom GUIDelete($gui) EndFunc Edited August 24, 2011 by timmalos mLipok 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 23, 2011 Moderators Share Posted August 23, 2011 timmalos,You need to set the GUI state to @SW_SHOWNOACTIVATE initially and then reactivate the previously active GUI when you action a control on yours. This shows how you might do it:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 200, 100) $hButton = GUICtrlCreateButton("Press", 60, 40, 80, 30) WinSetOnTop($hGUI, "", 1) ; Create the GUI but do not activate it GUISetState(@SW_SHOWNOACTIVATE) While 1 ; If our GUI is not active then save the handle of the GUI that is If Not WinActive($hGUI) Then $hLastActive = WinGetHandle("[ACTIVE]") EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton ConsoleWrite("Button pressed!" & @CRLF) ; And reactivate the GUI that was just active WinActivate($hLastActive) EndSwitch WEndDoes that help? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
timmalos Posted August 24, 2011 Author Share Posted August 24, 2011 Ohh, really don't know how i could miss this. Thx a lot ! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 24, 2011 Moderators Share Posted August 24, 2011 timmalos, Il n'y a pas de quoi! M23 Trans: No problem. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
timmalos Posted August 25, 2011 Author Share Posted August 25, 2011 Or as you say, 'Voila ! ' 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