c++builder-6

GetTextMetrics returning different maximum and average character width for Courier New

橙三吉。 提交于 2020-12-26 10:25:42
问题 I'm maintaining an application using Borland C++ Builder 6 running on Windows 7. The application is incorrectly drawing text using font Courier New because each letter is being slighty cut off. The issue is when calling the method GetTextMetrics because it is filling the TEXTMETICS struct with differing tmAveCharWidth and tmMaxCharWidth values. The application then uses tmAveCharWidth to calculate character width with is wrong because that value it can be less than tmMaxCharWidth. That issue

Convert the Sender parameter of an event handler in order to read the control's Name?

徘徊边缘 提交于 2020-05-14 14:15:22
问题 I am writing a Form application using Borland C++Builder 6.0. I have put 2 TImage controls and I have generated the OnClick event handler as shown below: void __fastcall TForm1::Image1Click(TObject *Sender) { AnsiString imageName; TImage *image; // How can I get the image name via the *Sender ? // How can I convert *Sender into TImage image = (TComponent)*Sender; imageName = image->Name; } I have assigned the same OnClick event on both of my TImage controls. What I want to achieve is to have

How to store values from an SQL query into a ComboBox component?

眉间皱痕 提交于 2020-01-06 06:36:32
问题 I have a problem with the TComboBox component in Borland C++Builder 6. In the ComboBox, I want to insert the result of an SQL query, eg: ID value --------- 1 one 2 two 3 three I want to display the values of the value column to the user, e.g. one , two , three , but reference the values of the ID column. Can anyone help me? Google did not say a lot about this to me. 回答1: apologize forgot to put in some code ComboBox1->AddItem("one", (TObject *) 1); ComboBox1->AddItem("two", (TObject *) 2);

How to store values from an SQL query into a ComboBox component?

懵懂的女人 提交于 2020-01-06 06:35:21
问题 I have a problem with the TComboBox component in Borland C++Builder 6. In the ComboBox, I want to insert the result of an SQL query, eg: ID value --------- 1 one 2 two 3 three I want to display the values of the value column to the user, e.g. one , two , three , but reference the values of the ID column. Can anyone help me? Google did not say a lot about this to me. 回答1: apologize forgot to put in some code ComboBox1->AddItem("one", (TObject *) 1); ComboBox1->AddItem("two", (TObject *) 2);

Assigning events to a VCL control created dynamically at runtime

二次信任 提交于 2019-12-25 18:06:10
问题 I'm trying to create a dynamic VCL control at runtime and assign an event handler to it. I think I've tried everything to get this to work, but cannot (everything I try generates different errors). If you could help fill in the question marks in the code below, it would be of great help! Oh, in case you're wondering why it's in a namespace instead of a class , it's because this is actually a large library that I just kept adding to. When I change it to a class , you'd think it would be fine,

paintbox doesnt paint from timer method c++ builder borland

﹥>﹥吖頭↗ 提交于 2019-12-24 22:01:14
问题 I am using Borland C++Builder 6. I have two methods of the form: void __fastcall FDisplay::PaintBox1Paint(TObject *Sender) void __fastcall FDisplay::TimerLabelsViewTimer(TObject *Sender) In the first method I draw the coordinate system. and in the second method I did: PaintBox1->Canvas->MoveTo(693,201); PaintBox1->Canvas->LineTo(770,187); and the line doesn't appear on the coordinate system. my second question, how can I erase the line and return to the base paint? Should I do this? PaintBox1

Link error in Borland 6.0

拥有回忆 提交于 2019-12-24 18:20:27
问题 Got Link error (Fatal: Access violation. Link terminated) in Borland 6.0. How do I know what is the cause of it ? Is there any output file that I can open and get more informative message ? 回答1: You should be able to use the command line that gets passed to the linker to determine which .obj files are being passed to the linker. You can then include/exclude files to see when the error occurs. A number of linker problems have been fixed since BCB6, you may want to try the linker from a demo of

ProcessMessages on OnShow Event c++ builder

一世执手 提交于 2019-12-24 14:52:10
问题 I'm using c++ builder (bcb6) and on: FormShow event there is: Application->ProcessMessages I would like to know what exactly the responsibility of: Application->ProcessMessages What exactly it did? and when we shall use by that? when it can cause exp.? Thanks! 回答1: The BDS 2006 IDE help states for Application->ProcessMessages this: Interrupts the execution of an application so that it can process the message queue. Call ProcessMessages to permit the application to process messages that are

MessageBox “Abnormal program termination” keeps my application running

北战南征 提交于 2019-12-22 05:09:10
问题 ...kind of. As illustrated by this extremely simplistic example, very rarely (only once reported so far), it happens that one of my applications crashes this way. I want to terminate it as I normally do when an unspecific exception occurs. My strategy is to (low-level) log the problem, then terminate. The application is part of a subsystem and I want to (re)start it, if any problem is detected. It's built with C++-Builder 6 and runs on Windows (XP...7, also 8). I learned that an abort() most

Out of virtual memory address space (Borland C++ Builder 6 program)

我与影子孤独终老i 提交于 2019-12-14 01:39:49
问题 I have problem with some application written under C++ Builder 6. After some time of running (week, month) the application crashes and closes without any error message. In my application log shortly before crash i get many "Out of memory" exceptions. I looked at the process when it was throwing out of memory exceptions (screenshot below) and it has lots of uncommitted private memory space. What can be a reason of such behavior? I had such problem once, couple years ago. The reason for that