Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++Builder Form1 to Form2

Status
Not open for further replies.

Royt

IS-IT--Management
Jan 31, 2000
61
0
0
GB
Sorry for the following short story.<br><br>MainForm fsMDIForm - one menu opens lots of fsMDIChild forms<br><br>The File menu can open Form1(fsNormal) or Form2(fsNormal)<br><br>Form1 is Autocreated and receives data from a COM port using a Thread and writes to a file. The Thread is terminated in the FormCloseQuery routine after which CanClose is set true and the form is closed mode caHide. In the FormHide routine Form1-&gt;Visible is set false.<br><br>Form2 is Non-Autocreated and imports the data from the above file into tables in a database.<br><br>Problem:<br>Running these two forms from the main menu independently works OK and on terminating the program I get no error.<br><br>However, I also allow an autoupdate, if a button is checked, by Form1 opening Form2:<br><br>void __fastcall TForm1::FormHide(TObject *Sender)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;frmForm1-&gt;Visible = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;if (AutoUpdate)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TForm2 *Form2= new TForm2(this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Form2-&gt;Show();<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>This all works fine and the rest of the program works fine. I can repeatedly input serial data and update. BUT, when I close the program I always get<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EWin32Error message 'A Win32API function failed'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this is while executing an inline form destroy <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* TCustomForm.Destroy */<br>The error message is of course in the IDE with debug enabled.<br><br>I am using C++Builder 5 Professional but I've had the problem previously in version 3.<br><br>Anybody got any suggestions (other than jump)?<br><br>Roy Thomas<br><br>&nbsp;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top