Helgef wrote:Maybe use the + option for the style to apply it, eg, WinSet,Style, +SOME_STYLE, .... Without the + you would set the style to be just SOME_STYLE.
Yes this helps in the example above. Thanks.
But my problem isn't solved yet completly: What if I removed a style in the original Window?
Modification from above Solution:
Code: Select all
Run notepad.exe,,, oPID
WinWait ahk_pid %oPID%
hWnd := WinExist("ahk_pid" oPID)
; #####################
; Remove a style
WinSet, Style, -0x20000, ahk_id %hwnd%
; #####################
WinGet, origStyle, Style, ahk_id %hwnd%
MsgBox % "Original Style was <" origStyle ">"
WinKill, ahk_id %hwnd%
styles:=[]
while origStyle
if (origStyle & 2**(A_Index))
styles.push(2**A_Index), origStyle^=2**A_Index
Run notepad.exe,,, oPID2
WinWait ahk_pid %oPID2%
hWnd2 := WinExist("ahk_pid" oPID2)
Sleep 2000
strNot := ""
strSet := ""
for k, v in styles {
str := format("0x{:x}",v)
str := "+" str
try {
WinSet, Style, %str%, ahk_id %hwnd2%
strSet .= str "`n"
} catch e {
strNot .= str "`n"
}
}
WinKill, ahk_id %hwnd2%
MsgBox % "Styles which have been set:`n" strSet "Style NOT set:`n" strNot
As you see I remove a style (MINIMIZEBOX) from the original notepad - how can I determine which styles have to be removed in the second notepad?
There seems to be some math needed - have to think about it.