do you all READ my question before you post such a not-to-my-thread-matching-thing?! don't you see the image i've posted in the thread's beginning?! the best of you all was Roy Cline - i would change the whole system's colors! did i want that? - NO! i said it in my question at the beginning!
how has the programmer of this program done this black window - WITHOUT changing the whole system's colors?! how does ownerdrawing work? these and some other question seem to be impossible to be answered! but i still would be glad about reading some answers!

greets, hartyl
Posted on 2002-08-11 06:42:27 by hartyl
Oh, it ain't even your program, damn, now I know where I've seen this before. :grin:

Why don't you take a look at my program and use a solid black brush instead of a
pattern brush. People told you what to do all through the thread - looks like you can't
read.
Why don't you look up WM_CTLCOLOR* messages. If you don't know what window
messages are
go to Izcelion's page: http://win32asm.cjb.net/

like chorus told you before.
If you don't know where to search, search this board or msdn library for
WM_CTLCOLOR* and CreateSolidBrush.
Posted on 2002-08-11 06:56:39 by goofee
i CAN read - seem you can't:
i've said in the forelast post, that with the WM_CTLCOLORxxx-Messages i can only change the BACKGROUND- and the TEXTCOLOR - NOT the border, NOT the frame, NOT the caption! so how can i make a completely black window (with some different colors, so you can see the control items... - BUT NOT GRAY) ?!

:confused: :confused: :confused:
Posted on 2002-08-11 07:06:12 by hartyl
NOT the border, NOT the frame, NOT the caption


read what chorus said about 15 posts before



with some different colors, so you can see the control items... - BUT NOT GRAY


why don't you look at my program or go to iczellions site for sub-/super-classing or
search the board WM_CTLCOLOR* messages, will you do that please ?

Regards,
goofee
Posted on 2002-08-11 07:15:52 by goofee
For the window i think you should use WM_NCPAINT

from Platform SDK:

The DefWindowProc function paints the window frame.

An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

The wParam value can be passed to GetDCEx as in the following example.
Posted on 2002-08-11 07:17:45 by ante
@ante: THIS could work, greets to you

@goofee: am i wrong or not?! with you WM_CTLCOLORxxx-Message you GIVE windows a BRUSH which it uses to draw the BACKGROUND and the TEXT, but NOT the border, NOT the frame, NOT the caption - it is so, isn't it? in you program you use also this function to draw the BACKGROUND of you control items and you change the color of the TEXT but NOT the border, NOT the frame, NOT the caption - it is so, isn't it? how often do you want to tell me to use the WM_CTLCOLORxxx-message if it doesn't work for my purporse? tell me if i was wrong...

now i'm gonna try the WM_NCPAINT-message and see...
Posted on 2002-08-11 07:26:04 by hartyl
I thought you need the borders,frame and caption for your
window not your controls.

MSDN library says:

WM_DRAWITEM
The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.


You will need to draw all controls yourself.
Posted on 2002-08-11 07:32:25 by goofee
hartyl,
From my original post two days ago:


For the Non-Client Area (caption bar, frame) you'll probably wanna intercept WM_NCPAINT and call DrawCaption and/or DrawFrameControl or some custom procedure


Please read the responses people give you! We *are* trying to help you but you just plain aren't listening. Have fun with WM_NCPAINT. If you have trouble with that message, post the code you are working on and someone will give you what assistance they can.

By the way, I don't think you've even given someone so much as a thanks for their efforts. Even Roy Cline, though his post wasn't quite on topic, was trying to help. Like the rest of us, he bothered to take the time to write something. Next time you have a post, don't count on these people even bothering to read your post if you won't even show some gratitude.

--Chorus
Posted on 2002-08-11 07:53:00 by chorus
Goofee,
I believe the problem with the smearing *is* the null brush. What happens when the window scrolls is that Windows first erases the background then paints the text. If there's a null brush for the background then no erasing gets done and the WM_PAINT simply draws on top of what's there before. Hence the smearing.

Maybe there's another cause for it, but that'd be my best guess.

You probably don't see the smearing in the other controls because they are single line and hence, no scrolling. Have you tried typing in anything that will cause the box to scroll horizontally? you might see it then. I gave it a try, but the edit boxes didn't seem to be accepting any input, and I can read the other buttons to know which one to press to enter data :) So I tried pressing them all... didn't seem to help... managed to open up notepad though ;)

Oh, this my contribute to your problem too, because the text is not drawn with a background color:


