c++builder

Registering a custom CodeInsight manager to C++Builder without initialization/finalization sections

北城余情 提交于 2019-12-11 07:13:42
问题 I'm trying to register a custom CodeInsight manager into C++Builder 10.1.2 Berlin. Because there's nothing like Objects Pascal 's initialization and finalization sections in C++, e.g. var codeManagerIndex: Integer; {...} initialization codeManagerIndex := (BorlandIDEServices as IOTACodeInsightServices).AddCodeInsightManager(TMyCodeInsightManager.Create); finalization (borlandIDEServices as IOTACodeInsightServices).RemoveCodeInsightManager(codeManagerIndex); end. I tried reproducing their

Does C style casting adds assembly (code) or is it only for the compiler to understand the situation?

我的未来我决定 提交于 2019-12-11 06:02:45
问题 Class A { public: A *GetA(void) { return a; } protected: A *a; }; Class B : public A { public: B *GetB(void) { return (B*)a; } }; In class A I assume that the compiler (ideally) will optimize and inline the getter to no different code than accessing the variable directly ? In class B the variable is cast to B. Is this purely for the compiler or does this also involve code ? Will the assembly instructions be the same for the function in B ? 回答1: Most casts do not insert any assembler

Showing WideString variable into console

。_饼干妹妹 提交于 2019-12-11 05:25:18
问题 I'm having problems showing a WideString into the console. I'm totally new on Builder C++ and C++ in general. Not sure if I need some headers or maybe the values shown when debugging could help. It seems that when doing wcout << s; it is showing the address instead of the "wchar array". Here it is my code: //--------------------------------------------------------------------------- #include <iostream.h> #include <vcl.h> #include <string> #include <wstring.h> #pragma hdrstop //---------------

Create TNotifyEvent in C++ for use at Application level

Deadly 提交于 2019-12-11 05:21:53
问题 I need to hook on to the Application's OnDeactivate event in C++ Builder. So I need to write my own function to run when the OnDeactivate event fires for the application, but I don't know where or how to define that function. Ideally I would like my code to look something like this: WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) { try { Application->Initialize(); Application->OnDeactivate = myFunction; Application->Run(); } later: void myFunction(TObject *Sender) { //Do Stuff } When I

Assigning events to a VCL control created dynamically at runtime (2)

心不动则不痛 提交于 2019-12-11 05:05:11
问题 This is related to Assigning events to a VCL control created dynamically at runtime. I used the above listed/reference post to solve a problem that I had with some code. Thank you for providing that example. I found it very useful, and implemented the "alternative" way that it provided as I was unable to make the first way work. I am using C++Builder 10.x from Embarcadero. I just updated to C++Builder 10.3. This new update is now throwing a warning: [bcc32c Warning] LogitToMemo.cpp(196):

Grouping Controls

放肆的年华 提交于 2019-12-11 04:52:10
问题 I'm using C++ Builder 5. Is there a way to group a disparate set of controls so that by simply calling, for instance, myGroup.Enabled = false; will set all group of controls enabled property to false? I can't use a GroupBox since the controls (labels, checkboxes, etc) are on different TabPages . The reason I ask is so I don't have to call each control's enabled property explicitly and can do it with one simple call. If not, how can I create a custom Control class to do this? 回答1: You could

wglShareLists fails with error 6 : ERROR_INVALID_HANDLE The handle is invalid

北战南征 提交于 2019-12-11 04:28:28
问题 I try to share a HPBUFFERARB between two classes : TGLForm and TGLForm2. (I tried FBO but having an old Borland Builder 6 version I can't manage using FBO) My goal is to display the same buffer in two openGL windows. So I declared outside of the first Form this object : struct GLRenderToTexture { struct { HDC hdc; HGLRC hGlRc; HPBUFFERARB hBuffer; PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB; PFNWGLCREATEPBUFFERARBPROC

Function return value from form unit and non-form unit

霸气de小男生 提交于 2019-12-11 04:23:53
问题 Previously I am able to get the result, but took it further to broaden my understanding its workings. Unit1.h #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <System.Classes.hpp> #include <Vcl.Controls.hpp> #include <Vcl.StdCtrls.hpp> #include <Vcl.Forms.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TButton *Button1;

How can I find the colour of any pixel on the screen

你说的曾经没有我的故事 提交于 2019-12-11 03:57:02
问题 I usually program in VB6 but but I believe with that I might be restricted to details within the active form. I also have codegear 2009 with c++ and delphi, that I got from a mate but I only have a little experience with Delphi and none at all with c++ but at least I have them if one of those program need to be used to acheive what I'm trying to do. I want to be able to do something like IF pixelVar(x,y) = 'Red' ( or 'RGBvalue or whatever the correct colour representation) THEN do something

Loading style from resource on Mac OS X

纵饮孤独 提交于 2019-12-11 02:49:32
问题 Using Firemonkey (FMX) in C++ Builder XE6, I am attempting to load a style in my project's cpp file. Just before Application->Initialize () I have Fmx::Types::TFmxObject *style; style = TStyleStreaming::LoadFromResource((unsigned int)HInstance, L"MacJet", RT_RCDATA); TStyleManager::SetStyle (style); where the style named MacJet has been loaded as a resource into the project at design time. When I activate Win32 as the target platform, this runs fine, and the style shows properly in the