c++builder

How to parse a JSON array in RAd Studio?

我怕爱的太早我们不能终老 提交于 2019-11-29 10:26:17
问题 I am trying to parse the following Json document: [ {"EventType":49,"Code":"234","EventDate":"20050202", "Result":1}, {"EventType":48,"Code":"0120","EventDate":"20130201", "Group":"g1"} ] I use the following code: TJSONObject* jsonread0 = (TJSONObject*) TJSONObject::ParseJSONValue(TEncoding::ASCII->GetBytes(Memo1->Lines->Text), 0); for(int i=0;i<jsonread0->Size();i++) { TJSONPair* pair = jsonread0->Get(i); At this point, pair.JsonValue is NULL. What do I need to do to read the values? 回答1:

How can I generate continuous tones of varying frequencies?

假如想象 提交于 2019-11-29 09:49:19
问题 I want to generate and play a continuous sound with specific frequencies and amplitudes that change over time. I don't want to have a delay between sounds. How can I do this with Delphi or C++ Builder? 回答1: By using WaveAudio library it's possible to generate a continous cosinus wave. I was gonna post some code but I can't figure out how to do it properly so I won't. But all you need to do is use TLiveAudioPlayer and then override the OnData event. And also set Async to true if there is no

BCB : how to iterate over controls on a form?

北城以北 提交于 2019-11-29 08:41:54
I am looking for some BCB code to iterate over the controls on a form and get some information about them. I tried using myForm->ControlCount and typeid(myForm->Controls[i]) but this gave me a few problems. 1) typeid(myForm->Controls[i])->Name always gives "TControl *" and I was hoping for "TEdit *", "TMemo *", etc Can I get round that by using if (typeid(myForm->Controls[i]) == typeid(TEdit)) and then casting? (if so, how best to cast?) 2) how can I (probably by casting) get the properties of the control? e.g, Name, Width, Height, etc? I woudl really appreciate actual code here (or a URL of

Adding additional library and include paths when compiling from command line

≡放荡痞女 提交于 2019-11-28 23:38:52
I'm trying to add additional paths to be used by my project group during compilation. Since C++ Builder 2010 uses msbuild I have tried looking at the documentation for that and according to what I can find AdditionalLibPaths should be passable as a property. i.e msbuild /p:AdditionalLibPaths=C:\FooBar\Libs /t:build foo.groupproj But it doesn't seem to use the paths I added. I have previously noticed that some property names differ between VC++ and C++ Builder when passed to msbuild and wonder if C++ Builder might use some other property name to add additional lib and include folders? I don't

GDI handle leak using TGIFImage in a second thread

痞子三分冷 提交于 2019-11-28 20:37:50
I have a background thread which loads images (either from disk or a server), with the goal of eventually passing them to the main thread to draw. When this second thread is loading GIF images using the VCL's TGIFImage class , this program sometimes leaks several handles each time the following line executes in the thread: m_poBitmap32->Assign(poGIFImage); That is, the just-opened GIF image is being assigned to a bitmap owned by the thread. None of these are shared with any other threads, i.e. are entirely localised to the thread. It is timing-dependent, so doesn't occur every time the line is

Start program on a second monitor?

久未见 提交于 2019-11-28 18:47:24
Is there a way to specify which monitor a application appears on in Delphi or C++Builder? I am developing a simple program for a customer, which displays kitchen orders on a secondary monitor, generated by a hospitality system. Currently they need to manually drag the window onto the second monitor after it starts. Save the window position before program shutdown and restore them on startup. Multimonitor displays just increase the size of the desktop; other monitor surfaces just have a different section of the same X/Y plane with its origin at the top-left of the primary monitor. This can be

3D library recommendations for interactive spatial data visualisation?

人走茶凉 提交于 2019-11-28 17:13:12
问题 Our software produces a lot of data that is georeferenced and recorded over time. We are considering ways to improve the visualisation, and showing the (processed) data in a 3D view, given it's georeferenced, seems a good idea. I am looking for SO's recommendations for what 3D libraries are best to use as a base when building these kind of visualisations in a Delphi- / C++Builder-based Windows application. I'll add a bounty when I can. The data Is recorded over time (hours to days) and is GPS

C++ Builder / Delphi 2010 application manifest template

℡╲_俬逩灬. 提交于 2019-11-28 12:43:49
After googling so much that my head is spinning and a bunch of misleading and contradictory information, I've managed to compile the following minimum "template" for application manifest which is supposed to do define the following: program version and name that it does not require any special administrator privileges that it is compatible with Windows Vista to Windows 8.1 that it is DPI aware Is my manifest file sufficient for the above purpose and are there any mistakes I did, that I should be aware of? I am in particular puzzled by the xmlns namespace versions and the reason why they are

Which COM smart pointer classes to use?

坚强是说给别人听的谎言 提交于 2019-11-28 12:04:17
I'm confused by the choices for COM smart pointers classes for C++ programming: There's three four I'm aware of: CCOMPtr from ATL _com_ptr_t from the MS Com Support Classes TComInterface (because I'm using C++Builder 2009) CCOMQIPtr , (which I'd previously forgotten) I've read about the error vs. exception handling differences of the first two, but TComInterface seems totally undocumented. Both the first two seem to have gotchas or 'unexpected' behaviour, from what I can find. Ideally, I'd like something that's clean and modern C++, but boost::com doesn't exist as far as I know... I need to

Counting Rooms While Knowing Where Walls Are

梦想与她 提交于 2019-11-28 10:26:04
This question is on code for C++ builder 6. The bounty is interested in a standard C++ algorithm to solve the problem given a standardized input (see this for more information.) The txt file which also represents the data I have in an array: 1101 0110 1101 0110 1100 0101 0110 1110 1001 0110 1011 1010 1111 1010 1000 0101 0011 1110 1011 1110 1010 1011 1101 0101 0001 0101 0011 1011 Explanation of the txt: The numbers from the txt file are a 4-bit representation of the walls to a room, with a set bit representing a wall. The wall bits are in clockwise order starting with the most significant bit