CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    19

    titlebar and icon



    Hellow!

    I want make a window without titlebar. but I want insert

    icon and text into titlebar of taskbar.

    The other words, I want make window alike Winamp.

    If we run the winamp program, We see winamp icon and song name

    on winamp'titlebar of taskbar.

    Present, I can insert text into titlebar of taskbar to use

    "WindowText()" API function. But I can't insert icon into

    titlebar of taskbar.

    Please Help me!.

    I'm looking forward to you good answer.

    Thank you!.....^_^

  2. #2
    Join Date
    Jun 1999
    Location
    Illinois
    Posts
    13

    Re: titlebar and icon

    I am a VisualC guy who has done that, but I don't know if it is possible in VisualB. Add the style (vb equivalent of...) WM_SYSMENU to your window style and it should be fine, but as I said, i am a VC guy, don't know any VB really...

    ----------------------------------------
    Steve N
    Multimedia programmer, wanna-be dj/vj

    Please rate my posts so I know how much of an idiot I am...
    ----------------------------------------

  3. #3
    Join Date
    Jun 2001
    Posts
    1

    Re: titlebar and icon

    Hi,
    I had the same problem and I solved it in the following way:

    1. Set BorderStyle=1-Fixed Single, ShowInTaskar=true;
    Set the caption and the icon of the form;

    2. Use the following API declarations:
    public Declare Function GetSystemMetrics Lib "user32" (byval nIndex as Long) as Long
    public Declare Function SetWindowRgn Lib "user32" (byval hwnd as Long, byval hRgn as Long, byval bRedraw as Boolean) as Long
    public Declare Function CreateRectRgn Lib "gdi32" (byval X1 as Long, byval Y1 as Long, byval X2 as Long, byval Y2 as Long) as Long
    public Declare Function DeleteObject Lib "gdi32" (byval hObject as Long) as Long



    3. Use the following code into your form:
    private Sub Form_Load()
    'SystemMetrics(30) returns the size of TitleBar window
    m_shpTitlebarLess = CreateRectRgn(0, GetSystemMetrics(30) + 2, me.Width, me.Height)
    SetWindowRgn hwnd, m_shpTitlebarLess, true
    End Sub

    private Sub Form_Unload(Cancel as Integer)
    SetWindowRgn hwnd, 0, false
    DeleteObject m_shpTitlebarLess
    End Sub



    Thus, your titlebar is 'cutted', by creating a shape that doesn't include it.
    You will get a window without the standard titlebar, but with icon and caption in taskbar - as WinAmp.






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured