Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Original window shape Posted by dev48 on 25 Apr 2003 at 6:22 AM
Hello!

Does anyone Know how to make a window which doesn't look like a rectangle?
Indeed I want to make a window which has an original shape such as window media player 9 has.

Thanks
Report
Re: Original window shape Posted by AsmGuru62 on 25 Apr 2003 at 6:47 AM
: Hello!
:
: Does anyone Know how to make a window which doesn't look like a rectangle?
: Indeed I want to make a window which has an original shape such as window media player 9 has.
:
: Thanks
:
Try that:
1. When registering a window class, specify NULL for background brush inside WNDCLASS structure.

2. Respond to WM_ERASEBKGND message and return 1.

3. When creating a window by CreateWindow() - specify only styles: WS_POPUP | WS_VISIBLE. No borders, titles or min/max buttons. Try these two first.

4. In WM_PAINT handler draw all your custom window stuff, including for example ellipsoid borders or whatever you need.

One thing: since the window will not have a caption - how to move it? You should implement mouse clicks and moves yourself to provide that functionality.

Report
and with QT Posted by dev48 on 25 Apr 2003 at 7:33 AM
Thanks a lot.

Another thing.

Do you thing it works with qt???
Report
Re: Original window shape Posted by pingpong on 25 Apr 2003 at 10:37 AM
: Try that:
: One thing: since the window will not have a caption - how to move it? You should implement mouse clicks and moves yourself to provide that functionality.

:

You can always trick Windows to move it like this:
// in your window proc
switch(message)
   case WM_NCHITTEST:
      // get Windows to do its hittest first
      longVal = DefWindowProc(hWnd, message, wParam, lParam);
      // if the mouse is on client area, trick Windows to think its on the caption
      if(longVal == HTCLIENT)
         longVal = HTCAPTION;
      return longVal;

If you put the code above in any window, clicking on the client area and dragging will move the while window around (like Winamp and WMP).
In real world app, you probably need to check if the cursor location is not on any of your buttons and other controls first otherwise nothing will work.
Report
Re: Original window shape Posted by biki on 25 Apr 2003 at 10:57 AM

Try using CreateEllipticRgn() and its cousins


~Bikram




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.