B4l4 Posted October 15, 2018 Share Posted October 15, 2018 Hi, I'm trying to create a program that sits on the desktop, i.e. I want the program to be always be at the bottom. I've tried using _WinAPI_SetWindowPos with $HWND_BOTTOM, but it doesn't work. Can anyone help? Thanks. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 15, 2018 Share Posted October 15, 2018 (edited) Hi @B4l4, and welcome to the AutoIt forum 2 minutes ago, B4l4 said: I've tried Where is your script? Edited October 15, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
B4l4 Posted October 15, 2018 Author Share Posted October 15, 2018 1 hour ago, FrancescoDiMuro said: Hi @B4l4, and welcome to the AutoIt forum Where is your script? Hi Francesco, here's the code, based on an example online: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> BackgroundImage() Func BackgroundImage() GUICreate("My background image", 1000, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered Sleep(1000) $hWnd = WinGetHandle("[ACTIVE]") WinActivate($hWnd) GUISetBkColor(0xE0FFFF) Local $idPic = GUICtrlCreatePic("C:\Users\b4l4\Documents\misc\test.jpg", -1, -1, 1000, 1000) GUISetState(@SW_SHOW) _WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) ; Loop until the user exits. While 1 _WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) ;WinActivate("Program Manager") Sleep(100) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example Thanks. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 15, 2018 Share Posted October 15, 2018 (edited) @B4l4 Slight modification, seems to work #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> BackgroundImage() Func BackgroundImage() $hWnd = GUICreate("My background image", 1000, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered Sleep(1000) ;~ $hWnd = WinGetHandle("[ACTIVE]") ;~ WinActivate($hWnd) GUISetBkColor(0xE0FFFF) Local $idPic = GUICtrlCreatePic("C:\Users\b4l4\Documents\misc\test.jpg", -1, -1, 1000, 1000) GUISetState(@SW_SHOW) _WinAPI_SetWindowPos($hWnd, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) If @error Then ConsoleWrite("Error: " & @error & @CRLF) ; Loop until the user exits. While 1 _WinAPI_SetWindowPos($hWnd, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) If @error Then ConsoleWrite("Error: " & @error & @CRLF) ;WinActivate("Program Manager") Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example Edited October 15, 2018 by FrancescoDiMuro B4l4 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
B4l4 Posted October 15, 2018 Author Share Posted October 15, 2018 Oops, yes, my mistake then? Need to read the manual more closely. Can you tell me why the app flickers though? Any way to remove it? Thanks again! Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 15, 2018 Share Posted October 15, 2018 @B4l4 Try to comment the _WinAPI_SetWindowPos in the While 1 loop Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
careca Posted October 15, 2018 Share Posted October 15, 2018 Compare the position with the position you want, if = then skip the setwindowpos func, else, reposition the window. This is how you avoid the flickering which is the constant and repeated window position set. B4l4 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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