Sign in to follow this  
Followers 0
SkellySoul

DllCall SetSysColors

5 posts in this topic

#1 ·  Posted (edited)

Hello Everyone ;)

I would like to start off by saying I really am bad with dll calling :evil:

So I found this great script it changes controls in a GUI to the windows classic theme allowing you to paint controls that the XP theme doesn't allow.

Func XPStyle($OnOff = 1)
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

It works great but what I am looking for is to change the title bar of a GUI a long with scroll bars and and everything else and I know it can be done and I think it can be done with this call SetSysColors.

If someone can please show me how to change the title bars color I think ill be set.

I found some very good info but don't know how to use it.

http://allapi.mentalis.org/tips/tip8.shtml

http://msdn.microsoft.com/en-us/library/ms724940%28VS.85%29.aspx

http://support.microsoft.com/kb/186062

I am still attempting to get it working but some help from experts would be really nice :evil:

Edited by SkellySoul

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Share this post


Link to post
Share on other sites

In the standard UDFs there is a function called _WinAPI_SetSysColors().

I honestly don't know how that one got by me but isn't there a way to set it for only one window that being the GUI it's self.

Thanks very much for helping that quickly and have a happy holidays ;)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Looking at the function and the msdn link you provided above I dont see a hwnd, so I guess it just can be set systemwide. For sure it can be done per window, but that requires more something like a custom wm_paint or a custom window class... to complicated I even start to search for examples ;)... maybe just do it as done in the example in the UDF, apply your settings => GuiSetState() => re-apply old standard values.

Edit: Merry Christmas (or happy holidays) to you too!

Edited by KaFu

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Looking at the function and the msdn link you provided above I dont see a hwnd, so I guess it just can be set systemwide. For sure it can be done per window, but that requires more something like a custom wm_paint or a custom window class... to complicated I even start to search for examples ;)... maybe just do it as done in the example in the UDF, apply your settings => GuiSetState() => re-apply old standard values.

Edit: Merry Christmas (or happy holidays) to you too!

ok, ill keep looking around and thanks very much again for the help and if you or anyone can find anything please let me know.

[Edit]

I am just adding this as a tip to remind me for later.

To change title bar color you must not use windows xp theme must be classic to change title bars color.

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

_Test()

Func _Test()
    $Test = $COLOR_ACTIVECAPTION
    _XP_Style(1)
    GUICreate("My GUI", 300, 200)
    _XP_Style(0)
    $Save = _WinAPI_GetSysColor($Test)
    _WinAPI_SetSysColors($Test , 255)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete()

    _WinAPI_SetSysColors($Test, $Save)

    Exit
EndFunc

Func _XP_Style($OnOff = 1)
    $XS_n = ""
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc
Edited by SkellySoul

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