July 13, 2024, 07:34:17 PM


IWBasic runs in Windows 11!

CAPTION manipulation - What is possible?

Started by Junner2003, January 26, 2007, 05:15:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I just wonder what kind of manipulation other than changing the title of a window would be possible in the CAPTION BAR ???
There are more and more programs out there as example having different color (background image?) in the caption than the default Windows XP Theme.

Is there a way to get a MINIMIZE TO TRAY button in the CAPTION like on the pic attached?

What other manipulations would be possible in EBASIC? Anybody some ideas?

Ionic Wind Support Team

Not much you can do with XP themes.   Probably the easiest way to mak a custom caption is not to have one at all and draw it yourself in the client area.  There was an example of that floating around on the old ibasic forums.

Ionic Wind Support Team


Is it at least possible to remove the CLOSE "X" in the CAPTION? I studdied the user guide but could not find anything ...


when creating the window use the "@NOCAPTION" flag (from the user's guide)
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library


Yep, so far I knew it but the CAPTION is wanted :( ... just not the "X" I guess there is no other way in EBASIC of doing it? :(



This thread came from the old IBasic forum - maybe there are some ideas in it for you.

I'm trying to change the style of a childwindow, but I don't know how to do it. I think I have to use SENDMESSAGE and SetWindowPos() and that kind of functions, but I don't know how. :cry:

The desired style for the childwindow I need is:
- has a close button
- has a captionbar
- is not moveable in the parentwindow
- has no borders
- captionbar must look "active": Color of captionbar is blue, not gray

Does somebody know how to get this done?


A child window is treated differently by Windows. It can't have a blue caption and not all styles are valid. It will always "belong" to its parent unless your using a tool window. A tool window can have a blue caption and can be separate from it's parent.

The exception to the above is MDI child windows. MDI child windows are drawn by the OS differently than normal child windows. The active MDI child will have a blue caption.

Dialogs are also treated and drawn differently than a normal child window. Try a dialog shown with SHOWDIALOG to see what I mean.

In any event there is no easy way to override the default drawing behaviour enforced by the OS. You can make the window captionless, and then draw one yourself in the client area. Override the WM_NCPAINT message through subclassing and draw a custom caption in any color you want, etc.

MSDN is your friend.


I will make a captionbar and closebutton myself. :)
The captionbar is no problem: paint a filled rectangle and print the caption in it. I can make a closebutton by creating a button with a picture "X". But then the button is always a (simulated) win95/98 style, not automaticly the style of for example winXP :cry: .


Here is my solution. I have added the image needed for the closebutton to this poste.

If someone has an idea how to make a real closebutton (such that it can have the winXP style) I would be glad to know how!


'For IBasic Pro
'This program creates a not-movable, borderless childwindow in the parentwindow
'Jos de Jong
DECLARE "user32.dll",GetSysColor(what:INT),INT
'Create the parentwindow
Def main:window
OPENWINDOW main,100,100,380,340,@size|@MINBOX|@maxbox,0,"Test Child captionbar", &MainRoutine
SETWINDOWCOLOR main, GetSysColor(15)
Control main,@edit,"",160,5, 200,300, 0 , 1
'Create the childwindow
Def child:window
OPENWINDOW child,5,5,150,300,@nocaption,main,"Child", &ChildRoutine
SETWINDOWCOLOR child, GetSysColor(15)
Control child,@listbox,"",0,18, 150,300-18, 0 , 3
Addstring child, 3, "item1"
Addstring child, 3, "item2"
Addstring child, 3, "item3"
'create a captionbar and closebutton for the childwindow
getclientsize child, L,T,W,H
rect child, 0,0,W,18, GetSysColor(2), GetSysColor(2)
frontpen child, GetSysColor(9)
drawmode child, @TRANSPARENT
setfont child, "ms sans serif", 8, 700, 0
move child, 2,2: PRINT child, "Child"
control child,@button,"X",W-18,2, 16,14, @CTLBTNBITMAP, 2
setcontroltext child, 2, getstartpath+"close.bmp"
SUB MainRoutine
   select @MESSAGE
         run=0   :'closes the window
SUB ChildRoutine
   select @MESSAGE
      case @IDCONTROL
         IF @CONTROLID = 2
              'closebutton in childwindow clicked -> close childwindow
            closewindow child
            setsize main, 5,5, 200+155,300, 1

See the API function DrawFrameControl with the DFCS_CAPTIONCLOSE property. Use google or MSDN for examples.

Software For Metalworking