Hi,

I am working with Win32 programming in C language..

I am using Dev C++ compiler 5.0 ..

I had created the tab control in the form with the following coding.


g_hwndTabCntrl = CreateWindowEx(0, //more or 'extended' styles
WC_TABCONTROL, //the 'class' of window to create
NULL, //the window title
WS_CHILD|WS_VISIBLE| //window style: how it looks
TCS_FIXEDWIDTH,
0, //window position: left
0, //window position: top
800, //window width
487, //window height
Admin, //parent window handle
NULL, //handle to this windows's menu
g_hInst, //application instance
NULL);
ZeroMemory(&tabPage,sizeof(TCITEM));
tabPage.mask=TCIF_TEXT;
tabPage.pszText=TEXT("First Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
create(g_hwndTabCntrl,"EDIT","",120,30,130,30,345);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,0,(LPARAM)&tabPage);

tabPage.pszText=TEXT("Second Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
create(g_hwndTabCntrl,"EDIT","",120,250,130,30,346);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,1,(LPARAM)&tabPage);

tabPage.pszText=TEXT("Third Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,2,(LPARAM)&tabPage);

tabPage.pszText=TEXT("Fourth Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,3,(LPARAM)&tabPage);

tabPage.pszText=TEXT("Fifth Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,4,(LPARAM)&tabPage);
//set the font of the tabs to a more typical system GUI font
SendMessage(g_hwndTabCntrl,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);

But i dont know how to add BUTTONS, LABELS,COMBOBOX Controls to each tab.

I searched in lot of sites .But cant able to get exact way to do this.

Please help me to do this..

And i also want to add the Data Grid Control in the form and, i want to connect that with the database..

I have a database connecttivity coding and it works..

All i want to do is have a control over these Activex controls( Tab,Datagrid)..

Please help me to do this..


Thanks in Advance...
Shiva

Recommended Answers

All 4 Replies

please post code using code tags, not coloring. See my signature for link.

Hi,

I am working with Win32 programming in C language..

I am using Dev C++ compiler 5.0 ..

I had created the tab control in the form with the following coding.

g_hwndTabCntrl = CreateWindowEx(0, //more or 'extended' styles
WC_TABCONTROL, //the 'class' of window to create
NULL, //the window title
WS_CHILD|WS_VISIBLE| //window style: how it looks
TCS_FIXEDWIDTH, 
0, //window position: left
0, //window position: top
800, //window width
487, //window height
Admin, //parent window handle
NULL, //handle to this windows's menu
g_hInst, //application instance
NULL); 
ZeroMemory(&tabPage,sizeof(TCITEM));
tabPage.mask=TCIF_TEXT;
tabPage.pszText=TEXT("First Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
create(g_hwndTabCntrl,"EDIT","",120,30,130,30,345);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,0,(LPARAM)&tabPage);
 
tabPage.pszText=TEXT("Second Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
create(g_hwndTabCntrl,"EDIT","",120,250,130,30,346);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,1,(LPARAM)&tabPage); 
 
tabPage.pszText=TEXT("Third Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,2,(LPARAM)&tabPage); 
 
tabPage.pszText=TEXT("Fourth Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,3,(LPARAM)&tabPage); 
 
tabPage.pszText=TEXT("Fifth Page");
tabPage.cchTextMax=lstrlen(tabPage.pszText);
SendMessage(g_hwndTabCntrl,TCM_INSERTITEM,4,(LPARAM)&tabPage);
//set the font of the tabs to a more typical system GUI font
SendMessage(g_hwndTabCntrl,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);

But i dont know how to add BUTTONS, LABELS,COMBOBOX Controls to each tab.

I searched in lot of sites .But cant able to get exact way to do this.

Please help me to do this..

And i also want to add the Data Grid Control in the form and, i want to connect that with the database..

I have a database connecttivity coding and it works..

All i want to do is have a control over these Activex controls( Tab,Datagrid)..

Please help me to do this..


Thanks in Advance...
Shiva

That is good example.. but it creates lots of problem while running a source code..

can u please give me some small example to create tab and addition of command buttons to that tab..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.