invoke SetBkMode,wParam,TRANSPARENT


although I'm sure it's pretty vital to your code so you can see the background brush through the text... shrugs.

--Chorus
Posted on 2002-08-11 08:04:55 by chorus
Thanks, chorus.

The problem really seems to be the transparent background.
But then, I might not texture it at all :grin:

You will need to open a file before the edit control becomes active.
Try opening this file via Datei->Datei ?ffnen:
Posted on 2002-08-11 09:01:45 by goofee
i think i... erm... apologize for my last (mean?) posts... and thanks for ya answers
i've decided to make everything ownerdrawn - it isnt that difficult so take a look at my results (attached image). the button is really owner-drawn, but the edit-controls are just without a border and the background and the textcolor is set with the WM_CTLCOLOREDIT. but the window's the problem. the background is a bitmap, set with hbrBackground in the windowclass. so i have to CreateWindowEx the window and use WS_POPUP. but the i have also to create the control-items with this function too - thats not good!
question: is there any possibility to load the dialog-info from the RC AND using the bitmap as a background WITHOUT a caption bar? i've tried a little bit, but it always shows the cation too despite using ONLY WS_POPUP
Posted on 2002-08-11 12:08:17 by hartyl
Can I have a look at your your code on how to owner draw the buttons ?
I'm having problems with that,too.

You can use CreateDialogParam for your dialog and pass it your own window
class you will need to set the BS_OWNERDRAW style using with SetWindowLong
for it won't work if you specify it in the resource.
Posted on 2002-08-11 12:24:44 by goofee

You can use CreateDialogParam for your dialog and pass it your own window
class you will need to set the BS_OWNERDRAW style using with SetWindowLong
for it won't work if you specify it in the resource.


i don't know how you mean that, goofee. do i have to do that, if i want to use the background-image and if i dont want to have a window-caption?

and here some owner-draw-code:

you need to respond on the WM_DRAWITEM-message. i've declared a universal DrawItem-function. you hand the pointer to the DRAWITEMSTRUCT of the item over to this funciton:


...
.elseif eax==WM_DRAWITEM
invoke DrawItem,lParam
...

here the prototype you put into the *.inc-file (or where you usually have them...):


DrawItem proto :DWORD

and now the function itsselfs (with comments)


