From: Timo Kunze on
Am 31.07.2010 19:40, schrieb io_x:
> "io_x" <a(a)b.c.invalid> ha scritto nel messaggio
> news:4c52facb$0$18657$4fafbaef(a)reader3.news.tin.it...
>> yes thank you, all right now,
>> i forget to change each of *A OS function with *W function
>
> and how change the color of text in a edit sub-window?

You need to handle WM_CTLCOLOREDIT.
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
From: io_x on

"Timo Kunze" <TKunze71216(a)gmx.de> ha scritto nel messaggio
news:i31vq6$9bi$1(a)speranza.aioe.org...
> Am 31.07.2010 19:40, schrieb io_x:
>> "io_x" <a(a)b.c.invalid> ha scritto nel messaggio
>> news:4c52facb$0$18657$4fafbaef(a)reader3.news.tin.it...
>>> yes thank you, all right now,
>>> i forget to change each of *A OS function with *W function
>>
>> and how change the color of text in a edit sub-window?
>
> You need to handle WM_CTLCOLOREDIT.

thank you it is ok

but how identify the edit windows to whom it is direct?
i have the ID of the dialog box edit subwindow...
what about use
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
for build one array of HWNDs
and when the WM_CTLCOLOREDIT [or better WM_CTLCOLORSTATIC
] is raised use that array for know the number ID from the HDWN of
the edit window?

it seems WM_CTLCOLOREDIT is send 2 times for each edit window
why?
but why it has to return the brush handle?

i change the color of bkground and text in only one WM_CTLCOLORSTATIC
message, it is all right i return in eax only the bkground brush?

than the first edit window is select when the program run
how to do: "no sub edit window select"? [ pheraps i have to see
if i check the "tab stop" item when run the windows IDE builder]

> --
> www.TimoSoft-Software.de - Unicode controls for VB6
> "Those who sacrifice freedom for safety deserve neither."
> "Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
> �berzeugung, dass die demokratischen Kr�fte �berwiegen und sich - auf
> demokratischem Wege - durchsetzen."




From: Timo Kunze on
Am 02.08.2010 09:01, schrieb io_x:
> it seems WM_CTLCOLOREDIT is send 2 times for each edit window
> why?

It is sent whenever the edit window is drawn.

> but why it has to return the brush handle?

Because this brush is used to draw the control's background.

> i change the color of bkground and text in only one WM_CTLCOLORSTATIC

WM_CTLCOLORSTATIC is used when the control is read-only or disabled.

Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
From: io_x on

"Timo Kunze" <TKunze71216(a)gmx.de> ha scritto nel messaggio
news:i35vv9$5od$1(a)speranza.aioe.org...
> Am 02.08.2010 09:01, schrieb io_x:
>> it seems WM_CTLCOLOREDIT is send 2 times for each edit window
>> why?
>
> It is sent whenever the edit window is drawn.
>
>> but why it has to return the brush handle?
>
> Because this brush is used to draw the control's background.
>
>> i change the color of bkground and text in only one WM_CTLCOLORSTATIC
>
> WM_CTLCOLORSTATIC is used when the control is read-only or disabled.
>
> Timo

thank you
the problem was only paint one chess board and a function
for write pieces in it

; Bianchi+4*Npezzo == indirizzo di stampa
; 1 1 1 1
Bianchi db 020h, 0, 0, 0 ; Spazio B 0 0 0
db 054h, 026h, 0, 0 ; Re B 1 1 1
db 055h, 026h, 0, 0 ; Regina B 2 10 2
db 056h, 026h, 0, 0 ; Torre B 3 11 3
db 057h, 026h, 0, 0 ; Alfiere B 4 100 4
db 058h, 026h, 0, 0 ; Cavallo B 5 101 5
db 059h, 026h, 0, 0 ; Pedina B 6 110 6
db 020h, 0, 0, 0 ; Spazio B 7 111 7
Neri db 020h, 0, 0, 0 ; Spazio N 8 1000 8
db 05Ah, 026h, 0, 0 ; Re N 9 1001 9
db 05Bh, 026h, 0, 0 ; Regina N 10 1010 A
db 05Ch, 026h, 0, 0 ; Torre N 11 1011 B
db 05Dh, 026h, 0, 0 ; Alfiere N 12 1100 C
db 05Eh, 026h, 0, 0 ; Cavallo N 13 1101 D
db 05Fh, 026h, 0, 0 ; Pedina N 14 1110 E
db 020h, 0, 0, 0 ; Spazio N 15 1111 F

section BSS
CaselleH resd 64 ; handle delle caselle come finestra
CaselleBk resd 64 ; il colore Bk delle caselle
CaselleFg resd 64 ; il colore Fg delle caselle
CaselleCh resd 128 ; il carattere nelle caslle

section TEXT

; Arial Unicode MS U+2654
; Meiryo U+265f
; Meiryo U+2655
; MS Mincho U+2655
; MS Segoe UI Symbol

<< ID_MAINDIALOG=300
align 4
Main:
*hInstance=GetModuleHandleW(0)
;iint3
< "Unicode"
< 0
< 0
< 0
< 0
< &DEFAULT_CHARSET
< 0
< 0
< 0
< 0
< 0
< 0
< 16
< 32
CreateFontW()|*hrfont=a
a==0#.10
< "Unicode"
< 0
< 0
< 0
< 0
< &DEFAULT_CHARSET
< 0
< 0
< 0
< 0
< 0
< 0
< 16
< 32
CreateFontW()|*hrfont2=a
a==0#.10
CreateSolidBrush(0646464h)|a==0#.10|*BrushBkCaselleNere =a ; e' un tipo
di grigio
CreateSolidBrush(0FFFFFFh)|a==0#.10|*BrushBkCaselleBianche=a

DialogBoxParamW(D[hInstance], ID_MAINDIALOG, 0, MainDialogProc, 0)
..1:
..10: a=*hrfont2 |a==0#.1a|DeleteObject(a)
..1a: a=*hrfont |a==0#.1b|DeleteObject(a) ; errore se ritorna 0
;iint3
..1b: a=*BrushBkCaselleNere |a==0#.1c|DeleteObject(a)
..1c: a=*BrushBkCaselleBianche|a==0#.a |DeleteObject(a)
..a:
a=*uscita
..2: ExitProcess(a)
ret

<< MD_RED=1090
<< MD_ED0=1000
<< MD_BTN_ON_BIACO_NERO =1068
<< MD_BTN_ON_BIACO_BIANCO=1069
<< MD_BTN_ON_NERO_NERO =1071
<< MD_BTN_ON_NERO_BIANCO =1070

; casele==0..63==ID 1000..1063
; A..H==1091..1098 [caselle statiche]
; 1..8==1099..1106 [caselle statiche]

; 0Ra, 4HDlg, 8Message, 12wParam, 16lParam +32
; 32 ,36 ,40 , 44 , 48
align 4
MainDialogProc:
pushad
s-=1024
<< hDlg=1060, Message=1064, wParam=1068, lParam=1072
r=^Message|i=^hDlg
r==&WM_COMMAND!#.1
a=^wParam
^lParam==0#.3
r=^wParam |shr edx 16
dx==&BN_CLICKED!#.3
r=^lParam|MD_ButtonClick(i, a, r)
#.4
..1: ^Message == &WM_INITDIALOG!#.2
;iint3
a=*hrfont|j=a|k=0
..11: a=&*k+MD_ED0
SendDlgItemMessageW(i, a, &WM_SETFONT, j, 0)
++k|k<=63#.11
..1a:
j=s|D*s=0|SetDlgItemTextA(i, MD_RED, j)
k=0|j=1000
..14: GetDlgItem(i, j)
D*CaselleH +k*4=a|a==0#.2b
D*CaselleFg+k*4=0 ; il colore del testo e' nero
a=k|pari()|c==1!#.15|a&1#.17|#.16 ; disegna le caselle Bianche-Nere
..15: a&1#.16|#.17
..16: a=0FFFFFFh|#.18
..17: a=0646464h
..18: D*CaselleBk+k*4=a
D*CaselleCh+k*8=0A03000h ; carattere 2 spazi
D*CaselleCh+k*8+4=0 ; tutti i restanti caratteri sono zero
++k|++j|k<=63#.14
k=0
..19: r=&*CaselleCh+k*8|a=k|a+=1000 ; in a il N.ID
SetDlgItemTextW(i, a, r)|++k|k<=63#.19
..1b: #.4
..2: ^Message == &WM_CLOSE!#.2c
..2b: EndDialog(i,0)|#.4
..2c: ^Message == &WM_CTLCOLORSTATIC!#.3
a=^1072|TrovaNCasella()|jnc .21
; se CF==1 disegna le edit non in scacchiera
a=^1068|SetBkColor(a, 0FFFFFFh)
..20: s=&*s+1024|popad|a=*BrushBkCaselleBianche|#.z
..21: k=a ; in k il numero della casella
c=*CaselleFg+k*4|a=^wParam|SetTextColor(a, c)
c=*CaselleBk+k*4|a=^wParam| SetBkColor(a, c)
c=*CaselleBk+k*4|c==0FFFFFFh#.20
s=&*s+1024|popad|a=*BrushBkCaselleNere|#.z
..3: s=&*s+1024|popad|a=&FALSE|#.z
>> hDlg, Message, wParam, lParam
..4: s=&*s+1024|popad|a=&TRUE
..z:
ret 16

; parametro in eax
align 4
TrovaNCasella:
c=0
..1: D*CaselleH+c*4==a#.f
++c|c<=63#.1|a=0|stc|#.z
..f: a=c|clc
..z:
ret

