Hello
i use some dialogs in my app and when user press on one off the menu buttons ,the dialog will show.
mean ,all controls are hidden and if user press button 1 then controls for dialog 1 will become visible,press button 2 and dialog 2 will come......
all controls have new colors and looks fine.
now if i press 20/30 times on one of the menu buttons all colors are lost and i have the default color (white) on all controls.
i declare in the wminit of any dialog how the color style looks ,but as i say...20/30 times pressing a button and showing such a dialog will set all colors to white.
whats happend here ?
is there a buffer i dont see and who is maybe full ?
anyone had the same problem and know what to do ?
i use some dialogs in my app and when user press on one off the menu buttons ,the dialog will show.
mean ,all controls are hidden and if user press button 1 then controls for dialog 1 will become visible,press button 2 and dialog 2 will come......
all controls have new colors and looks fine.
now if i press 20/30 times on one of the menu buttons all colors are lost and i have the default color (white) on all controls.
i declare in the wminit of any dialog how the color style looks ,but as i say...20/30 times pressing a button and showing such a dialog will set all colors to white.
whats happend here ?
is there a buffer i dont see and who is maybe full ?
anyone had the same problem and know what to do ?
Afternoon, CodeMonkey.
It might help if you show your code for 'WM_INITDIALOG'.
Which function/s are you using to change the colour?:confused:
How are you processing the 'WM_PAINT' message?:confused:
Cheers,
Scronty
It might help if you show your code for 'WM_INITDIALOG'.
Which function/s are you using to change the colour?:confused:
How are you processing the 'WM_PAINT' message?:confused:
Cheers,
Scronty
seems to me, that you didnt DeleteObject all your GDI
objects, f.e. those from CreateBrush or CreatePen.
GDI immediatly runs out of handles after some user actions.
objects, f.e. those from CreateBrush or CreatePen.
GDI immediatly runs out of handles after some user actions.
Hello
first , Scronty thanks for helping me again :)
i have the src. on my other hd and check first if i dont delete all after closing a dialog ,if im unable to fix the bug i post the source here.
beaster,also thanks for the tip.
i take a look at this now :)
cu
first , Scronty thanks for helping me again :)
i have the src. on my other hd and check first if i dont delete all after closing a dialog ,if im unable to fix the bug i post the source here.
beaster,also thanks for the tip.
i take a look at this now :)
cu
Hello Scronty,
can you help me again ?
i post now the src. because im unable to find the error.
im not using wm_paint because i dont know what it does ,i think its for bitmaps.
but i will inform myself on this :)
i use for every new pop up dialog in my app the same way.
spending the whole weekend to make new colors and some bitmaps to my app and then
the problem with the buffer :(
possible you or another visitor has an idea what i can do :)
thank you
MainDialogProc Proc
ARG Hwnd:dword, Msg:dword, Wparam:dword, Lparam:dword
pushad
mov eax, Msg
cmp eax, WM_INITDIALOG
je wminitdlg
cmp eax, WM_CTLCOLORDLG
je BackColor
cmp eax, WM_CTLCOLORSTATIC
je StaticColor
cmp eax, WM_CTLCOLOREDIT
je EditColor
cmp eax, WM_CTLCOLORBTN
je ButtonColor
cmp eax, WM_CTLCOLORLISTBOX
je ListboxColor
jmp Msg_OK
BackColor: ;--dialog Background
call CreateBrushIndirect,offset LogBrush_lila_d
ret
ButtonColor: ;--groub box
call SetTextColor,Wparam,00000000h
call SetBkColor,Wparam,00e8dce0h
call CreateBrushIndirect,offset LogBrush_lila_d
ret
EditColor: ;--- edit fields
call SetTextColor,Wparam,00ffffffh
call SetBkColor,Wparam,00d09ca0h
call CreateBrushIndirect,offset LogBrush_lila_m
ret
ListboxColor: ;----drop down list
call SetTextColor,Wparam,00ffffffh
call SetBkColor,Wparam,00d09ca0h
call CreateBrushIndirect,offset LogBrush_lila_m
ret
StaticColor: ;---- static labels
call SetTextColor,Wparam,00000000h
call SetBkColor,Wparam,00e8dce0h
call CreateBrushIndirect,offset LogBrush_lila_d
ret
...............
wminitdlg:
call SetWindowTextA,Hwnd,offset WindowTitle
call LoadIcon, Handle,ICON_1
call SendMessage, Hwnd, 80h, 0, eax
call LoadCursorA,0h,32512
mov hcursor,eax
jmp Msg_OK
...............
Msg_OK:
popad
xor eax, eax
inc eax
ret
can you help me again ?
i post now the src. because im unable to find the error.
im not using wm_paint because i dont know what it does ,i think its for bitmaps.
but i will inform myself on this :)
i use for every new pop up dialog in my app the same way.
spending the whole weekend to make new colors and some bitmaps to my app and then
the problem with the buffer :(
possible you or another visitor has an idea what i can do :)
thank you
MainDialogProc Proc
ARG Hwnd:dword, Msg:dword, Wparam:dword, Lparam:dword
pushad
mov eax, Msg
cmp eax, WM_INITDIALOG
je wminitdlg
cmp eax, WM_CTLCOLORDLG
je BackColor
cmp eax, WM_CTLCOLORSTATIC
je StaticColor
cmp eax, WM_CTLCOLOREDIT
je EditColor
cmp eax, WM_CTLCOLORBTN
je ButtonColor
cmp eax, WM_CTLCOLORLISTBOX
je ListboxColor
jmp Msg_OK
BackColor: ;--dialog Background
call CreateBrushIndirect,offset LogBrush_lila_d
ret
ButtonColor: ;--groub box
call SetTextColor,Wparam,00000000h
call SetBkColor,Wparam,00e8dce0h
call CreateBrushIndirect,offset LogBrush_lila_d
ret
EditColor: ;--- edit fields
call SetTextColor,Wparam,00ffffffh
call SetBkColor,Wparam,00d09ca0h
call CreateBrushIndirect,offset LogBrush_lila_m
ret
ListboxColor: ;----drop down list
call SetTextColor,Wparam,00ffffffh
call SetBkColor,Wparam,00d09ca0h
call CreateBrushIndirect,offset LogBrush_lila_m
ret
StaticColor: ;---- static labels
call SetTextColor,Wparam,00000000h
call SetBkColor,Wparam,00e8dce0h
call CreateBrushIndirect,offset LogBrush_lila_d
ret
...............
wminitdlg:
call SetWindowTextA,Hwnd,offset WindowTitle
call LoadIcon, Handle,ICON_1
call SendMessage, Hwnd, 80h, 0, eax
call LoadCursorA,0h,32512
mov hcursor,eax
jmp Msg_OK
...............
Msg_OK:
popad
xor eax, eax
inc eax
ret
I have just tried it out (message WM_CTLCOLORDLG only) and it worked.
But:
1. you should not create the brush every time you receive WM_CTL... for windows does not delete the brush after usage
2. you may receive WM_CTL... before WM_INITDIALOG
3. what is with the missing popads after CreateBrushIndirect? Could that be a problem?
But:
1. you should not create the brush every time you receive WM_CTL... for windows does not delete the brush after usage
2. you may receive WM_CTL... before WM_INITDIALOG
3. what is with the missing popads after CreateBrushIndirect? Could that be a problem?
I don't really know if this will solve your problem, but (as japheth suggested) why not remove all pushad/popads and do a 'USES EDI ESI EBX' in your WndProc definition?
Ie:
MainDialogProc Proc USES EDI ESI EBX ARG Hwnd:dword, Msg:dword, Wparam:dword, Lparam:dword
Again it might not be the solution but surely your code will be tidier ;)
Bye
Latigo
Ie:
MainDialogProc Proc USES EDI ESI EBX ARG Hwnd:dword, Msg:dword, Wparam:dword, Lparam:dword
Again it might not be the solution but surely your code will be tidier ;)
Bye
Latigo
Hello,
thanks for the tips i got it :)
BackColorToBlack:
call DeleteObject,hBrush1 <------
call CreateBrushIndirect,offset LogBrush_lila_d
mov hBrush1,eax <------
ret
dont know that windows everytime create a new brush ,i think first the old will deleted.
thx
thanks for the tips i got it :)
BackColorToBlack:
call DeleteObject,hBrush1 <------
call CreateBrushIndirect,offset LogBrush_lila_d
mov hBrush1,eax <------
ret
dont know that windows everytime create a new brush ,i think first the old will deleted.
thx