Solved

URGENT !!! CTabCtrl creation without border

Posted on 1998-07-16
6
607 Views
Last Modified: 2013-11-20
How can i create a ctabctrl without a bourder.
I have painted the CtabCtrl with black and i want the tab
items bourder or to be black too , or not to be created
as a border tabcontrol . How Can it be done or the border
to be black ???
0
Comment
Question by:moshei
  • 4
6 Comments
 
LVL 2

Expert Comment

by:duneram
ID: 1319302
Hi,

In windows, every control in itself is a window.  Keep that in mind and you will always be able to find solutions.  Every window has the ability to have Window Styles.  You can find these styles in the include file:   winuser.h    In that file you will find a style named
WS_BORDER.

All of the window styles pretty much start with WS_   There are some extended styles you can use too like  WS_EX_TRANSPARENT   stuff like that.

With experimentation at run time you can modify the appearance of a given 'window' / 'control' by doing a (16 bits) GetWindowWord  and SetWindowWord to whatever window style you are setting.  If using 32 bits use GetWindowLong and SetWindowLong.

An example:
HWND hWnd = FindWindow("WordPadClass",NULL); // the WordPad app main window
long x = GetWindowLong(hWnd, GWL_STYLE);

Now if it contains the WS_BORDER, remove it then
x ~= WS_BORDER;
//call SetWindowLong and give it the new value of x (minus the WS_BORDER)
SetWindowLong(hWnd, GWL_STYLE,  x);

and the WS_BORDER style will be gone.


Hope this helps.   yOU Can use this methodology to change the 'style' of any window at runtime.



0
 

Author Comment

by:moshei
ID: 1319303
When Using the GetWindowLong i recieve a long number .
How Can i Know from this number whether the WS_BORDER is set
why is x~=WS_BORDER not working ( from your answer )
0
 
LVL 2

Expert Comment

by:duneram
ID: 1319304
Using  GetWindowLong(hWnd, GWL_STYLE)...

That number you receive from GetWindowLong is explained in Microsoft's knowledgebase in article #Q83366.

Essentially that number contains the full attributes for the style of a window.  You can check if  a given attribute is part of that number by masking & testing like this (in C)

Here is a function that will remove a given style for a window.

void CNoborderDlg::RemoveStyle(HWND hWnd, long Style)
{
    long x;
      x = GetWindowLong(hWnd, GWL_STYLE);
      if (x & Style)
      {
            x &= ~(Style) ; /* REMOVING IT FROM X */
            SetWindowLong(hWnd, GWL_STYLE, x);
      }

}
I typed it wrong in the first example so thats why it didn't work.  you can repeat that style of checking and setting for any of the attributes you are interested in.  I will take a look and see why it didn't work.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 2

Expert Comment

by:duneram
ID: 1319305
It looks like I was mistaken.  You are probably going to have to deal with the WM_PAINT command...


0
 
LVL 9

Accepted Solution

by:
Priyesh earned 70 total points
ID: 1319306
Hi moshie..
      Let oTabCtrl be u'r tabctrl object.. then.. the following code can help to remove border.
      HWnd hWnd =  oTabCtrl.m_hWnd ;
      long lCurStyle  = GetWindowLong(hWnd, GWL_STYLE);
      lCurStyle &= ~WS_BORDER ;
      SetWindowLong(hWnd, GWL_STYLE, lCurStyle);
Try it.

0
 
LVL 2

Expert Comment

by:duneram
ID: 1319307
same algorithm...
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand to include initial dialog with two choices. 9 80
sameEnds challenge 3 180
abstract class with all non abstract mentods 6 80
Message not shown 5 67
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question