Jump to content

How to borderless app but still being able to drag and resize(NOT GUI)


Recommended Posts

Hi there i have searched for countless hours on the forums and help file and i have found alot of things how to resize gui and apps inside gui but not how to actually do it with external program.

 

I found >anygui.au3 in the examples and i also managed to remove borders from any program but still not make it drag able including resize and still having the app function.

Dont get me wrong i found alot of examples but only for gui that already exists made by autoit or had to be created as an gui with autoit.

So the question is it possible ? and or are there any in here that would help me succeed with it?

1)

- Make application borderless.

2)

- Make it dragable.

3)

- resize it whenever you want without being inside a gui and stil having it running smooth.

 

Regards.

Link to comment
Share on other sites

If an existing program doesn't already have those abilities as options built into it, then I'm afraid you are out of luck.

At least, that's my understanding and I imagine you would need some real high level interpreter to interact with exist code in the program, to make any changes to it ... which seems extremely unlikely, and not something AutoIt would be able to do by itself.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

If an existing program doesn't already have those abilities as options built into it, then I'm afraid you are out of luck.

At least, that's my understanding and I imagine you would need some real high level interpreter to interact with exist code in the program, to make any changes to it ... which seems extremely unlikely, and not something AutoIt would be able to do by itself.

Hmm.. I hope your wrong hehe :)

We will just have to wait and see if any can come up with examples or not :).

Link to comment
Share on other sites

With a program, to change it's shape etc, you are essentially redrawing it.

If that program itself doesn't provide the ability to do that, and thus has essentially done opposite, then you are up against a very big wall of resistance ... think of all the code that will have to be modified for it to work properly ... click area for a button for instance.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

You might be able to use _WinAPI_SetWindowLongEx to set the $WS_POPUP style on an external app. I played around with it a bit, and could create a borderless window, but the window couldn't be interacted with so I'm probably missing something important.

#include <Constants.au3>
#include <WindowsConstants.au3>
#include <winapiex.au3>
_WinAPI_SetWindowLongEx(WinGetHandle("[class:HH Parent]"), $GWL_STYLE, BitAND(_WinAPI_GetWindowLongEx(WinGetHandle("[class:HH Parent]"), $GWL_STYLE),$WS_POPUP))
This makes the help file program borderless, but you can't click on it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Oh well, you never know your luck ... and never say never!

I've used a few programs (hasn't everybody) that it would have been nice to relocate and resize on the fly ... especially automatically and especially on this Netbook's odd sized screen.

Anything I've come across in the past, has been some kind of work-around and far from satisfactory, and many program windows resist entirely.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I use very often (in my work) my own small AU3 utility for resizing of target window (and controls in it including ListView) which can't be resized manually.
This utility runs as background and if window of my type appears, it's automatically resized to bigger size with all controls and ListView columns inside.
It works very well for me :-)
 
Just for the info, it's ObjetCycle window (history,differences) in PowerBuilder.

I use these AutoIt commands:
 

WinGetHandle()
ControlGetHandle()
WinGetPos()
WinMove()
ControlMove()
ControlCommand() - TabLeft+TabRight
_SendMessage($listview, $LVM_GETCOLUMNWIDTH, N)
_SendMessage($listview, $LVM_SETCOLUMNWIDTH, N, W)
_SendMessage($listview, $LVM_SETCOLUMNWIDTH, N, $LVSCW_AUTOSIZE)
_WinAPI_InvalidateRect()

Note: with WinMove(), ControlMove() you can also resize control/window by using Default keyword in X,Y parametres
 
EDIT:
On requests I'm adding my AU3 source here with some english comments in code

#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_icon=pb.ico
#AutoIt3Wrapper_Run_Obfuscator=y
#obfuscator_parameters=/striponly
;~ #NoTrayIcon
#include <ListViewConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>
#include <SendMessage.au3>

Global $okno_diff, $okno_diff_prev
Global $okno_hist, $okno_hist_prev

