Solved

URGENT !!! CTabCtrl creation without border

Posted on 1998-07-16
6
603 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Use VBA to get user's Mac Address for their computer 5 162
countEvens challenge 2 100
withoutTen challenge 14 121
Path of Workbook 3 77
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 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