c++builder

what is the meaning of `Class of ` type declaration?

情到浓时终转凉″ 提交于 2019-12-23 10:41:03
问题 While going through one of my code, I am stuck on one statement which is as below. TMyObjectClass = class of TMyObject; I am a bit confused, and wondering what is the meaning of this statement. As TMyObjectClass has no declaration above the statement. and TMyObject is having declaration as below: TMyObject = class(TObject) private //some private member declaration Public // some public variables end; So, my question is what is the meaning of the statement TMyObjectClass = class of TMyObject;

How to auto expand all TTreeView nodes?

我怕爱的太早我们不能终老 提交于 2019-12-23 09:36:24
问题 I want to expand tree on main form when application starts. How i can do it? I cant find corresponding property. C++ builder 2009. 回答1: You simply need to call FullExpand() on the tree view. 回答2: When adding treenode make its expanded property to true you will find a property for the treeNode Object, set it yo true before add to list of nodes. and also you can find a method for the treeView called ExpandAll My Regards try this code //this will expand all nodes of Level and their parents

What is the equivalent of dynamic_cast in Delphi?

只谈情不闲聊 提交于 2019-12-23 09:09:09
问题 In Delphi, what is the equivalent of C++'s dynamic_cast , reinterpret_cast , and static_cast operators (especially when used on objects)? 回答1: reinterpret_cast Most of the time, in Delphi, a cast is a reinterpret_cast , i.e. the bits and bytes of one type are reinterpreted as if it were another type, e.g. Integer(myEnum) or Pointer(MyDynamicArrayVar) . Some casts cut off bits, i.e. Integer(MyInt64) will cut off the top 32 bits of the Int64 , and the top bit of the lower 32 bits will become

How do I set my MainForm to be hidden when my program starts?

南楼画角 提交于 2019-12-23 08:28:08
问题 I am using the Borland c++ builder. I have an application where I want the main form to be hidden until a button is pressed on a different form. i have set the Visible value on the mainform to false, but it still shows up when i run the program. anyone know what to do? 回答1: Have a look at the TApplication ShowMainForm property. Here is an example based on the instructions in online help. Set the main form Visible property to false. On the menu select Project -> View Source to display the main

“There is no default printer selected” error when Windows default printer is not set up

蹲街弑〆低调 提交于 2019-12-23 06:09:31
问题 I need to open the Printer Dialog box when there is no Windows default printer setup. It works fine with the below code when a Windows default printer is set up. TPrintDialog *dlgPrint = new TPrintDialog(frmDisplayDetail); if( dlgPrint->Execute()) { //code here } But if there is no default printer setup in Windows, dlgPrint->Execute() throws an exception: There is no default printer selected To check the default printer index, I used Printer()->PrinterIndex . This value becomes inaccessible

Unable to detect C++ synchronous boost::asio::ip::tcp::socket connection being closed

孤街醉人 提交于 2019-12-23 06:07:10
问题 I am using boost::asio to make a synchronous TCP socket connection to a node.js TCP server application that runs on the same computer. I am using Embarcadero RAD studio XE4 on Windows building 64 bit application that uses the Embarcadero integrated boost version 1.50. Things work fine except when the node.js TCP server shuts down. When this occurs my C++ client application does not detect the disconnection when I read from the socket. However, it does detect the disconnection when I write to

Unable to detect C++ synchronous boost::asio::ip::tcp::socket connection being closed

流过昼夜 提交于 2019-12-23 06:07:03
问题 I am using boost::asio to make a synchronous TCP socket connection to a node.js TCP server application that runs on the same computer. I am using Embarcadero RAD studio XE4 on Windows building 64 bit application that uses the Embarcadero integrated boost version 1.50. Things work fine except when the node.js TCP server shuts down. When this occurs my C++ client application does not detect the disconnection when I read from the socket. However, it does detect the disconnection when I write to

How could i Create a process with hiding the process window (from the task bar) in winXP? with CreateProcess function?

跟風遠走 提交于 2019-12-23 04:37:37
问题 /* CreateProcess initialization */ STARTUPINFO si; PROCESS_INFORMATION pi; memset(&si, 0, sizeof(si)); memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); long ret; // si.wShowWindow = SW_HIDE; // hide process window.... // run in background.. si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; if (!CreateProcess(0, exe, 0, 0, 1, NORMAL_PRIORITY_CLASS, 0, 0, &si, &pi)) { return; } //int prez = WaitForSingleObject(pi.hProcess, INFINITE); //CloseHandle(pi.hProcess); 回答1: You can attempt to

How do I forward request to another proxy server using TIdHTTPProxyServer (proxy chain)

孤街浪徒 提交于 2019-12-23 03:47:32
问题 currently I want to make my indy proxy server forward the request to another proxy server. I have found this link and made a try by myself. But my code does not work without any error message as if I had made no change. My code is as below in C++ XE2. void __fastcall TForm3::MyProxyHTTPBeforeCommand(TIdHTTPProxyServerContext *AContext) { TIdIOHandlerStack* tempIO = new TIdIOHandlerStack(NULL); TIdConnectThroughHttpProxy* tempProxy = new TIdConnectThroughHttpProxy(NULL); tempProxy->Enabled =

Implement IDropTarget

可紊 提交于 2019-12-23 03:20:11
问题 I would like to drag and drop files from windows explorer onto my application which is being built in Codegear RAD studio 2009. Then I would like to be able to access data from the object I am dragging and dropping. I believe I have to implement IDropTarget. Can someone please provide an example of how I might implement IDropTarget to achieve this? 回答1: There is a nice example written by Michael Dunn over at codeproject.com which shows how to implement IDropTarget and access data from inside