By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

How to attach a tab control to a window (Visual C++)

P: 37
Hello,

I have a short Visual C++ program which creates a window. My program is
as follows :

#include "stdafx.h"
#include <afxwin>

class COurApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};

class COurWnd : public CFrameWnd
{
public:
COurWnd()
{
Create(0, TEXT("My App"));
}
};

class myTab : public CTabCtrl
{
public:
myTab()
{
Create (TCS_TABS | TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE,
CRect(20, 30, 180, 230), this, 0x1006);
}
};

BOOL COurApp::InitInstance(void)
{
m_pMainWnd = new COurWnd;

m_pMainWnd->ShowWindow(m_nCmdShow);

// At this point, I would like to create a tab and attach to the window.
// I tried :
//
// m_wndMyTabCtrl = new myTab;
//
// but got an "undeclared indentifier" compiler error message.

return TRUE;
}

COurApp AnApplication;
}

I wonder if someone could please show me how to create an object of type 'myTab' and attach it to the window? Your help is much appreciated!

Akino
Jul 8 '08 #1
Share this Question
Share on Google+
1 Reply


Banfa
Expert Mod 5K+
P: 8,916
YYou are going to need to put it inside a CView, if you are using MFC then I seriously suggest you use the APP Wizard to create you initial framework rather than write it yourself like this otherwise you are likely to run into lots of problems with bits that MFC will assume are there that you wont have implemented.
Jul 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.