Jump to content

Help: GUI that stays on the bottom, i.e. on the desktop


B4l4
 Share

Recommended Posts

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

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

@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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

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.

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...