; pri druhem spusteni ukoncit predchozi skript bezici na pozadi
; at second launch close previously running script at background
If _Singleton(StringReplace(@ScriptFullPath,'\','/'),1) = 0 Then
    ProcessClose(ProcessExists(@ScriptName))
    Sleep(100) ; asi nejaky bug - bez tohoto se neprovedl spravne nasledny refresh tray - needed for successful tray refresh
    SystemTray_Refresh()
    Exit
EndIf

While 1
    Zpracuj_Diff() ; process difefrences window
    Zpracuj_Hist() ; process history window
    Sleep(100)
WEnd

Func Zpracuj_Diff()
    $okno_diff = WinGetHandle("ObjectCycle: Differences", "Next Diff")
    If (Not @error) And ($okno_diff <> $okno_diff_prev) Then
        $listview = ControlGetHandle($okno_diff, "", "SysListView321")

        ; zvetseni velikosti okna/listview - increase size of window/listview
        WinMove ($okno_diff, '', 0, 0, @DesktopWidth, @DesktopHeight - 50)
        ControlMove ($okno_diff, '', $listview, Default, Default, @DesktopWidth-30, @DesktopHeight - 50 - 75)

        ; sloupce s verzi nastavit na autosize - columns with version set to autosize
        $c0 = _SendMessage($listview, $LVM_GETCOLUMNWIDTH, 0)
        $c2 = _SendMessage($listview, $LVM_GETCOLUMNWIDTH, 2)
        $c3 = _SendMessage($listview, $LVM_GETCOLUMNWIDTH, 3)
        ; 1.verze bude polovina z viditelne sirky listview (odectene 3 sirky sloupcu)
        ; 1.version will be half of visible width of listview (subtracted 3 widths of columns)
        _SendMessage($listview, $LVM_SETCOLUMNWIDTH, 1, (@DesktopWidth-30-$c0-$c2-$c3)/2)
        _SendMessage($listview, $LVM_SETCOLUMNWIDTH, 4, $LVSCW_AUTOSIZE)

        ControlMove($okno_diff, "", "Static1", Default, @DesktopHeight - 50 - 55 + 3)
        ControlMove($okno_diff, "", "Edit1", Default, @DesktopHeight - 50 - 55)

        ControlMove($okno_diff, "", "Button1", @DesktopWidth - 17 - 3*75 - 2*15, @DesktopHeight - 50 - 55)
        ControlMove($okno_diff, "", "Button2", @DesktopWidth - 17 - 2*75 - 15, @DesktopHeight - 50 - 55)
        ControlMove($okno_diff, "", "Button3", @DesktopWidth - 17 - 75, @DesktopHeight - 50 - 55)

        ; je treba prekreslit okno - needed to repaint window
        _WinAPI_InvalidateRect($okno_diff, 0, 0) ; Erase=False

        $okno_diff_prev = $okno_diff
    EndIf
EndFunc

Func Zpracuj_Hist()
;~  $okno_hist = WinGetHandle("ObjectCycle : ", "Description") ; ObjectCycle : s_minmaxinfo.srs Properties
    $okno_hist = WinGetHandle("[REGEXPTITLE:ObjectCycle : (.*?) Properties]", "") ; ObjectCycle : s_minmaxinfo.srs Properties
    If (Not @error) And ($okno_hist <> $okno_hist_prev) Then
        $tab = ControlGetHandle($okno_hist, "", "SysTabControl321")
        ControlCommand($okno_hist, "", $tab, "TabRight", "")
        Sleep(100) ; nutne! jinak se chybne pozicuje listview a tlacitka pri objeveni okna - needed else badly positioned listview and buttons at window showing
        $listview = ControlGetHandle($okno_hist, "", "SysListView321")

        ; vycentrovat okno na obrazovce, jen horizontalne - centre window on the screen, only horizontally
        $pos = WinGetPos($okno_hist, '')
        WinMove ($okno_hist, '', (@DesktopWidth - 800)/2, $pos[1], 800)
        ControlMove ($okno_hist, '', $tab, Default, Default, 780)

        ;~ ControlMove ('', '', $listview, Default, Default, 700)
        ControlMove ($okno_hist, '', $listview, 8, 10, 700)

        ; zvetsit nektere sloupce  - nastavit na autosize - increase some columns (set to autosize)
        _SendMessage($listview, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE) ; verze
        _SendMessage($listview, $LVM_SETCOLUMNWIDTH, 2, $LVSCW_AUTOSIZE) ; user
        _SendMessage($listview, $LVM_SETCOLUMNWIDTH, 5, $LVSCW_AUTOSIZE) ; comments

        ControlMove($okno_hist, "", "Button1", 715, Default)
        ControlMove($okno_hist, "", "Button2", 715, Default)
        ControlMove($okno_hist, "", "Button3", 715, Default)

        ; je treba prekreslit okno - needed to repaint window
        ControlCommand($okno_hist, "", $tab, "TabLeft", "")
        ControlCommand($okno_hist, "", $tab, "TabRight", "")

        $okno_hist_prev = $okno_hist
    EndIf
EndFunc

Func SystemTray_Refresh()
    $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "")
    $hParent  = ControlGetHandle($hTaskBar, "", "TrayNotifyWnd1")
    $hWnd     = ControlGetHandle($hParent, "", "ToolbarWindow321")

    $WinRect  = _WinAPI_GetWindowRect($hWnd)

    $aMousePos = MouseGetPos()

    $Left  = DllStructGetData($WinRect, "Left")
    $Right = DllStructGetData($WinRect, "Right")
    $Top   = DllStructGetData($WinRect, "Top")

    For $i = $Left To $Right
        MouseMove($i, $Top, 0)
    Next

    MouseMove($aMousePos[0], $aMousePos[1], 0)
EndFunc

post-6483-0-45889900-1370556008_thumb.pn

Edited by Zedna
Link to comment
Share on other sites

@Zedna - Just so I know we are on the same page here.

Your code can resize a window of a non AutoIt program, that doesn't allow resizing manually?

Something like the program Tagscanner comes to mind, as I know I have had difficulties in the past with that, though I think it is made with a different language these days, so may be better.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Your code can resize a window of a non AutoIt program, that doesn't allow resizing manually?

Yes.

I can post here whole AU3 source if somebody want it.

but it's probably not so usefull because ObjectCycle is source control system for PowerBuilder which is (not free) programming language by Sybase.

So other people who doesn't work with it can't test it how it works.

Edited by Zedna
Link to comment
Share on other sites

Here you go :

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Local Const $hWnd = WinGetHandle("[CLASS:HH Parent]")
If @error Then MsgBox(0, "error", "error")

Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)

$iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER, $WS_SIZEBOX), $WS_POPUP)

_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle)
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOZORDER, $SWP_NOMOVE, $SWP_NOSIZE))
Based on >this topic.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Yes.

I can post here whole AU3 source if somebody want it.

If it's not too much trouble.

Not that I need it right now, but it would be handy to have the resource somewhere ... save me the trouble of working it all out myself one day when I feel the need. Someone might even like to adapt it and make it standalone.

Might be better to put it into the Examples forum, with a link here perhaps? That's if it's not already there somewhere.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

So that was the remove border what about resize and moving the actually window?. I tried this my self but thats just lol.

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Local Const $hWnd = WinGetHandle("[CLASS:Notepad]")
If @error Then MsgBox(0, "error", "error")

Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)

$iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER, $WS_SIZEBOX), $WS_POPUP, $WS_SYSMENU)

_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle)
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOZORDER, $SWP_NOMOVE, $SWP_NOSIZE))


_movewindow()
func _movewindow()
                    $winpos = WinGetPos($hWnd)
                    MouseMove(($winpos[2] / 2) + $winpos[0], ($winpos[3] / 2) + $winpos[1],0)
                    MouseDown("primary")
                    While 1
                    $avPos = MouseGetPos()
                    WinMove($hWnd, "", $avPos[0] - ($winpos[2] / 2), $avPos[1] - ($winpos[3] / 2))
                    If Not _IsPressed(01) And Not _IsPressed(02) Then ExitLoop
                    $winpos2 = WinGetPos($hWnd)
                Sleep(10)
        WEnd
endfunc
Edited by wazer
Link to comment
Share on other sites

Yes.

I can post here whole AU3 source if somebody want it.

but it's probably not so usefull because ObjectCycle is source control system for PowerBuilder which is (not free) programming language by Sybase.

So other people who doesn't work with it can't test it how it works.

 

Sounds interresting also without border?

Can you give an example with notepad fx?

Link to comment
Share on other sites

So that was the remove border what about resize and moving the actually window?. I tried this my self but thats just lol.

Very constructive.

Yes it removes the border, but it cannot be resizable.

;makes it sizeable
$iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER), $WS_POPUP)
That's Your _movewindow function which is "just lol"

Br, FireFox.

Link to comment
Share on other sites

@Zedna - Thanks for sharing!

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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...