cyprus106
Programmer
- Apr 30, 2001
- 654
I have a problem:
I made one form, for a chat program I recently made, It attaches to a server, the server returns a list of online buddies. The user can click on a buddy in a list and the program will create a new instance of my single chat form, like so:
TChatForm *ChtForm /*ChatForm being the one form i created, to spawn multiple times*/
/*later on, in the OnClick function of the list box*/
/*makes a new chat form*/
ChtForm = new TChatForm(ChtForm);
/*names the form for the screen name of the buddy in the list*/
ChtForm->Name = ListBox1->Items->Strings;
ChtForm->Visible = true;
/*now i have lots of code in the ChatForm for sending and rich text, etc. My problem is that whenever i have anything saying 'TForm' in ChatForm, it raises an exception when the application terminates, for example, the below code is on my ChatForm's header, and is for catching when a form is in focus or not*/
protected:
void __fastcall WMFocus(TMessage &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_SETFOCUS, TMessage, WMFocus)
MESSAGE_HANDLER(WM_KILLFOCUS, TMessage, WMFocus)
END_MESSAGE_MAP(TForm)
/*when the program terminates, it raises an exception on the line with 'TForm'. When I try to change it to TChatForm, it raises a Stack Overflow exception on startup. I have several lines with TForm, and I can't delete them, because I need most of the lines*/
Throug bug testing I know that it haas something to do with the way I create the chat form(s), but I don't have another way of doing it, and i dont know what to put in place of TForm that would fix the problem. I tried TCustomForm and TChatForm, TCustomForm does no difference. Does anyone know how to fix this stupid problem? I've been able to deal with it for a month now, but I have to get it out before I re-release the program. Cyprus
I made one form, for a chat program I recently made, It attaches to a server, the server returns a list of online buddies. The user can click on a buddy in a list and the program will create a new instance of my single chat form, like so:
TChatForm *ChtForm /*ChatForm being the one form i created, to spawn multiple times*/
/*later on, in the OnClick function of the list box*/
/*makes a new chat form*/
ChtForm = new TChatForm(ChtForm);
/*names the form for the screen name of the buddy in the list*/
ChtForm->Name = ListBox1->Items->Strings;
ChtForm->Visible = true;
/*now i have lots of code in the ChatForm for sending and rich text, etc. My problem is that whenever i have anything saying 'TForm' in ChatForm, it raises an exception when the application terminates, for example, the below code is on my ChatForm's header, and is for catching when a form is in focus or not*/
protected:
void __fastcall WMFocus(TMessage &Message);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_SETFOCUS, TMessage, WMFocus)
MESSAGE_HANDLER(WM_KILLFOCUS, TMessage, WMFocus)
END_MESSAGE_MAP(TForm)
/*when the program terminates, it raises an exception on the line with 'TForm'. When I try to change it to TChatForm, it raises a Stack Overflow exception on startup. I have several lines with TForm, and I can't delete them, because I need most of the lines*/
Throug bug testing I know that it haas something to do with the way I create the chat form(s), but I don't have another way of doing it, and i dont know what to put in place of TForm that would fix the problem. I tried TCustomForm and TChatForm, TCustomForm does no difference. Does anyone know how to fix this stupid problem? I've been able to deal with it for a month now, but I have to get it out before I re-release the program. Cyprus