c++builder

Initializing part of function only once

风流意气都作罢 提交于 2019-12-02 01:23:05
I have a function with a small bit which I want to initialize once e.g. void SomeFunc() { static bool DoInit = true; if (DoInit) { CallSomeInitCode(); DoInit = false; } // The rest of the function code } If this function is called many times it leaves one unnecessary if (DoInit) which can't be optimized. So why don't I do initialization elsewhere like constructor? Because, logically this initialization code best fits inside this function and it is easier to maintain that way, despite the fact it will do unnecessary check every time. Is there a better way to do this without resorting to using

Conditional directive to identify C++ Builder personalities

三世轮回 提交于 2019-12-02 00:32:25
问题 I have a Delphi component which I want to install and have it available at the component palette in Delphi but not in C++ Builder. In BDS/RAD 2006 and above I can either have it installed for both personalities or none. I need to do so because this component uses 3rd party libraries that doesn't support C++ Builder. I have looked at jedi.inc mentioned here but I'm not able to find the combination to be able to register the component in Delphi personalities only. The component should also work

Seeking floorplan design VCL toolbar

情到浓时终转凉″ 提交于 2019-12-02 00:27:36
I'm looking for a VCL component for C++ builder. It should preferably have a toolbar with drag & drop functionality. I want to define a building or area (which might not be rectangular) and split it into "rooms" (or areas, or whatever you want to call them). And I want to be able to put "doorways" (or passages, etc) from a room into its neighbours. is there such a thing? Preferably free. Thanks. In case anyone wants to know the answer, I have verified with TMS that the diagram studio can indeed do this. Although they said "You can use TMS Diagram Studio for that, it’s not that complicated to

How do I disable “cursor beyond end of line”?

情到浓时终转凉″ 提交于 2019-12-01 15:04:36
How do I deactivate Delphi's "Cursor beyond end of line" feature? When I click in the empty space to the right of a line, or when I navigate to a line with the arrow keys, I want the cursor to be at the line's real end, not in the "virtual space". AFAIK, you cannot. The code editor has always had that behavior built-in. You can tell it to not go past End-Of-File, but not End-Of-Line. When possible you can set a macro on one of the mouse buttons to hit the combo "left-click" and "End" when clicked. Not the ideal situation but it does the trick. 来源: https://stackoverflow.com/questions/17977490

Detect screen lock - FMX in Win32

只愿长相守 提交于 2019-12-01 14:07:57
I want my application to run some code when the screen gets locked (Win 7 and 10). My application may be in the background too when user locks screen. Anyone point me in right direction? Thank you, relayman Use WTSRegisterSessionNotification() to register an HWND to receive WTS_SESSION_(UN)LOCK notifications via the WM_WTSSESSION_CHANGE window message. You can use FMX's FormToHWND() function to obtain your Form's HWND . However, FireMonkey controls, including Forms, do not have an overridable WndProc() method to process window messages, like VCL does, so you will have to use the Win32 API's

How do I disable “cursor beyond end of line”?

天大地大妈咪最大 提交于 2019-12-01 13:58:19
问题 How do I deactivate Delphi's "Cursor beyond end of line" feature? When I click in the empty space to the right of a line, or when I navigate to a line with the arrow keys, I want the cursor to be at the line's real end, not in the "virtual space". 回答1: AFAIK, you cannot. The code editor has always had that behavior built-in. You can tell it to not go past End-Of-File, but not End-Of-Line. 回答2: When possible you can set a macro on one of the mouse buttons to hit the combo "left-click" and "End

fail to install chromium embedded on C++ Builder from Delphi files

蓝咒 提交于 2019-12-01 13:32:41
问题 I want to install chromium embedded on C++ Builder v.6 . I already installed it once long time ago, and i developed some applications using TChromium. But after I reinstalled the OS, I'm trying to install this component again. When I compile the delphi pascal units I'm getting linker errors: Build [Linker Error] Unresolved external '__fastcall Outline::TCustomOutline::~TCustomOutline()' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\LIB\BCBSMP.LIB|.\cdiroutl.cpp [Linker Error] Unresolved

Detect screen lock - FMX in Win32

我与影子孤独终老i 提交于 2019-12-01 12:58:28
问题 I want my application to run some code when the screen gets locked (Win 7 and 10). My application may be in the background too when user locks screen. Anyone point me in right direction? Thank you, relayman 回答1: Use WTSRegisterSessionNotification() to register an HWND to receive WTS_SESSION_(UN)LOCK notifications via the WM_WTSSESSION_CHANGE window message. You can use FMX's FormToHWND() function to obtain your Form's HWND . However, FireMonkey controls, including Forms, do not have an

convert unicode to char

泄露秘密 提交于 2019-12-01 12:41:52
How can I convert a Unicode string to a char* or char* const in embarcadero c++ ? "Unicode string" really isn't specific enough to know what your source data is, but you probably mean 'UTF-16 string stored as wchar_t array' since that's what most people who don't know the correct terminology use. "char*" also isn't enough to know what you want to target, although maybe "embarcadero" has some convention. I'll just assume you want UTF-8 data unless you mention otherwise. Also I'll limit my example to what works in VS2010 // your "Unicode" string wchar_t const * utf16_string = L"Hello, World!"; /

C++ Builder bccarm error when calling std::vector::push_back with TObject descendant

强颜欢笑 提交于 2019-12-01 12:24:34
I have some simple C++ code which won't be compiled by the Clang based C++11 compiler bccaarm of C++ Builder 10.1 Berlin. This is the code: TComponent* Comp = new TComponent(this); std::vector<TComponent*> Comps; Comps.push_back(Comp); And this is the error: [bccaarm error] stl_iterator.h(963): rvalue reference to type 'value_type' (aka 'System: classes::TComponent * __strong') can not be bound to lvalue of type '__borland_class * isTObj __strong' (aka 'System::Classes::TComponent * __strong') The compiler stops at line 963 in the file stl_iterator.h: The other C++ compilers bcc32 and bcc32c