I have a window with the WS_EX_TOOLWINDOW style. I like the small titlebar. It has a close button but I'd like it to have a minimize button so that I can also add the feature so it goes into the system tray. Is there anyway to make the small titlebar have a minimize button?
Posted on 2001-01-02 03:47:00 by Frank Hale
I'm afraid you can't: ToolWindows can't do the WS_MINIMIZED/MAXIMIZEDBOX styles. betov.
Posted on 2001-01-02 14:17:00 by Betov
someone was talking about this months ago, and the person said you have to intercept some message related to painting the titlebar or the nonclient area, I guess, and paint your own titlebar, etc.
Posted on 2001-01-02 20:58:00 by Hel
But ICQ 2000 does it. It appears that they use the WS_EX_TOOLWINDOW style but with a minimize button. Is there any way to sniff the window to see what styles it has set? Or am I over simplifying this? Maybe they do some custom stuff???
Posted on 2001-01-02 21:23:00 by Frank Hale
In order to have a window with the WS_EX_TOOLWINDOW style and have a minimize button at the top, you have to use WM_NCxxx. For instance, WM_NCACTIVATE is called when Windows has identified which areas of the window are considered 'non client areas'. NC (non client) areas include the border, menu, caption bar, and anything else Windows (or even the users) decides shouldn't be in the client area. Then, WM_NCPAINT is called, telling the window to draw the non client areas. Then, WM_NCHITTEST is called, which tells the window to seperate mouse button events into multiple categories, and so on. On top of all that, you have to draw the button yourself... It's a fairly complex process, which I tried doing a long time back, with less than satisfactory results. There are a lot of web pages out there on the subject. Most of them are geared toward Delphi programmers, or MFC (Visual C++) programmers, but the programs are generally pretty straight forward. Good luck to you!
Posted on 2001-01-03 02:46:00 by Racso
You can create your own titlebar with anybuttons,any caption size. Create window without caption(nobuttons,no caption) then create your button(Using createWindowEx,...)or in resources. .elseif uMsg==WM_NCHITTEST invoke GetCursorPos,addr point invoke ScreenToClient,hwnd,addr point mov bcoorl,3 mov ebx,winw1 add ebx,2 mov bcoorr,ebx mov bcoort,3 mov bcoorb,21 mov ebx,point.x mov ecx,point.y .if ebx >= bcoorl && ebx <= bcoorr && ecx >= bcoort && ecx <= bcoorb mov eax,HTCAPTION ret .else mov eax,HTCLIENT ret .endif bcoorl -left corner position bcoorr-right corner position bcoort-top corner position bcoorb-bottom corner position this snipset allow you: when u pressing left button over caption and moves mouse, window also moves. Wanna see source how does it works.? If u just insert this in your prog,the all client area will be like caption(anywhere pressing and moving cursor and window also moves) .elseif uMsg==WM_NCHITTEST mov eax,HTCAPTION ret .endif
Posted on 2001-01-04 18:40:00 by SEL
I am not advanced enough to do this yet. Can you show me how to add a button to the titlebar?
Posted on 2001-01-04 19:46:00 by Frank Hale
check out the DrawFrameControl function in the msdn. i think that's what you're looking for.
Posted on 2001-01-04 21:01:00 by Sloat
Ok I read the description and it seems like the right function to do what I want. The next question I have is how to tell it I want to draw the button on the titlebar. What methods do I need to implement to get a handle to the titlebar? Keep in mind I am very new to Win32 programming.
Posted on 2001-01-04 22:13:00 by Frank Hale
Okay I made a feeble attempt at using the DrawFrameControl function. Here is the code. Could somebody look at it. When I go into my custom Paint_Proc nothing happens and the window is not updated. Does anyone know how to properly use the DrawFrameControl API? Here is the code: ;--------------------------------------------------------------------------- ; ; Description: ; ; A popup window with a listbox with URL shortcuts. This code was ; based off the popup toot that came with Masm32. I modified it to ; have two lists of data one for a name and another for a URL. When ; double clicked it brings up the URL with the default browser. ; ; By: Frank Hale ; Date: 2 Jan 2001 ; ;--------------------------------------------------------------------------- .386 .model flat, stdcall option casemap :none ; case sensitive ; ######################################################################### include c:\masm32\include\windows.inc include c:\masm32\include\gdi32.inc include c:\masm32\include\user32.inc include c:\masm32\include\kernel32.inc include c:\masm32\include\shell32.inc includelib c:\masm32\lib\shell32.lib includelib c:\masm32\lib\gdi32.lib includelib c:\masm32\lib\user32.lib includelib c:\masm32\lib\kernel32.lib ; ######################################################################### ;============= ; Local macros ;============= szText MACRO Name, Text:VARARG LOCAL lbl jmp lbl Name db Text,0 lbl: ENDM m2m MACRO M1, M2 push M2 pop M1 ENDM return MACRO arg mov eax, arg ret ENDM ; This is probably total crap. I put the list code in a Macro. ; I am a total newbie to Win32 and ASM so I don't know what is good or bad. ; createItemList MACRO hWnd, list local SubLp .data buffer db 128 dup (?) .code ; --------------------------------------------------- ; This block of code reads a string that is a list of ; seperate items delimited by a single zero byte. The ; list is terminated by a double zero byte pair. ; --------------------------------------------------- mov esi, offset list mov edi, offset buffer @@: lodsb cmp al, 0 ; get zero je SubLp ; write to list stosb jmp @B SubLp: stosb ; write terminator invoke SendMessage, hWnd, LB_ADDSTRING, 0, ADDR buffer lodsb cmp al, 0 ; check for second zero je @F ; exit if found mov edi, offset buffer ; reset to start of buffer stosb ; write test byte to it jmp @B @@: ENDM ; Probably another crap Macro. ; getURL MACRO hWin, list, item, _buffer local SubLp ; --------------------------------------------------- ; This block of code reads a string that is a list of ; seperate items delimited by a single zero byte. The ; list is terminated by a double zero byte pair. ; --------------------------------------------------- mov esi, offset list mov edi, offset _buffer xor ecx, ecx ; Clear ECX because we wanna use it to count @@: lodsb cmp al, 0 ; get zero je SubLp ; write to list stosb jmp @B SubLp: stosb ; write terminator .IF ecx == item ; We have the item we want xor ecx, ecx ; Clear ECX out, we are finished with it. jmp EXIT ; Exit the URL is in _buffer .ENDIF inc ecx ; increment ecx lodsb cmp al, 0 ; check for second zero je @F ; exit if found mov edi, offset _buffer ; reset to start
Posted on 2001-01-04 23:16:00 by Frank Hale
Did you REALLY read thru that last post, or did you fall asleep too? ;-) OK, once I wanted to customize the caption area of a quite simple program... those friggin buttons drove me nuts... but I ultimately found a solution that made me quite happy. IE, it worked "enough" Lots of enough, in fact. Check my page (http://here.is/COMinASM) and look for the custom captions and shapes tut. It defines the way to do it, basically you cut away the NC areas leaving just the client area on screen. Client areas are simple to work with, it's what we do all the time. It's your choice how you make the buttons. When I did (see the Timer app on the page) I used simple hit testing to detect mouse clicks, and blitted bitmaps to show buttons moving. Only 1 window in total was used for the entire main window. The sole drawback as I can see is windows thinks the invisible top edge of your window is still the edge. Not an issue unless you have a program such as ShoveIt running.
Posted on 2001-01-05 00:45:00 by Ernie
Totally agree with you Ernie.... I had a quick look at custom title bars too but decided just to cut the title bar out and to design my own... Reason I'm giving my 2 cents is: What's ShoveIt? Have a good weekend everyone, JimmyClif
Posted on 2001-01-05 04:17:00 by JimmyClif
>Did you REALLY read thru that last post, or did you fall asleep too? Well like I've said before I am a total beginner with Win32 programming. I am sure it looks quite clear to people who have been programming Win32 for a while. I do appreciate all the help but keep in mind that I may not see simple solutions like you do. I have about 5 days max experience with Win32 and Assembler programming, plus I have the added enjoyment of actually learning how the Pentium processor works. What I am attempting to learn is mind boggling. Win32 by itself takes months to get proficient at let alone learning Pentium architecture and Assembler language on top of that. I am not new to programming in general but the languages I like to use are high level and generally if you don't want to know how the processor works then its okay because there are heaps of libraries out there to do all the low level stuff for you. I've been using Pentiums for years but never knew how many registers it had or any other internal operations. Please give me the benefit of the doubt here. Again I thank you guys generously for all your help!!! I'd buy you all a virtual beer!!!
Posted on 2001-01-05 12:05:00 by Frank Hale
Well Frank, It seems to me you have finnally run into that one UGLY BEAST out here on the NET and that being TOTAL arroganceand a total disreguard for the reason a web forum exists! IT's here to help people learn new things that don't know . But some of them will not understand that concept that is why you get responces like this! Hopes for you and yours! Richard Ferguson!
Posted on 2001-01-11 20:02:00 by Richard Ferguson
JimmyClif: "ShoveIt" is a nice freebie utility I got years ago to solve a particuarly bad, annoyong, and never resolved BUG in windows. The bug exists for those of us who move the START button and task bar to the TOP of the screen (where of course it 'naturally' belongs). Most apps when started will quite happily slide right under the task bar, obscuring their caption bars. OBSURDE !!! ShoveIt checks all top level windows every few secs, and shoves em down to just under the task bar like they should be. PS, why the top? Well, if you want to control a running app, you look UP to the caption bar. So why look DOWN to control the app of apps, the OS? Why not look up higher to that which is controlling everything. Next point: You mouse to START, whats your FIRST Choice? SHUT DOWN Hey buddy, that's (literally!) the LAST thing I wanna do. I wanna run a program when I go in there. With the task bar up top, the FIRST choice is PROGRAMS (or maybe a prog icon before it). The START menu is designed to be drop down, not push up. It only drops down from the top. Of course, this is pure personal preference. But if I ever borrow your computer and the task bar is in the WRONG spot, at least you know why. And... so far, everyone I've shown the task bar on top trick to loves it and moves theirs there too.
Posted on 2001-01-11 23:41:00 by Ernie