; parametro in eax risultato in eax
align 4
DaiHandleCasllaDallID:
a-=1000|<?#.e|a>63#.e|#.1
..e: a=0|stc|#.z
..1: a=*CaselleH+a*4|clc
..z:
ret


; in eax parametro
; in ecx result
align 4
pari:
a>63#.e|c=a|#.1
..e: c=0|stc|#.z
..1: c>>=3|c&=1|clc
..z:
ret


; MD_BTN = 1300
; MD_BTN_DLGFIL = 1302
; int MD_ButtonClick(u32 Handle, u32 Message, u32 lMessage)
; 0k,4j,8i,12b,16Ra, 20P_Handle, 24P_Message, 28P_Lmessage +2048
; 2068 2072 2076
align 4
MD_ButtonClick:
<b,i,j,k
s-=2048
<< InpHandle=44, OutHandle=48, KeyHandle=52
;iint3
i=^2068|b=^2072|#.1
#.9
..1: b==MD_BTN_ON_BIACO_NERO!#.2
;iint3
c=0Eh|a=1|DisegnaPezzoCasella()
#.9
..2: b==MD_BTN_ON_BIACO_BIANCO!#.3
c=06h|a=1|DisegnaPezzoCasella()
#.9
..3: b==MD_BTN_ON_NERO_NERO!#.4
;iint3
c=0Eh|a=0|DisegnaPezzoCasella()
#.9
..4: b==MD_BTN_ON_NERO_BIANCO!#.5
;iint3
c=06h|a=0|DisegnaPezzoCasella()
#.9
..5:
..9: a=1|clc
..z:
>> InpHandle, OutHandle, KeyHandle
s=&*s+2048
>b,i,j,k
ret 12

; disegnaPezzoCasella(esi:HandleFinestraDialogo, eax:Ncasella, ecx:Npezzo)
; Npezzo: 0<space>, 1<Re>, 2<Regina>, 3<Torre>, 4<Alfiere>, 5<Cavallo>,
6<pedoni> [bianchi]
; 8<space>, 9<Re>, A<Regina>, B<Torre>, C<Alfiere>, D<Cavallo>,
E<pedoni> [NERI]
; se il pezzo e' nero: scrivi nella casella
; se il pezzo e' bianco e la casella e' bianca
; scrivi nella casella
; altrimenti se il pezzo e' bianco e la casella e' nera
; cambia il colore di foregraund della casella
; e scrivi il corrispondente pezzo nero
align 4
DisegnaPezzoCasella:
a>63#.z|c>0F#.z ; gli errori di range
c<=7#.4 ; se il pezzo e' bianco vai a .4
..1: r=*Bianchi+c*4 ; qui il pezzo e' nero
*CaselleCh+a*8=r
r=&*CaselleCh+a*8 ; in r la stringa da scrivere
<a
a+=1000 ; in a id della finestra
SetDlgItemTextW(i, a, r)
>a
; se la casella e' bianca finisce
D*CaselleBk+a*4==0FFFFFFh#.z
; qui si parla di caselle nere
D*CaselleFg+a*4=0 ; scrive in Nero
c=*CaselleH+a*4
PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)|#.z
..4: D*CaselleBk+a*4==0FFFFFFh#.1 ; se la casella e' bianca => ".1"
; altrimenti: Pezzo Bianco su casella nera
c|=8 ; trasforma il pezzo da bianco in nero e inverte il colore FG
r=*Bianchi+c*4
*CaselleCh+ a*8=r ; lo salava nella casella
r=&*CaselleCh+a*8 ; in r la stringa da scrivere
D*CaselleFg+a*4=0FFFFFFh ; scrive in Bianco
<a ; salva a==N. casella
a+=1000 ; in a id della finestra
SetDlgItemTextW(i, a, r)
>a
c=*CaselleH+a*4
PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)
..z:
ret

is unicode db 020h, 00h, 00h, 00h is a string space?
or the string space is: db 00h, 020h, 00h, 00h?

but i'm not too much sure of above
"PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)"
it has 'redesign' the cell of handle c, but i write like
HDC 0 because i not know the HDC the Sys use...

possible there are leaks here if sys create new HDCs?

here not, the sys send to that message
only 3 possible [in rotating] values for the HDC
in "wParam" for the same cell...



From: io_x on

"io_x" <a(a)b.c.invalid> ha scritto nel messaggio
news:4c5857a0$0$18658$4fafbaef(a)reader3.news.tin.it...
> but i'm not too much sure of above
> "PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)"
> it has 'redesign' the cell of handle c, but i write like
> HDC 0 because i not know the HDC the Sys use...
>
> possible there are leaks here if sys create new HDCs?
>
> here not, the sys send to that message
> only 3 possible [in rotating] values for the HDC
> in "wParam" for the same cell...

if nobody answer...
was not "PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)"
that send the message WM_CTLCOLORSTATIC
but just the setwindowtexW or the function like that
so all right here too
if i cancell "PostMessageW(i, &WM_CTLCOLORSTATIC, 0, c)"