Sign in to follow this  
Followers 0
Rawox

Changing Window Attributes

4 posts in this topic

#1 ·  Posted (edited)

Hi there,

Is it possible to change a Windows attribute, like notepad (not an AutoIt GUI).

I tried this:

#include <WinApi.au3>
#include <WindowsConstants.au3>
Run("notepad")
WinWaitActive("[CLASS:Notepad]")
$hWndNotepad = WinGetHandle("[CLASS:Notepad]")
_WinAPI_SetWindowLong($hWndNotepad, $GWL_EXSTYLE,  BitOR(_WinAPI_GetWindowLong($hWndNotepad, $GWL_EXSTYLE), $WS_EX_APPWINDOW ))

I want to be able to add the $WS_EX_APPWINDOW to notepad so that the borders/titlebar etc. disappear...

Is this even possible?

Thanks in advance,

Rawox

Edited by Rawox

Share this post


Link to post
Share on other sites



Is it possible to change a Windows attribute, like notepad (not an AutoIt GUI).

To properly change a window style you need to hide the window, apply the style and show it again.

#include <Constants.au3>
#include <WinApi.au3>
#include <WindowsConstants.au3>
Run("notepad")
WinWaitActive("[CLASS:Notepad]")
$hWndNotepad = WinGetHandle("[CLASS:Notepad]")
_WinAPI_ShowWindow($hWndNotepad,@SW_HIDE)
_WinAPI_SetWindowLong($hWndNotepad, $GWL_EXSTYLE, $WS_EX_TOOLWINDOW)
_WinAPI_ShowWindow($hWndNotepad,@SW_SHOW)

I want to be able to add the $WS_EX_APPWINDOW to notepad so that the borders/titlebar etc. disappear...

You're sure that $WS_EX_APPWINDOW will do this? "Forces a top-level window onto the taskbar when the window is visible."... and imho nothing more or less.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ah oké! I wasn't sure about the $WS_EX_APPwindow. I'll just play around with that :)

Ok got it working now :)

Is it possible to actually recieve if a window has $WS_POPUPWINDOW as a style. I tried _WinAPI_GetWindowLong ( $hWnd, $GWL_STYLE ) which obviously returns numbers (80674816).

Can I check if a window has $WS_POPUPWINDOW?

Edited by Rawox

Share this post


Link to post
Share on other sites

Yes, try this example:

#include <Constants.au3>
#include <WinApi.au3>
#include <WindowsConstants.au3>
Run("notepad")
WinWaitActive("[CLASS:Notepad]")
$hWndNotepad = WinGetHandle("[CLASS:Notepad]")
$nOldStyle = _WinAPI_GetWindowLong($hWndNotepad, $GWL_STYLE)
_WinAPI_ShowWindow($hWndNotepad, @SW_HIDE)
_WinAPI_SetWindowLong($hWndNotepad, $GWL_STYLE, $WS_POPUPWINDOW)
_WinAPI_ShowWindow($hWndNotepad, @SW_SHOW)
_CheckIsWindowPopUpWindow($hWndNotepad)
_WinAPI_ShowWindow($hWndNotepad, @SW_HIDE)
_WinAPI_SetWindowLong($hWndNotepad, $GWL_STYLE, $nOldStyle)
_WinAPI_ShowWindow($hWndNotepad, @SW_SHOW)
_CheckIsWindowPopUpWindow($hWndNotepad)

Func _CheckIsWindowPopUpWindow($hwnd)
If BitAND(_WinAPI_GetWindowLong($hWnd, $GWL_STYLE), $WS_POPUPWINDOW) = $WS_POPUPWINDOW Then
    MsgBox(0, "Window", "is a PopUpWindow")
Else
    MsgBox(0, "Window", "is NOT a PopUpWindow")
EndIf
EndFunc

mfg autoBert

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