[H2] DLL Thread Invalid color option.

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

[H2] DLL Thread Invalid color option.

18 Jun 2017, 03:02

EXE Thread is normal.

Code: Select all

ahkThread("Gui := GuiCreate()`nFakeLink := Gui.Add(`"Text`", `"cRed`", 111)`nGui.Show()")
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [H2] DLL Thread Invalid color option.

18 Jun 2017, 07:55

Do you think the "options" use object is feasible?
AND how to quickly set the background color of the control?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [H2] DLL Thread Invalid color option.

18 Jun 2017, 12:27

1. Do you mean text:=Gui.AddText({c:"Red"}, 111)?
2. text.Opt("BackgroundRed")?
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [H2] DLL Thread Invalid color option.

18 Jun 2017, 19:34

Thanks. But this is invalid: text:=Gui.AddText({c:"Red"}, 111)

====
I have two new questions:
1, how to set the parent window of the AHK control? 2 how to set the background color of the WINAPI control?

Code: Select all

Gui := GuiCreate()
f:=Gui.AddText("x10 y10 w100 h100")

WS_CHILD:=1073741824,WS_VISIBLE:=268435456,SS_CENTER:=1
static_win := CreateWindowEx(0, "static","test",WS_CHILD|WS_VISIBLE|SS_CENTER,5,5,50,50,f.hwnd,0,A_ModuleHandle,0)
;static_win.Opt("Backgroundffffff")
; b:=Gui.AddText("x60 y60 w10 h10 Parent" f.hwnd)
f.Opt("Backgroundffffff")
Gui.Show("w300 h300")

return
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [H2] DLL Thread Invalid color option.

19 Jun 2017, 13:10

arcticir wrote:Thanks. But this is invalid: text:=Gui.AddText({c:"Red"}, 111)
Of course it is invalid, this was a question to to see if I understood you correct.
I have two new questions:
1, how to set the parent window of the AHK control? 2 how to set the background color of the WINAPI control?

Code: Select all

Gui := GuiCreate()
f:=Gui.AddText("x10 y10 w100 h100")

WS_CHILD:=1073741824,WS_VISIBLE:=268435456,SS_CENTER:=1
static_win := CreateWindowEx(0, "static","test",WS_CHILD|WS_VISIBLE|SS_CENTER,5,5,50,50,f.hwnd,0,A_ModuleHandle,0)
;static_win.Opt("Backgroundffffff")
; b:=Gui.AddText("x60 y60 w10 h10 Parent" f.hwnd)
f.Opt("Backgroundffffff")
Gui.Show("w300 h300")

return
Obviously CreateWindowEx does not return an object, you need to use Custom Control, see https://lexikos.github.io/v2/docs/comma ... htm#Custom
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [H2] DLL Thread Invalid color option.

20 Jun 2017, 05:35

What i want to say is that you do not think passing the object as an option parameter, more flexible and reasonable?
====

Yes, but obviously "GUI.ADD ()" is using CreateWindowEx,
I want to know how to specify its "hWndParent" parameter.

In other words, I need more definition of the option. Let the GUI API and WINAPI mixed use.
Otherwise, I will abandon the use of the new GUI API, and use the pure WINAPI GUI.

I recently analyzed the H version of the function "SplashImage.ahk", harvest rich.
What's important is that I can define the GUI as I like.
But unfortunately, its example is still too little, can you write a more complex example? Contains more controls, and control the operation method (eg control transparent).
thank you very much.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [H2] DLL Thread Invalid color option.

20 Jun 2017, 16:58

arcticir wrote:What i want to say is that you do not think passing the object as an option parameter, more flexible and reasonable?
I can't imagine how this would be more flexible.

Yes, but obviously "GUI.ADD ()" is using CreateWindowEx,
I want to know how to specify its "hWndParent" parameter.

In other words, I need more definition of the option. Let the GUI API and WINAPI mixed use.
Otherwise, I will abandon the use of the new GUI API, and use the pure WINAPI GUI.

I recently analyzed the H version of the function "SplashImage.ahk", harvest rich.
What's important is that I can define the GUI as I like.
But unfortunately, its example is still too little, can you write a more complex example? Contains more controls, and control the operation method (eg control transparent).
thank you very much.
You can simply use SetParent() to change or set the parent.
I don't have any time to write more complex example, the SplashImage.ahk was kind of a test how to convert c++ code to ahk.
It should be quite easy to do it with any c++ code, so you can give it a try if you have some code.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [H2] DLL Thread Invalid color option.

20 Jun 2017, 20:22

thanks.
The problem is that after using SetParent, many GUI commands are invalid. e.g.

Code: Select all

SetControlDelay(-1)
SetWinDelay(-1)
gui:=GuiCreate()
t1:=gui.addtext("w200 h200 x5 y5")
t1.Opt("Backgroundffffff")

t2:=gui.addtext("w50 h50 x2 y2","test")
SetParent(t2.hwnd,t1.hwnd)
t2.Opt("BackgroundTrans")  ; invalid. or  t2.Opt("Backgroundeeeeee") 
gui.show("w444 h434")
MsgBox
So I think the GUI.ADD () function should add a parent option.

Corresponding, I can use WINAPI completely, write the same GUI, but i just have some minor problems that can not be solved:
Set the "TEXT control" transparent, and the text is opaque.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [H2] DLL Thread Invalid color option.

21 Jun 2017, 01:06

Why would you setparent one control to another, this does not make sense to me.
Not sure about transparent, have a look how it is done in ahk source code.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [H2] DLL Thread Invalid color option.

21 Jun 2017, 02:08

Because I need to move the parent control frequently without having to consider child controls. thanks.

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 29 guests