DrawItem proc item:DWORD
.data?
dc HANDLE ?
brush HANDLE ?
font HANDLE ?
pen HANDLE ?
buf db 256 dup(?)
.code
mov esi,item ;move the pointer into esi
assume esi:ptr DRAWITEMSTRUCT ;assume this pointer as a DRAWITEMSTRUCT-pointer (to use the "sub-items")
mov eax,[esi].CtlType ;move the type into eax
m2m dc,[esi].hdc ;and copy the dc
.if eax==ODT_BUTTON ;item is a button (look up the other types you can draw - you CAN'T draw EDITboxes! (has no owner-draw-style
.if ([esi].itemState&ODS_DISABLED) ;if the state is 'DISABLED' (i was too lazy to code that...)
.else
iif [esi].itemState&ODS_FOCUS,0804c00h,0603900h ;this is a macro: if the first arg is TRUE the 2nd is returned, else the 3rd
invoke CreateSolidBrush,eax ;finally draw everything
mov brush,eax
invoke SelectObject,dc,brush
invoke FillRect,dc,addr [esi].rcItem,brush
invoke CreateSolidBrush,0ff9900h
mov brush,eax
invoke SelectObject,dc,brush
invoke DeleteObject,eax
invoke FrameRect,dc,addr [esi].rcItem,brush
invoke SetTextAlign,dc,TA_BASELINE or TA_CENTER
invoke SetBkMode,dc,TRANSPARENT
invoke SetTextColor,dc,0ff9900h
invoke GetWindowText,[esi].hwndItem,addr buf,256
mov ebx,[esi].rcItem.right
shr ebx,1
mov ecx,[esi].rcItem.bottom
shr ecx,1
add ecx,4
invoke lstrlen,addr buf
invoke TextOut,dc,ebx,ecx,addr buf,eax
.endif
.endif
ret
DrawItem endp


i hope this helps
Posted on 2002-08-11 12:54:36 by hartyl
No, actually it doesn't.

I'm using LineTo to draw standard borders instead of FrameRect:


DrawControl PROC hWnd :DWORD,
wParam :DWORD,
lParam :DWORD

LOCAL hOldPen :DWORD
LOCAL hOffScreenDC :DWORD

push edi
mov edi,lParam
assume edi:PTR DRAWITEMSTRUCT
invoke FillRect,[edi].hdc,addr [edi].rcItem,hBackBrush
mov eax,[edi].itemState
and eax,ODS_SELECTED
jz Not_Selected
invoke SelectObject,[edi].hdc,hShadowPen
mov hOldPen,eax
invoke MoveToEx,[edi].hdc,0,[edi].rcItem.bottom-1,NULL
invoke LineTo,[edi].hdc,0,0
invoke LineTo,[edi].hdc,[edi].rcItem.right-1,0
invoke SelectObject,[edi].hdc,hHighlightPen
invoke LineTo,[edi].hdc,[edi].rcItem.right-1,[edi].rcItem.bottom
invoke LineTo,[edi].hdc,0,[edi].rcItem.bottom-1
invoke OffsetRect,addr [edi].rcItem,1,1
jmp Done
Not_Selected:
invoke SelectObject,[edi].hdc,hShadowPen
mov hOldPen,eax
PrintDec eax
invoke MoveToEx,[edi].hdc,0,[edi].rcItem.bottom-1,NULL
invoke LineTo,[edi].hdc,0,0
invoke LineTo,[edi].hdc,[edi].rcItem.right-1,0
invoke SelectObject,[edi].hdc,hHighlightPen
invoke LineTo,[edi].hdc,[edi].rcItem.right-1,[edi].rcItem.bottom
invoke LineTo,[edi].hdc,0,[edi].rcItem.bottom-1
Done:
invoke SelectObject,[edi].hdc,hOldPen
invoke SetBkMode,[edi].hdc,TRANSPARENT
invoke DrawText,[edi].hdc,CTEXT("Start"),-1,addr [edi].rcItem,DT_SINGLELINE or DT_CENTER or DT_VCENTER
assume edi:nothing
pop edi
ret
DrawControl endp


do i have to do that, if i want to use the background-image

Yes, exactly.
It works just like CreateWindow using a window class structure.
About the caption I'm not quite sure myself how to remove it.
Posted on 2002-08-11 13:20:16 by goofee
Btw, are you using SetCaption in your code or creating the window with
CreateWindowEx passing it an app name ?
Posted on 2002-08-11 13:26:08 by goofee
About the caption I'm not quite sure myself how to remove it.

so it still HAS the caption?

i'm too lazy to test you code - so whats the problem with it you said some posts ago? i think your version is a little bit pedantically. i think you only need to give the DRAWITEMSTRUCT to the proc. does it make problems with the pen so you backup it and restore it? you could make a screenie of you button, i'd like to see it.
Posted on 2002-08-11 13:29:53 by hartyl

Btw, are you using SetCaption in your code or creating the window with
CreateWindowEx passing it an app name ?

i create my window (only for colored windows) with CreateWIndowEx. else i use DialogBoxParam
Posted on 2002-08-11 13:32:10 by hartyl
Are you
passing it an app name ?


=window name



invoke CreateWindowEx,NULL,ADDR ClassNameHere,WINDOWNAMEHERE,WS_POPUP,20,\
213,180,10,NULL,NULL,hInstance,NULL
Posted on 2002-08-11 13:43:26 by goofee
i'm at work and just taking a brief look at the posts:

1) From what I can tell you want to create a main window with no caption bar (is this right?). For the main window, it isn't enough to create the window withough the WS_CAPTION style. You have to define

WS_NOCAPTION EQU 80000000h

and create your window with this style (leave out WS_CAPTION). Note: this has worked on all systems I've tested but I have never seen official documentation on this. Maybe someone knows differently.

2) Perhaps instead of using the bitmap as a background brush, you can BitBlt the bitmap in WM_PAINT and leave the background brush as NULL. You may get better performance this way. On the other hand, if you never resize the window (are you using WS_THICKFRAME?) than you may not notice the difference


I'll take a closer look later

--Chorus
Posted on 2002-08-11 14:01:03 by chorus
Hi, in the FAQ area thare are some usefull info about all these subjects:

Getting rid of the title bar:
http://www.asmcommunity.net/board/index.php?topic=697

how to set a bitmap as background of a dialog box?
http://www.asmcommunity.net/board/index.php?topic=1012

Owner Draw buttons..
http://www.asmcommunity.net/board/index.php?topic=6920
Posted on 2002-08-11 15:31:25 by LuHa