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

    Removing Non-Client area of a window

    How can I remove non-client area of a window (border, title), which belongs to another process (separate application)? I have only HWND of that window, and cutting its DC using SetLayeredWindowAttributes() with LWA_COLORKEY, to get some specific shape, but all non-client area remains as an ugly frame. So I need to remove it somehow.
    Note: the window is created by existing application, and I can’t change its code

  2. #2
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457
    Try using SetWindowLong to set the window class attributes. For example, to remove the caption (title bar):
    Code:
    DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE);
    dwStyle &= ~WS_CAPTION;
    SetWindowLong(hwnd, GWL_STYLE, dwStyle);
    SetWindowPos(hwnd, NULL, NULL, NULL, NULL, NULL,
                       SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  3. #3
    Join Date
    Apr 2004
    Posts
    7
    Thanks a lot! Working perfect with:
    Code:
    dwStyle &= ~WS_OVERLAPPEDWINDOW;

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