I know I must be getting really annoying by now ... so I'm sorry but here's yet another problem, well actually a few.
Firstly this is my struct which is refered to as ts (TABSTRUCT*) in most of the code below, it's loaded before going into the switch msg thingy.
Code:
typedef struct {
LPSTR *titles;
int *ids;
HWND *pages;
bool set;
int nTabs;
int active;
int rfocus;
}TABSTRUCT, *lpTABSTRUCT;
Everything is initialised like this --
Code:
case WM_NCCREATE: {
ts = (TABSTRUCT*)malloc( sizeof( TABSTRUCT ) );
if ( ts == NULL ) {
MessageBox ( NULL, "wm_nc.tabproc Failed!", "Error", MB_ICONERROR );
return FALSE;
}
SetTabs( hwnd, ts );
static int *ids;
static LPSTR *titles;
static HWND *pages;
ts->ids = ids;
ts->titles = titles;
ts->pages = pages;
ts->nTabs = ts->rfocus = 0;
ts->active = -1;
return TRUE;
}
1. After a while the program crashes when making new tabs.
CODE --
Code:
case MCC_ADDTAB: {
if( ts->active >= 0 ) {
ShowWindow( ts->pages[ts->active], SW_HIDE );
}
ts->active++;
ts->nTabs++;
ts->ids = (int*)realloc( ts->ids, ts->nTabs*sizeof(int) );
ts->titles = (LPSTR*)realloc( ts->titles, ts->nTabs*sizeof(LPSTR) );
ts->pages = (HWND*)realloc( ts->pages, ts->nTabs*sizeof(HWND) );
ts->ids[ts->nTabs-1] = lParam;
ts->titles[ts->nTabs-1] = (LPSTR)wParam;
ts->pages[ts->nTabs-1] = CreatePage( hwnd, 1 );
ts->set = true;
SendMessage( GetParent( hwnd ), MCC_TABSEL, (WPARAM)ts->titles[ts->active],(LPARAM)ts->active );
InvalidateRect( hwnd, NULL, FALSE );
UpdateWindow( hwnd );
return 0;
}
I think that's enough to get started with. And thanks so far, you people are far extremely helpful ... and tolerant ..