Sign in to follow this  
Followers 0
mercadantelaura

Help to disable borders of Active window

5 posts in this topic

I want that my active window (not a window GUI but the Window opened from different programs Audio/Video or explorer.exe) have only internal contents: "Text / htm / Image / video"

without its borders and its title row of that window.
I have readed on web that function to use is

_WinAPI_SetWindowLong()
and on guide i see how use it: _WinAPI_SetWindowLong($hWnd, $iIndex, $iValue)

I have found also This:

 

Formatted for AutoIt with the GeSHI Syntax Highlighter [copy or print]
F1:: ; Remove caption and sizing border from the active window.
{
   WinSet, Style, -0xC00000, A    
   WinSet, Style, -0x40000, A    
}
Return
 
F2:: ; Return active window to normal.
{
   WinSet, Style, +0xC00000, A    
   WinSet, Style, +0x40000, A
}
Return

 

....but causes error this script found and i don't found other specific example
My script wrote :

#include <WinAPI.au3>
#include <constants.au3>
$iValue = "-0xC00000"

$hWnd = WinGetHandle("[Active]")
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iValue)

Please can give me some example to do this.
Thanks

Share this post


Link to post
Share on other sites



Nobody can better explain to me how use this function  "_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iValue)"
on Win7 x64 in order to show only thin border of my active window ?

I have already inserted how guide report the Handle of Active Window using "WinGetHandle" then i have chooseed
$GWL_STYLE option and set value to "-0xC00000" but don't run.

If you can, give me help.

Thanks
 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Don't know why you have been ignored because there are plenty of people here who could have helped you with this.

All you need to do is get the window style, turn off the border bits in the style then set the style, like this (if I understand)

#include <winapi.au3>
#include <windowsconstants.au3>

$Title = "Some Title" ; the title or the start of the title for the window to change
;$Title = "[ACTIVE]" for the active window

If Not WinExists($Title) Then
    MsgBox(262144, "Something Wrong", "ok")
    Exit
EndIf

$hW = WinGetHandle($Title)

$features = _WinAPI_GetWindowLong($hW, $GWL_STYLE)

$NewFeatures = BitXOR($features, $WS_BORDER)

_WinAPI_SetWindowLong($hW, $GWL_STYLE, $NewFeatures)

Sleep(9000)
;set it back as it was gain
_WinAPI_SetWindowLong($hW, $GWL_STYLE, $features)
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you for help.

Running your script cause me this error :   "Variable used without being declared"
Reading guide for this function, its report that is necessary include also <constant.au3> infact including also this,  error disappear, but border is not setted to THIN.
To obtain THIN border i must also MINIMIZE and then RESTORE "active window" and change take effect also if it is not immediately and is visibile Minimizing an restoring action How can i refresh window to have NOT border without minimize and restore it ?

WinSetState ( $hW, "", @SW_MINIMIZE )
    sleep(10)
WinSetState ( $hW, "", @SW_RESTORE )

Then my Script continue with these rows....
 

HotKeySet("+{ESC}", "GoOUT")
If @OSVersion = "WIN_7" Then
    $sControl = "DirectUIHWND3" ;   Right Panel Control for Windows 7 x64
Else
    $sControl = "SysListView321"    ;   Right Panel Control for Windows XP and Win2000
Endif

$ItemNumber = ControlListView($hW, "", $sControl,"GetItemCount")
$SelectNumber = ControlListView($hW, "", $sControl, "GetSelectedCount")

If $SelectNumber < $ItemNumber Then
    ControlListView($hW, "", $sControl, "SelectAll")
    ControlListView($hW, "", $sControl, "ViewChange", "largeicons")
Endif

While WinExists ($hw)
    Sleep(300)
Wend


Func GoOUT()
    ControlListView($hW, "", $sControl, "SelectClear")
    ControlListView($hW, "", $sControl, "ViewChange", "details")
    Exit
EndFunc

Unfortunately this run's very well under Windows XP and Windows 2000 but
under my other OS:  Windows7 x64 don't take effect also if "DirectUIHWND3" is the correct name of
Right Panel Control obtained using this function    $sControl = ControlGetFocus(WinGetTitle("[Active]"))

I want select "all" and change from "DETAILS" to "EXTRA LARGEICONS" for Win7 and then...
....When i finished my work pressing "SHIFT-ESC"  DESELECT ALL and come back to Details

Can you help me with some suggestions for both problems ?

 

Thanks again

Edited by mercadantelaura

Share this post


Link to post
Share on other sites

The thin border to take immediately effect  of my window Program the only way is to start my program minimize,

then remove border and only then restore window ?

There is somebody that have a different solution to give me please?

Run("Program", "", @SW_minimize)

$hW = WinGetHandle($Title)

$features = _WinAPI_GetWindowLong($hW, $GWL_STYLE)
$NewFeatures = BitXOR($features, $WS_BORDER)

_WinAPI_SetWindowLong($hW, $GWL_STYLE, $NewFeatures)
Winsetstate($hw, "", @SW_Restore)

For second problem posted i will open new topic only for that.

Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0