c++builder

GDI handle leak using TGIFImage in a second thread

时光总嘲笑我的痴心妄想 提交于 2019-11-27 13:15:04
问题 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.

Eclipse CDT: Unresolved inclusion of stl header

て烟熏妆下的殇ゞ 提交于 2019-11-27 11:58:47
I'm trying to use Eclipse to edit sources, compiled under C++ Builder, but stuck with Unresolved inclusion problem. For example, code like: #include <vector> Gives Unresolved inclusion: <vector> error in Eclipse IDE. C++ Builder indeed has no vector file, instead it has vector.h which is used by compiler. Eclipse IDE gives no error if I write #include <vector.h> How do I tell Eclipse to use vector.h when it sees #include <vector> ? This allowed me to avoid Eclipse "Unresolved inclusion" error. In my case I had to find the location of the C++ vector header on my computer (which is a Mac): find

Start program on a second monitor?

£可爱£侵袭症+ 提交于 2019-11-27 11:39:29
问题 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. 回答1: 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

C++ Builder / Delphi 2010 application manifest template

為{幸葍}努か 提交于 2019-11-27 07:14:15
问题 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

Which COM smart pointer classes to use?

。_饼干妹妹 提交于 2019-11-27 06:43:53
问题 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

Rotating a square TBitmap on its center

为君一笑 提交于 2019-11-27 04:54:32
问题 I am trying to find the simplest way to rotate and display a TBitmap on its center by any given angle needed. The TBitmap is square and any clipping that might occur is not important so long as the rotated bitmap's center point remains constant. The image is very small, only around 50 x 50 pixels so speed isn't an issue. Here is the code I have so far which rotates a TBitmap to 90 degrees, which is simple, the any angle thing less so. std::auto_ptr<Graphics::TBitmap> bitmap1(new Graphics:

Counting Rooms While Knowing Where Walls Are

十年热恋 提交于 2019-11-27 03:38:02
问题 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

Masking floating point exceptions with Set8087CW, SetMXCSR and TWebBrowser

若如初见. 提交于 2019-11-27 03:27:23
问题 As I am receiving "Floating point division by zero" exception when using TWebBrowser and TEmbeddedWB from time to time, I discovered that I need to mask division by zero exceptions Set8087CW or SetMXCSR. Q1: What would be the best approach to do this: to mask such exceptions early in the application startup and never touch them again (the app is multithreaded)? to use OnBeforeNavigate and OnDocumentComplete events to mask / unmask exceptions? (is there a chance that exception could occur

Cross thread communication in Delphi

不想你离开。 提交于 2019-11-27 01:43:07
问题 Is there any documentation on cross thread communication in Delphi? How can I send message to the thread that doesn't have a window? 回答1: You can only send (Windows) messages to threads that implement a standard message loop, which will automatically be created once a window handle is realized. It is however not necessary to use messages to communicate with a thread. Just let it wait on an event object (TEvent in VCL), and signal this event when you want the thread to perform a function. But

How can I enable DEP/NX and ASLR on a Delphi 2006 or earlier executable?

霸气de小男生 提交于 2019-11-27 01:42:26
问题 Delphi 2007 (and newer) supports enabling DEP and ASLR via any of these three techniques: add the command-line switch –dynamicbase when compiling with dcc32 add the preprocessor command {$DYNAMICBASE ON} to the source code manually OR in the bit in the header, with {$SETPEOPTFLAGS $40} in the source code I'd like to be able to do the same thing with Delphi 2006 and C++ Builder 2006 (aka BDS 2006). Does anyone know how to do this? 回答1: Set PE flags You can use {$SetPEOptFlags $40} to set the