Click here to Skip to main content
15,881,204 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WINS Pin
Jair1-Nov-03 3:29
Jair1-Nov-03 3:29 
QuestionXP GetSysColor()??? Pin
alex.barylski29-Oct-03 12:17
alex.barylski29-Oct-03 12:17 
AnswerRe: XP GetSysColor()??? Pin
michael_cowan29-Oct-03 13:00
michael_cowan29-Oct-03 13:00 
GeneralRe: XP GetSysColor()??? Pin
alex.barylski29-Oct-03 15:17
alex.barylski29-Oct-03 15:17 
GeneralCalling a dialog from a dll question Pin
Steve Messer29-Oct-03 11:53
Steve Messer29-Oct-03 11:53 
GeneralRe: Calling a dialog from a dll question Pin
igor196029-Oct-03 12:49
igor196029-Oct-03 12:49 
GeneralRe: Calling a dialog from a dll question Pin
Steve Messer29-Oct-03 14:35
Steve Messer29-Oct-03 14:35 
GeneralProblem with control arrays Pin
Stephan Poirier29-Oct-03 11:49
Stephan Poirier29-Oct-03 11:49 
Hi everyone!

I need to create a button array that can be resized.
I tought it was easy like in VB but I got a problem. I'm unable to create buttons!

For example, I placed this is my header file :

//Pointer to button array<br />
CButton* myButton;<br />
<br />
//Hold number of buttons in the list<br />
int nbButtons;<br />
<br />
//Add a button in the list<br />
void InsertButton(LPCTSTR lpszText);


Then in the implementation file, I've set

void CLinkList::InsertButton(LPCTSTR lpszText)<br />
{<br />
        // Memory allocation ( preserve existing!! )<br />
	if(nbButtons<1)   // First memory allocation<br />
	    myButton=(CButton*)malloc(sizeof(CButton)*(nbButtons+1));	<br />
        else              // Dynamic realoccation<br />
	    myButton=(CButton*)realloc(myButton, sizeof(CButton)* (nbButtons+1));	<br />
<br />
        // Set location<br />
	CRect rect(0,nbButtons*25,60,20);<br />
	<br />
        // Create the button control<br />
	myButton[nIndex].Create( lpszText, WS_VISIBLE | WS_CHILD, rect, this, GetDlgCtrlID() );<br />
<br />
        // Increment number of buttons in the list<br />
	nbButtons++;<br />
<br />
}


But I'm not able to create any button. I didn't get any assertion error but it stop within the CButton::Create function. I don't have any idea of what is the problem.

I know that if I create a static array like :

CButton myButton[30];

it works very well...

What's wrong with the way I do, and how can I solve it? Notice that I want my array to be resized because I don't want to hold a "big" static array. And probably because I'm curious to know how it works too! Big Grin | :-D

It will be very appreciated if somebody here could help me!!

Stef

Progamming looks like taking drugs...
I think I did an overdose. Poke tongue | ;-P
GeneralRe: Problem with control arrays Pin
alex.barylski29-Oct-03 12:04
alex.barylski29-Oct-03 12:04 
GeneralRe: Problem with control arrays Pin
Joaquín M López Muñoz29-Oct-03 12:05
Joaquín M López Muñoz29-Oct-03 12:05 
GeneralRe: Problem with control arrays Pin
Stephan Poirier29-Oct-03 12:43
Stephan Poirier29-Oct-03 12:43 
GeneralRe: Problem with control arrays Pin
Stephan Poirier29-Oct-03 13:01
Stephan Poirier29-Oct-03 13:01 
GeneralATL 7 collection class Pin
Urban Olars29-Oct-03 10:45
Urban Olars29-Oct-03 10:45 
QuestionCan someone clarify some Windows' terms for me Pin
mwhannan29-Oct-03 10:38
mwhannan29-Oct-03 10:38 
AnswerRe: Can someone clarify some Windows' terms for me Pin
alex.barylski29-Oct-03 11:07
alex.barylski29-Oct-03 11:07 
GeneralRe: Can someone clarify some Windows' terms for me Pin
Blake Coverett29-Oct-03 11:12
Blake Coverett29-Oct-03 11:12 
AnswerRe: Can someone clarify some Windows' terms for me Pin
Blake Coverett29-Oct-03 11:10
Blake Coverett29-Oct-03 11:10 
AnswerRe: Can someone clarify some Windows' terms for me Pin
mwhannan29-Oct-03 17:10
mwhannan29-Oct-03 17:10 
GeneralLooking for products for relational and code generation Pin
mcgahanfl29-Oct-03 10:35
mcgahanfl29-Oct-03 10:35 
GeneralHelp !!! Pin
Guillermo Rivero29-Oct-03 10:19
Guillermo Rivero29-Oct-03 10:19 
GeneralRe: Help !!! Pin
Christian Graus29-Oct-03 15:06
protectorChristian Graus29-Oct-03 15:06 
GeneralCMDIChildWnd Scrollbars Pin
alex.barylski29-Oct-03 9:50
alex.barylski29-Oct-03 9:50 
GeneralRe: CMDIChildWnd Scrollbars Pin
alex.barylski29-Oct-03 11:17
alex.barylski29-Oct-03 11:17 
GeneralRe: CMDIChildWnd Scrollbars Pin
Peter Molnar29-Oct-03 12:59
Peter Molnar29-Oct-03 12:59 
QuestionWhich one makes for faster programs: DLLs or static libraries??? Pin
mwhannan29-Oct-03 9:24
mwhannan29-Oct-03 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.