c++builder

Resizing main menu for high DPI/font size

徘徊边缘 提交于 2019-12-13 00:34:48
问题 I have an issue with font height in standard main menu/popup menu when it contains images. Looks like this. When there are no images, there are no problems as displayed above. Main menu uses TImageList with image width/height set to 16. So I want to preserve image size at 16x16 and center it, to get something like this: How can I read the font height of the main menu and adjust images in TImageList accordingly? One idea I have is to copy images from one TImageList to another with larger image

C++ Builder 2010 Strange Access Violations

白昼怎懂夜的黑 提交于 2019-12-12 19:22:56
问题 I've got a program that is to become part of an already existing, larger product which is built using C++ Builder 2010. The smaller program does not (yet) depend on C++ Builder. It works fine in MS Visual Studio, but with C++ Builder it produces strange access violations. Please let me explain this. Depending on the code and on compiler settings, access violations happen or do not happen. The access violations are reproducible: When the program is built then the access violation does never

How do I listen the event of Running IE with IWebBrowser2 in C++ XE2?

爷,独闯天下 提交于 2019-12-12 19:00:42
问题 Currently I want to automate the running IE. I have successfully attached the running IE using below code (I assume there is only one IE within one tab) #include "atl/atlbase.h" #include <exdisp.h> #include <mshtml.h> CComQIPtr<IWebBrowser2> pCurIE; void __fastcall TForm4::Button3Click(TObject *Sender) { bool SuccessToHook = false; CComPtr<IShellWindows> m_spSHWinds; if (FAILED(m_spSHWinds.CoCreateInstance( __uuidof( ShellWindows)))){ return ; } LONG nCount; m_spSHWinds->get_Count( &nCount);

MSBuild does not work anymore with Tokyo

邮差的信 提交于 2019-12-12 17:04:56
问题 I have multiple project groups that I want to compile at batch. There are over 100 projects in there. In 2010 we had a "make" file like this: call "c:\Borland\RAD Studio\19.0\bin\rsvars.bat" "c:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /t:Clean,Build Group1.groupproj Under Tokyo it does not work anymore. I get: C:\Borland\RAD Studio\19.0\Bin\CodeGear.Cpp.Targets(3695,5): error : Error: Unable to open file 'L_ER_FD.RES' [P:\Ent\_common\er\prj\l_er_fd.cbproj] However, the project group

C++ Builder 2009 - Cannot focus a disabled or invisible window

我只是一个虾纸丫 提交于 2019-12-12 16:41:46
问题 I've been refactoring an old project. I found when the old programmers tried to use the SetFocus() of TWinControls they surrounded them in try/catches with empty catch blocks. Thus swallowing the exceptions. The default behavior of the program is to set the focus if the control is enabled. In order to do that I created a function which I can pass the TWinControl to: void SafeSetFocus(TWinControl *Control) { if(Control->Enabled && Control->Visible) { Control->SetFocus(); } } This code works

C++ Builder pattern with Fluent interface

不羁岁月 提交于 2019-12-12 14:10:10
问题 I am trying to implement builder pattern with fluent interface for building the objects in C++. I want the builder to follow CRTP pattern. In Java, I would do something similar to the below code. How do I do the same in C++? The below is some java code that has a base class and a derived class. The derived class's builder inherits the base class's builder.. // Base class public abstract class BaseClass { private final int base_class_variable; BaseClass(final Builder <?> builder) { this.base

Is it possible to find out what is leaking GDI Objects

本小妞迷上赌 提交于 2019-12-12 13:26:44
问题 I have an application in Embarcadera RAD Studio 2010 (C++) . Is it possible to peek into it to see what would be leaking GDI Objects? A tree structured menu is leaking GDI Objects when text is set to Bold . My guess is that the "original" text is first created and then an instance where it is in bold and the first one is "forgotten about" and leaked. EDIT: Since no leak is reported usin AQTime, even though is obvoius by looking at Taskmanager, I traced the snippet of code that is creating and

How to Get TCanvas DC in Firemonkey?

↘锁芯ラ 提交于 2019-12-12 13:15:20
问题 What I need I need to get the DC of a Firemonkey component's TCanvas . I need this to use Win API drawing functions not accessible through Firemonkey, mainly 100% control over font rendering. Obviously, this is a pure Windows Application, so any compatibilities with OSX isn't an issue. What I did I managed to get hold of the TForm's handle and convert it into a HWND, then getting the DC with GetDC(FmxHandleToHWND(Handle)); This is the OnPaint handler for the Character_PaintBox control. HWND

Hook into the Windows File Copy API from C++

拜拜、爱过 提交于 2019-12-12 12:33:45
问题 I need to hook copyfile in order to stop the process whenever a malicious file is being copied. I saw a question asked by Cat Man Do Hook into the Windows File Copy API from C# and he mentioned that there is a solution for this problem in c++. I am using embarcadero c++ builder(non-MFC). Is this solution applicable for c++ builder and if it is can anybody post the link or give me a hint on how to hook copyfile in c++? 回答1: You're not being specific about what you mean by "stop the process" -

How to set form height larger than 1096 pixels?

☆樱花仙子☆ 提交于 2019-12-12 10:37:06
问题 I am using C++ Builder XE7 and having a strange problem. I need a form height to be about 1500 pixels. The problem is that object inspector does not allow me to specify value that is larger then 1096 pixels. If I set any larger value it is automatically set to 1096.. The problem exists on any existing or new form. I'm using Windows 7 with screen resolution 1920x1080. 回答1: The reason for this behavior is that when you do not set constraints for the form size, Delphi will automatically get