Solved

URGENT !!! CTabCtrl creation without border

Posted on 1998-07-16
6
590 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Expert Comment

by:duneram
Comment Utility
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
Comment Utility
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
Comment Utility
same algorithm...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 52
fizzArray2 challenge 1 55
pre4 challenge 19 87
Annoying "thing" blocks my view 4 48
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now