senthor Posted February 11, 2009 Posted February 11, 2009 (edited) Hi!I'm currently trying to create a GUI like this one:Found in this thread.Now, I want the slider to have the same background color as the tab control. How to do that?I actually tried PixelGetColor(), it works but needs some millisecs.And I didn't figure it out how to use _WinAPI_GetSysColor().The tab control bgcolor shouldn't change, it should be system default.Thanks! Edited February 11, 2009 by senthor FileListToArray UDFMy tools
senthor Posted February 11, 2009 Author Posted February 11, 2009 (edited) OK, I found something...Need help to translate.GetThemeColor function in uxtheme.dll, see here.Somebody can help plz?Til now I have:($gui is the handle to the gui)$htheme = DllCall("uxtheme.dll", "int:hwnd", "OpenThemeData", "hwnd", $gui, "str", "TABP_BODY") $color = DllCall("uxtheme.dll", "int:COLORREF", "GetThemeColor", "HTHEME", $htheme, "int", "TABP_BODY", "int", "", "int", "TMT_COLOR") DllCall("uxtheme.dll", "int:hwnd", "CloseThemeData", "hwnd", $htheme) Edited February 11, 2009 by senthor FileListToArray UDFMy tools
martin Posted February 11, 2009 Posted February 11, 2009 OK, I found something... Need help to translate. GetThemeColor function in uxtheme.dll, see here. Somebody can help plz? Til now I have: ($gui is the handle to the gui) $htheme = DllCall("uxtheme.dll", "int:hwnd", "OpenThemeData", "hwnd", $gui, "str", "TABP_BODY") $color = DllCall("uxtheme.dll", "int:COLORREF", "GetThemeColor", "HTHEME", $htheme, "int", "TABP_BODY", "int", "", "int", "TMT_COLOR") DllCall("uxtheme.dll", "int:hwnd", "CloseThemeData", "hwnd", $htheme)You need to look up the functions on msdn to see how you should be using them, and you need to learn about using dllcall. The help explains enough for you to have made a better shot at how to call the functions than you have done, and so I think you should put some effort into reading up on all this before asking for help. Or, if you are totally lost, then you need to explain which particular part you don't understand. 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.
senthor Posted February 12, 2009 Author Posted February 12, 2009 Sorry, I read the help file, studied some examples and I used msdn. But I just don't get it, sorry! This is the newest version I have: $classes = WinGetClassList("[CLASS:AutoIt v3 GUI;TITLE:ModMan]") $struct = DllStructCreate("COLORREF") $struct2 = DllStructCreate("str") DllStructSetData($struct2, 1, $classes) $htheme = DllCall("uxtheme.dll", "none", "OpenThemeData", "hwnd", $gui, "ptr", DllStructGetPtr($struct2)) $color = DllCall("uxtheme.dll", "int:COLORREF", "GetThemeColor", "HTHEME", $htheme, "int", "TABP_BODY", "int", "", "int", "TMT_COLOR") DllCall("uxtheme.dll", "none", "CloseThemeData", "hwnd", $htheme) The problem is that I have never really worked with structs before and I don't know what kind of data a COLORREF structure is, etc! So please help me, I just can't do it alone. FileListToArray UDFMy tools
martin Posted February 12, 2009 Posted February 12, 2009 (edited) Sorry, I read the help file, studied some examples and I used msdn. But I just don't get it, sorry! This is the newest version I have: $classes = WinGetClassList("[CLASS:AutoIt v3 GUI;TITLE:ModMan]") $struct = DllStructCreate("COLORREF") $struct2 = DllStructCreate("str") DllStructSetData($struct2, 1, $classes) $htheme = DllCall("uxtheme.dll", "none", "OpenThemeData", "hwnd", $gui, "ptr", DllStructGetPtr($struct2)) $color = DllCall("uxtheme.dll", "int:COLORREF", "GetThemeColor", "HTHEME", $htheme, "int", "TABP_BODY", "int", "", "int", "TMT_COLOR") DllCall("uxtheme.dll", "none", "CloseThemeData", "hwnd", $htheme) The problem is that I have never really worked with structs before and I don't know what kind of data a COLORREF structure is, etc! So please help me, I just can't do it alone.You need to get some basics right. In AutoIt you pass parameters to the iunction in the dll by supplying both type of variable for that parameter is, and then the actual parameter. You also specify the dll name, the variable type that the function you are going to call returns and the function name before you give the parameters. So in this line $color = DllCall("uxtheme.dll", "int:COLORREF", "GetThemeColor", "HTHEME", $htheme, "int", "TABP_BODY", "int", "", "int", "TMT_COLOR") you are saying call a function in "uxtheme.dll" the function will return a variable of the type "int:COLORREF" the function to call is "GetThemeColor" the first parameter is a variable type "HTHEME" the value of the first parameter is $htheme the next parameter is of type "int" and the value of the int is "TABP_BODY" the last parameter is of type "int" and its value is "TMT_COLOR" But if you have studied the help and that is the result then you really shouldn't be trying to use DllCall untill you have a better understanding, because AutoIt does not have a variable int:COLORREF, it should be "int", it doesn't have a type HTHEME, "TABP_BODY" and "TMT_COLOR" are not ints they are strings and the msdn you gave a link to explains that. (TMT_COLOR is a defined integer value in C but "TMT_COLOR" is a string.) That is why I think you could have found what you need in the help and in the msdn info which explains it as well as I or most people here could do I think, so you need to put a lot more time and suffering into understanding it and go a smaller step at a time than you are trying to do now. Otherwise you are effectively asking someone else to write what you want because you can't. Best to try the examples in the help, struggle with them, play with them to get something different happening then when you are stuck ask for help explaining or how to do the next small step. I would hav ethought it was much easier to get the colour of the tab with pixelgetcolor as you originally said. #include <GuiConstants.au3> #include <windowsconstants.au3> $Gui = GuiCreate("Test") GUISetBkColor(0xa9a9a8) $prog1 = GUICtrlCreateSlider(10,70,120,30) GUICtrlSetBkColor(-1,0xffff00) GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreatetab(10,140,200,200) GUICtrlCreateTabItem("one") Opt("pixelcoordmode",2) $tabcol = PixelGetColor(14,170) $prog1 = GUICtrlCreateSlider(30,200,120,30) GUICtrlSetBkColor(-1,$tabcol) GUICtrlCreateTabItem("") GUISetState() GUISetBkColor(0xffff00) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited February 12, 2009 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.
senthor Posted February 12, 2009 Author Posted February 12, 2009 (edited) OK, I got it.If you don't want to help me, stop it.Because I have tried all you say, I have compared examples and I changed them.But if you don't want to help, then I'm sorry for posting a question in a "Help and Support" forum.Thanks, I'll try my best in other communities.EDIT:Those friendly guys of the German autoit community were so kind to help me, and now I can understanding what I did wrong.This is the example:Global Const $VSCLASS_TAB = "TAB" Global Const $TABP_TABITEM = 1 Global Const $TABP_TABITEMLEFTEDGE = 2 Global Const $TABP_TABITEMRIGHTEDGE = 3 Global Const $TABP_TABITEMBOTHEDGE = 4 Global Const $TABP_TOPTABITEM = 5 Global Const $TABP_TOPTABITEMLEFTEDGE = 6 Global Const $TABP_TOPTABITEMRIGHTEDGE = 7 Global Const $TABP_TOPTABITEMBOTHEDGE = 8 Global Const $TABP_PANE = 9 Global Const $TABP_BODY = 10 Global Const $TABP_AEROWIZARDBODY = 11 Global Const $TMT_COLOR = 204 Global Const $TMT_FILLCOLOR = 3802 Global Const $TMT_FILLCOLORHINT = 0x0EED $hWnd = GUICtrlGetHandle($tab); Handle of the Tabcontrol $hTheme = DllCall("uxTheme.dll", "ptr", "OpenThemeData", "hwnd", $hWnd, "wstr", $VSCLASS_TAB) $hTheme = $hTheme[0] $COLORREF = DllCall("uxTheme.dll", "lresult", "GetThemeColor", "ptr", $hTheme, "int", $TABP_PANE, "int", 0 , "int", $TMT_FILLCOLOR, "dword*", 0) $COLORREF = $COLORREF[5] $RGB = _BGR2RGB($COLORREF) DllCall("uxTheme.dll","lresult","CloseThemeData","ptr", $hTheme) Func _BGR2RGB($iColor) Return Number(String(BinaryMid(Binary($iColor),1,3))) EndFuncConsts found here Edited February 12, 2009 by senthor FileListToArray UDFMy tools
enaiman Posted February 12, 2009 Posted February 12, 2009 If you don't want to help me, stop it.That's an interesting statement ... For me it is more than obvious that Martin wanted to help you - do you think he would have written such a long reply without the intention of helping you? Please, think about that before upsetting the people who tries to help you.A Chinese proverb says:Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.... that was what Martin tried to do ... SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
senthor Posted February 12, 2009 Author Posted February 12, 2009 Of course he did, but I got absolutely no information. A few things would've been enough- I asked for them- but instead I only got commetaries about not reading the help file. FileListToArray UDFMy tools
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now